rendering controls

Hello

I made some "scripts" to help me control my scene before rendering.

for exemple :
-------
$*.wirecolor = black
for bbb in objects where bbb.primaryVisibility == off do bbb.wirecolor = red
-------
so, I can control in viewport if objects will be or not seen by cam.

I would like to do this with VrayAlphacontribution and so on...
but I don't really even understand where to search in Vray docs...

AND I would like to be able to overwrite temporarily object materials with wirecolor, so I could see solid color not just wires.

If anybody find this usefull... :-)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Garp's picture

Hi.

Use getUserPropBuffer bbb to see all the properties.
Then the getUserProp() and setUserprop() methods.

if getUserProp bbb "VRay_Matte_Alpha" == 0 do bbb.wireColor = red

Note that depending on countries, some OS use a comma instead of a point as a decimal separator. In those cases, the corresponding user property is returned as a string with a comma in it (which sucks).
To make sure your code works on all machines, you need something like this:

(
  local matteAlpha = getUserProp bbb "VRay_Matte_Alpha" as string
  local pDec = findString matteAlpha ","
  if pDec != undefined do matteAlpha = replace matteAlpha pDec 1 "."
  if matteAlpha as float == 0 do bbb.wireColor = red
)
titane357's picture

thanks Garp, it works fine !

thanks Garp, it works fine ! :-)
for the comma/point problem I think it is system unit preference (I use french os but I define comma as default.

titane357's picture

Thanks Anubis, looks cool but

Thanks Anubis, looks cool but I don't know how to revert...

le1setreter I tried your soluce but I don't know how to use:
for bbb in objects where bbb.VRay_Matte_Alpha == 0.0000 do bbb.wirecolor = red
I get :
-- Error occurred in bbb loop
-- Frame:
-- bbb: $Box001
-- Unknown property: "VRay_Matte_Alpha" in $Box:Box001 @ [14.514389,31.687920,0.000000]

Anubis's picture

You dont need to revert, if

You dont need to revert, if will render in Max of course, but if intended by other purpose, its easy too:

for obj in objects where obj.mat != null and \
classOf obj.mat == Shell_Material do
obj.mat = obj.mat.originalMaterial

cheers

my recent MAXScripts RSS (archive here)

le1setreter's picture

maybe i can help a bit

maybe i can help a bit regarding the vray object properties:

1) as far as i know you can not "directly" access each vray-object-property by maxscript... but

2) if you have seen/opened and therefor enabled the vray-object-props for example by rightclicking the object and opening the dialog with the properties ... then the vray props are stored as string in the "normal" user-defined properties of your object. you can work you way up from there with various string operations and/or creating temp arrays for better handling of the props.

----

the vray object properties can opened/enabled via maxscript with "doVRayObjectProperties()"

more vray max functions/properties can be found here:
http://www.spot3d.com/vray/help/150SP1/render_maxscript.htm

for working with the object user defined properties have a look at the maxscript helpfile: "Node User-Defined Properties and Methods"

Anubis's picture

Hi Titane

I not use Vray so cant help on this one, but about the 2nd question (overwriting the mats) - did you try Shell material?

for obj in objects where obj.mat != null do
(
	obj.mat = Shell_Material originalMaterial:obj.mat
	obj.mat.bakedMaterial.diffuseColor = obj.wirecolor
	obj.mat.viewportMtlIndex = 1
)

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.