redmotion: Auto-rendermap script (XSI)

12 June 2007

Auto-rendermap script (XSI)

Here is a short script for automating the UV-mapping and rendermapping of any polymesh objects you have selected. Change the parts highlighted in red if you want better resolution textures to be generated (eg:512 to 1024). You can also add further rendermap options here like to render illumination only. The line in green is where the UVs are applied. This can be amended to suit various situations.

All rendermaps are automatically saved out to your project/Rendermaps directory.

Once rendermapping is complete, constant shaders are then applied to all the objects and the textures are reattached to the correct objects automatically.

Switch to textured decal in the viewport to see the result.

(Save a copy of the scene before continuing and use at your own risk)

'Make a rendermap on every selected object in scene

'completed between 10 & 11-06-07
'By Jason Wells aka Redmotion

dim name, imfile, oClip

set list = GetValue( "SelectionList" )
if list.count = 0 then
MsgBox "Please select at least one polymesh object first!!"
else

'start rendermap make routine - depending on scene size and object complexity this could take a while... :)
for each item in list
logmessage item.name
name = item.name
if item.type = "polymsh" then
SelectObj name, , True
'set up unique UVs with name starting with RM_
oUVs = GenerateUniqueUVs (, "RM_" & name)

AddProp "RenderMap"
SetValue name & ".RenderMap.imagefilepath", "Render_Pictures\RM_" & name & ".pic"
SetInstanceDataValue , name & ".RenderMap.uvprop", "RM_" & name

SetValue name & ".polymsh.cls.Texture_Coordinates_AUTO.RM_"& name &".PolyPackUV.targresv", 512
SetValue name & ".polymsh.cls.Texture_Coordinates_AUTO.RM_"& name &".PolyPackUV.targresu", 512
SetValue name & ".RenderMap.resolutionx", "512"
SetValue name & ".RenderMap.squaretex", True

logmessage "RENDERMAP generation starts for: " & item.name & " - please wait"
RegenerateMaps name & ".RenderMap"
logmessage "RENDERMAP generation complete!"
end if
next

'change the shaders for selected objects to constants and add RM_image
for each item in list
name = item.name
if item.type = "polymsh" then
SelectObj name, , True

'bring in all rendermap clips
imfile = "Render_Pictures\RM_" & name & ".pic"

oClip = "Clips.RM_" & name & "_pic"

ApplyShader "Material\Constant", , , , siLetLocalMaterialsOverlap
CopyPaste , imfile, "TransientObjectContainer", 1
SIConnectShaderToCnxPoint oClip, ".material.Constant.color", False
SetInstanceDataValue , ".material.Constant.Image.tspace_id", "RM_" & name
end if
next
DeselectAll

end if

8 comments:

Anonymous said...

Woah! I'm really enjoying the template/theme of this site. It's simple, yet effective.

A lot of times it's hard to get that "perfect balance" between user friendliness and appearance. I must say you have done a amazing job with this. Also, the blog loads very fast for me on Safari. Excellent Blog!

Also visit my homepage - methadone addiction

Anonymous said...

I do not know if it's just me or if perhaps everyone else experiencing issues with your website. It seems like some of the text in your posts are running off the screen. Can someone else please provide feedback and let me know if this is happening to them too? This may be a problem with my browser because I've had this
happen previously. Cheers

Feel free to visit my site; Treatment Centers In San Antonio

Anonymous said...

Hey would you mind stating which blog platform you're working with? I'm going to start my own
blog in the near future but I'm having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm
looking for something completely unique. P.
S My apologies for getting off-topic but I had to ask!


Here is my homepage ... used golf flags and cups

Anonymous said...

Howdy would you mind letting me know which web host you're utilizing? I've loaded your blog in 3 completely different web browsers and I must say this blog loads a lot quicker then most.
Can you suggest a good web hosting provider at a honest price?
Cheers, I appreciate it!

Check out my weblog; hyperguide.org

Anonymous said...

I will right away take hold of your rss feed as I can't to find your email subscription link or e-newsletter service. Do you have any? Kindly let me recognise in order that I may just subscribe. Thanks.

my page - golfsmith san diego ca

Anonymous said...

Way cool! Some very valid points! I appreciate you writing this write-up
plus the rest of the website is extremely good.



Here is my homepage :: http://Edwingallery.com/

Anonymous said...

ブランドコピーhttp://www.brandshop9.com 専門店です。弊社にはブランドコピーバッグ、ブランドコピー時計、ブランドコピー財布、ブランドコピー服、ブランドコピーベルト等沢山のスパーブランドコピーが揃えっています。是非ご覧ください。
メール:brandshop8899@yahoo.co.jp
HOME: http://www.brandshop9.com
http://w.livedoor.jp/brandshop9/

Anonymous said...

You should take part in a contest for one of the most useful sites on the internet.
I will highly recommend this site!

Visit my page: golf gps reviews golfers