[Closed] Selection Sets and Render Elements
Hey guys,
I’m being a bit lazy so I thought I’d ask you clever peeps if there was a way to do the following:
I have a number of Selection Sets which I would like to create ‘Matte’ Render Elements from. Currently I’m doing it manually by creating the ‘Matte’ Render Element and then choosing a Selection Set from the list to include in the Render Element.
If there was a way to automate creation of a ‘Matte’ Render Elements directly from the list of Selection Sets on a 1 to 1 mapping basis (if you know what I mean) this would greatly speed up my workflow.
Any thoughts or ideas mucho appreciated!!!
Thanks again.
This will work by setting the gbuffer channel IDs, not using the include list in the matte element as I couldn’t see how to access it.
(
re = maxOps.GetCurRenderElementMgr()
for i = 1 to selectionsets.count do
(
for o in selectionsets[i] do o.gbufferchannel = i
re.addrenderelement (MatteRenderElement())
theelement = re.getrenderelement (re.numrenderelements() - 1)
theelement.elementname = ("Matte_" + i as string)
theelement.gbufIDOn = true
theelement.gbufID = i
)
)
Hi Dave,
Sorry for the stoopid question but how do I use this? I’ve assigned a unique G-Buffer ID to each selection ‘set’ and then run this script with everything seleted but nothing seems to happen…
Many thanks for the help by the way!
(
re = maxOps.GetCurRenderElementMgr()
for i = 1 to selectionsets.count do
(
re.addrenderelement (MatteRenderElement elementname:("Matte_" + i as string) gbufIDOn:true gbufID:i)
selectionsets[i].gbufferchannel = i
)
)
You don’t need to set the Gbuffer IDs the script does that for you. Goto the Maxscript menu ->New Script, paste all this code in the window and press Ctrl+E to run the script. Worked here.
If it doesn’t work then open your maxscript listener (F11) and paste the output here.
You, Sir, are a LEGEND!!!
Thank you soooo much for your help.
This works PERFECTLY!!!
Thank you again! :buttrock:
http://davewortley.wordpress.com/2012/06/22/making-render-element-masks/
I put a breakdown of how to write this script on my blog.
I took the optimization 1 step further on my blog, but didn’t know you could set a property for all items in a selectionset like that. Cheers for the tip.
#1 if you create an element first and add it after you don’t need to care about update of the list.
#2 you can set any common property of a class using the list (array, collection) of same class nodes…
for example:
objects.material = undefined
(getclassinstances dummy).boxsize = [1,1,1]
...
#0 i know only one other than close/open render settings dialog way to update the list of render elements. it’s collect them all, remove all, and add them back.
It almost drove me mad trying to work out why my script wasn’t working once apon a time and then I realised it was fine and it was just the interface not updating! I normally just close it and re-open it.
There’s some really wierd things that go on with the renderelement mgr that you don’t have access to, each element has its filepath but also an internal image format that you can’t read/change For example…
Set your render output to something.tga and then add a render element, the render element will be a tga file output and will save a tga file. If you then change your main render output to something.tif the render element path will show it as a tga file on the path but will save out the file as a tga file with a tif extension and depending on your image viewer/compositing program will not necessarily open the file until it is renamed with a tif extension. The only solution is to store the properties of the render element and then delete it and add it back in. The next verison of deadline will have an option built in I wrote and sent to them to avoid problems when changing rendering formats.
Would be nice if there was a way to set this so you could output a 32bit float rgb image and only 8bit CC masks as TGAs. Sadly this part of max is a bit dodgey it would seem.