Notifications
Clear all

[Closed] reading/setting image output format settings on render elements

Good afternoon.

basically i would like to control not just the location and name of the file output (specially the render elements), but the setting as well (such as PNG colour depth, alpha or no alpha etc etc)

i have run across http://forums.cgsociety.org/showthread.php?f=98&t=533442 while searching, which gives working workaround setting the main [render output] in [common] tab. which was by setting the rendOutputFilename = “”, then setting up the bitmap IO, then resetting the rendOutputFilename

example :

rendOutputFilename = ""
   jpegio.setquality 10
   rendOutputFilename = "c:\	est.jpg"

however, i tried applying same principle to the render elements, however, the settings somehow seems to be sticky (as in i can’t seem to change the setting i have set previously).

basically, anyone know a good way of setting the file formats on render elements?
also how to read the settings if set preivously? for example, if i have set [no filtering] on z-depth, it would be great if my script can pick that up and apply it on the new path. etc etc.

thank you very much in advance for any contribution or suggestions : )

– added (findings so far)
i have been experimenting with the whole issue, ability to control image format settings on render elements. and so far, had no luck.

findings are…

  1. it seems somewhere and somehow, max remembers the settings and they become sticky. even following the previous workaround of setting the filePath = “” then setting bitmapIO settings, then resettign the filepath, it will get the settings from the previous setup. basically unless done through the dialogue manually, the settings are sticky.
  2. worst case scenario, the settings becomes corrupt (for example, PNG type becomes nothing, making saved PNG corrupted)

only workaround so far i can come up with is…
to delete the render element, set the bitmapIO, recreate the render element, far far from ideal, but i could get it to work.

if anyone knows where MAX stores these render elements file format settings, would greatly apprecaite if you can share your experience : )

9 Replies
 lo1

If I rememeber correctly, the trick is to set ALL the render outputs to “” (both standard output and render elements), then set up your bitmap IO, then assign the paths.

thank you!

will try it right now and see if it still works : )

thank you so much lo!
it worked!

i guess i assumed that common/renderOutput and RenderElements were two seperate things.
but it seems that the common/renderOutput somehow locks the bitmapIOs.

thank you for the great tip! always appreciat the help : )

 lo1

No problem. It seems to me that when any render output is used, the bitmapIO module is locked and can’t be changed.

Hi lo, think i spoke too soon out of joy of seeing some change happening… however…

it seems to be acting slightly erratic. even though i am doing exactly

renderElements = maxOps.GetCurRenderElementMgr()

rendOutputFilename = ""
renderElements.SetRenderElementFilename 0 ""
renderElements.SetRenderElementFilename 1 ""

pngio.setType #gray8

rendOutputFilename = "c:\	est.png"
renderElements.SetRenderElementFilename 0 "c:\	estxxXXXXXX.png"
renderElements.SetRenderElementFilename 1 "c:\	estyyyyyyyyy.png"

renderOutput seems to be changing to the new setting
however, the first render element seems to be sticky
worse, second render element is just doing some erratic thing (it ended up in the gray16 setting)

will keep digging, but think safest and most robust way is to just delete render element one by one and recrete it…

also, would you know how to control the gamma on those renderOutputs? say if i want to save Zdepth out at gamma1.0 (where as my scene gamma is at 2.2), i have tried similar method of…

  1. wiping all the renderoutput + render elements by using “”
  2. fileOutGamma = 1.0

then re creating those outputs. but the gamma still seems to be sticky…
really feels like there are some kind of secrete array with all this settings stored (well must be, as they seem to remember the previous setting) just not sure if it is exposed to maxScript.

thank you for yoru help so far lo!

 lo1

You’re right, I’ve tried it myself, and the results are extremely flaky, though most times, running the script twice seemed to work (?!)
I guess the safest solution is to recreate the elements.

About the gamma, afaik the fileOutGamma is a system global and is evaluated at the bitmap creation time (render) and not the element creation time, so I’m not sure there is anything you can do about that.

hey lo! thank you for your effort!

i have been playing around with this, trying to find way around… only robust way seems to be to delete old render element and recreating it. which only gets me half way…

feels like this is the first problem i have encountered (and as like every other maxScripter, i have encountered too many) that i just can’t seem to get a happy workaround!

and so annoying cause render element is one of those repetitive task that requires accurate settings to get right ><

oh well, will keep looking!

i do wonder if SDK have better control over this kind of issue?

again thank you so much lo!

Hey lo, and anybody who is reading this thread.

think i finally got a working solution, that seems to be robust and do what i expect it to do.
its extremely disapointing conclusion and not really an elegant workaround.
but will post it up anyway incase anybody desperately need some kind of workaround.

and please! if anybody has more elegant solution, please do let us know : )

the conclusion is… renderSceneDialog.close() (as in render setup dialog) plays a big role.
i ran across this before as well, when renderSceneDialog was open, and i tinker with the render settings using maxScript, some changes won’t stick when renderSceneDialog was reopened. so i got into a habbit of renderSceneDialog.close() before i change any setting in render settings through maxscript.

what i have learnt is that renderSceneDialog also seems to control the bitmap I/Os. for example, if i change the png I/O output setting, unless i renderSceneDialog.open(), and then! renderSceneDialog.close() the png I/O changes won’t be sticky…

long story short, after lot of frustration, only way i could get to have full control over render element file format is…

fn fnRErecreate = (
  	renderSceneDialog.close()
  	local REmanager = maxOps.GetCurRenderElementMgr()
  -- 	local noOfElements = REmanager.NumRenderElements()
  	
  	rendOutputFilename = ""
  	
  	pngio.setType #paletted
  	pngio.setAlpha true
  	
  	rendOutputFilename = "c:\	estxxXXXXXX.png"
  	
  	renderSceneDialog.open()
  	renderSceneDialog.close()
  
  	xx = vrayalpha()
  	REmanager.AddRenderElement xx
  	REmanager.SetRenderElementFilename 0 "c:\	estxxXXXXXX.png"
  	
  		
  	rendOutputFilename = ""
  	pngio.setType #true24
  	pngio.setAlpha true
  		
  	rendOutputFilename = "c:\	estxxXXXXXX.png"
  	
  	renderSceneDialog.open()
  	renderSceneDialog.close()
  	
  	yy = vrayalpha()
  	REmanager.AddRenderElement yy
  	REmanager.SetRenderElementFilename 1 "c:\	estyyyyyyyyy.png"
  	renderSceneDialog.open()
  )
  fnRErecreate()

basically, i had to open and close render setup dialogue everytime i wanted to change the fileformat settings.

further more, the render elements need to be recreated, from what i can tell, once its “created” there seems to be no way of manipulating the fileformat settings from initial settings (or manual override).
i even tried changing the format to JPG then back to PNG, somehow it remembers its old PNG settings…

so basically, only robust solution is… that i read all the existing render Elements, then recreate them. worst of all, i have to literally open and close renderDialogue every time i want to change the format.
which, actually takes about a second to do… as said, not an elegant solution at all…

bottom line, i think there is somekind of command that is sent from render dialogue that sets the bitmap I/O. as when manually setting up the render elements, those elements remember the bitmap I/O settings. which is built into manually setting render elemtns up on the background. however, when i try to directly manipulate them using maxscript, only way i know how currently to permanently set bitmap I/O setting is to open and close render Dailogue…

its obviously very annoying, and really would apprecaite any guru’s input or opinion on this matter.

again, thank you lo for your input, and would appreciate any other suggestions or comments !

Thanks to this I just helped solve my problem:
Render Elements – how to save pass?
It’s a pity that you did not see this topic, I think you would have helped me