vray trace sets, maxscript help

hi,
im trying to get the “vrayAddTraceSets <node>” command to work with maxscript. Im not very good at maxscripting.
If some one knows how to script these below that will be a great help.

maxscript im after is:
-1, select object (call it target object) and exclude all other objects in scene to reflect and refract in the target object.

-2, select objects in scene you want to reflect and refract in the "target object ", select the target object last. So script will know what the target object is,and to remove the other objects from the exclude trace reflection and refraction list.

Thank you

Hi daveyjones26,

Here is a script that might help, there are two functions vrayTraceSetsAdd() and vrayTraceSetsRemove() that operate on the current selection of objects, so they could be assigned to custom button or menuitem. In all cases the last object is considered target, so You should have at least one object selected. If only one object is selected the functions add/remove all other objects in the scene from the trace sets exclude lists.

Hope that helps.
Best regards,
Alexander
tsExclude.zip (992 Bytes)

Many thanks Alexander,
Just having trouble using this script (im not to good at scripting).
When i run this script it flags a error in max lister? how can i get the to work? buy cutting out the vrayTraceSetsAdd() and vrayTraceSetsRemove() and creating two scripts to lunch?

Would be possible the same idea to make this work with vray lights for exclusion?
Thanks

Hi,
Can you paste the output from the listener? It works fine here with V-Ray 3.0 and 3dsmax 9 and 2014.

Yes I think we can make another set of functions to work with the lights exclude lists.

Best regards,
Alexander

hi Alexander,
when just selecting target object on its own, this is what max listener outputs:

vrayTraceSetsAddNodes()
vrayTraceSetsRemoveNodes()
vrayTraceSetsAdd()
vrayTraceSetsRemove()
The reflection/refraction exclude list is empty?

Also if i select a bunch of objects and select target object last, the reflection/refraction exclude list is empty again?
this is what max listener outputs
vrayTraceSetsAddNodes()
vrayTraceSetsRemoveNodes()
vrayTraceSetsAdd()
vrayTraceSetsRemove()

Using 3ds max 2014 vray 3.00.07

Hi,
As far as I can guess that is the result from evaluating the script. You have to evaluate it only once, or you can put it in the 3ds Max startup scripts folder (i.e. C:\Program Files\Autodesk\3ds Max 2014\scripts\Startup). Then you have to call the function to do the job, when you have the objects selected just type vrayTraceSetsAdd() in the MaxScript Listener and press the enter key on the numpad. There should be result returned “OK” if successfull or “undefined” if no objects are found.

Best regards,
Alexander

Hi, I am new to Vray and to this forum and I am trying to access the exclude from reflection list, aka trace list in maxscript. I can’t download the link in this post probably coz I never posted. Is there a documentation on Vray and maxscript?

General documentation about V-Ray and MaxScript is here:

For access to the forum, please email support@chaosgroup.com

Best regards,
Vlado

Thank you, I didn’t spot the trace set at first glance…
How do you show the interface of .reflect_exclude, it does not show with showproperties $…
Also, how do you turn exclude list into include list?
I want to do a simple script to edit two lists and connect them on include and exclude, a bit like what my friends did with Guerrilla… Very useful for shading Eyes with white cards…

Ok you can do like that
ExcludeList = vrayGetTraceSets $
show ExcludeList

it returns
.reflect_exclude : node array
.refract_exclude : node array
false

why false???
is it the exclude/Include switch??

How to change it??

Thank you.

Hi, the trace sets are not exposed to MaxScript with the ability to be used as include type lists, which we will have to fix. Currently it is possible to change the type of the list only through the UI dialog.

Best regards,
Alexander

Ok thanks.

It is already usefull like that. I am thinking in the bus on the way to the office, can the trace list override the visible to reflection/refraction?
It would be very usefull for importing eyes rigged for render in a fresh scene… Prep them to reflect white card that aren’t visible to anything but the eyes.

Also I have an issue with my script trying to assign the object in it’s own trace list. Maxscript is giving me a warning of possible circular dependency. But you can actually do that in vray properties.

Thanks for the great render!

Hm, not at the moment. It can be done for sure - is this the preferred use case?

Best regards,
Vlado

Yes, definitely. In fact for the eyes I could come with a script that creates the white cards and exclude them from everything but the eyes BUT I am sure there is a use for the override in many different scenarios…
I will look into doing shaders later (I just got back to Maxscripting), but an eye shader with virtual cards that we could wire in size/color/intensity to some variable in the scene would be an interesting thing to do…

Thanks

That’s an interesting idea. You could create an environment texture map that simulates reflection cards based on objects in the scene, and then use it as environment override in the VRayMtl material.

Best regards,
Vlado

Thank you,

That’s an old trick, I started on 3ds 3 (dos times…) so I am quite familiar with environment map…
I am looking for some shader that could track a position and distance and draw a real shape in place of the specular. Maybe there is something I don’t know, but a spherical map has some limitations on orientation… That’s why I am using cards.