Home Coding, Scripting, Shaders

Maxscript batch rendering question

Hello,

I have a little script that generate batch renders with a serie of HDRI that are located in a directory.

The script gets the first HDRI, does 8 renders by rotating the HDRI every 45 degrees, save the renders and load the next HDRI in the directory.

My problem is that this script works on certain scenes, and doesnt on others, and I cant find why is that, I suspect something about variable declarations but I cant solve this issue, if someone has an idea that would be greatly appreciated!


here is the script :


global dirhdri = getSavepath initialDir:(GetDir #maxroot) caption:"Please locate the HDRI source directory"

global filehdri = getFiles (dirhdri + "\*.hdr")

fn light_filt vraydome = isKindOf obj Light

vraydome = selectbyname title:"Select the VRayDomeLight" buttonText:"Select" filter:light_filt showHidden:true single:true

global renderedhdri = getSavepath initialDir:(GetDir #maxroot) caption:"Please locate the rendered files directory"

for namehdri in filehdri do

(

for i = 1 to 8 do

(

currentangle = (360/8)\*i - (360/8)

environmentMap = VRayBitmap HDRIMapName:namehdri maptype:2 horizontalRotation:currentangle

vraydome.texmap = environmentMap

render outputfile:(renderedhdri + "\\\\"  + getfilenamefile namehdri + " " + currentangle as string + " deg" + ".jpg") vfb:off

)

)

Replies

Sign In or Register to comment.