PDA

View Full Version : Render()


DaveWortley
04-10-2008, 04:02 PM
I'm writing a script that gets the current VRay settings, stores them, then applies some low-res-draft values and renders a 500px render, then restores the settings to the original render settings.

Now i've managed to get this working, but had to use 3 buttons to do it.

"Store" , "Render", "Restore"

All this works, but if I try to make it all on one button, the values don't get restored. Possibly because the restore function is being called whilst the Render is still rendering.

render outputwidth: Rw outputheight: Rh vfb: true progressbar: true


I've set it to use the vfb, it renders to a window, but next render a new vfb opens up, and during render I get no progress bar, I've tried enabling this, and the status bar becomes the progress bar, why can't i use the normal vfb and progress bar?

Bobo
04-10-2008, 05:44 PM
Sometimes it is tricky to answer WHY something you expect does not work as you would expect it, as it requires more in-depth knowledge of what is going on inside (or what was going on in the heads of the developers when they did what they did) ;)

The render() method calls the renderer internally, and potentially silently (which is good). Each call will open a vfb if the vfb:false is not specified, but you CAN render into an existing bitmap if you want all renders to go there using the to: keyword. Basically you create a bitmap value with the desired size, display it and then call render to:thatBitmap to get your output into the existing VFB.

Alternatively, you CAN "press the render button" using 'max quick render' and this will behave as if you just clicked the teapot icon (or the render button in the Render Scene Dialog), including the correct progress dialog etc.

KEEP IN MIND that attempting to SET values of the Render Scene Dialog while it is open DOES NOT WORK! (It is documented and has something to do with Max 1.0 having a Cancel button in a non-modal render scene dialog - all settings are commited when the dialog is closed but not cancelled or when the render button is pressed, but not when they are changed). See the methods in the renderSceneDialog struct.

So if you are changing settings in the Render Scene Dialog, make sure you close it first, then make the changes, and then, if you want, reopen it again. (Max 2009 added methods to do this faster for Mental Ray only without constantly flasing the dialog ).

That being said, you could use Max Render Presets to store your current settings, then close the dialog, change the settings, call the renderer and then reload the saved Render Preset to restore the original state.

Teriander
04-10-2008, 05:52 PM
Continuing what Bobo said:

I've personally just used -
renderSceneDialog.close()

--enter my code

renderSceneDialog.open()

This is a quick way to have your code change the Render Scene Dialog without running into the Not working while open issue.

DaveWortley
04-10-2008, 06:26 PM
Thanks for that explanation Bobo, and your excellent boboland website ;)

I was aware of the issue having the Render Dialog open at the same time.

I appear to have bigger problems, seeing as the script i've written works fine on my machine at the moment but tried it on 2 others and it hasn't worked, the variables are not being stored propperly. So will try to get it working before i impleament using quick render, but that should work fine.

I wanted to avoid using presets as there's a bug in max 9 where using a renderpreset will corrupt any file that has the Biped system in it, and want this script to be as quick as possible, so when rendering a 12,000px high-res image, you can do a quick 500px render with low settings that'll render in a few seconds.

CGTalk Moderation
04-10-2008, 06:26 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.