# vray trace sets, maxscript help

**URL:** <https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574>\
**Category:** Public\
**Created:** [July 28, 2014, 1:19pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574 "2014-07-28T13:19:34Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveyjones26](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@daveyjones26](https://forums.chaos.com/u/daveyjones26)\
**Post date:** [July 28, 2014, 1:19pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/1 "2014-07-28T13:19:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexander.kazandzhiev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/alexander.kazandzhiev/32/16287_2.png) [@alexander.kazandzhiev](https://forums.chaos.com/u/alexander.kazandzhiev)\
**Post date:** [July 30, 2014, 1:44pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/2 "2014-07-30T13:44:29Z")

</div>

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](https://forums.chaos.com/uploads/short-url/nIhfrWR1DD1UThQvtiIdJR9T157.zip) (992 Bytes)

---

<div class="post-metadata">

**Author:** ![daveyjones26](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@daveyjones26](https://forums.chaos.com/u/daveyjones26)\
**Post date:** [July 31, 2014, 11:58am UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/3 "2014-07-31T11:58:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexander.kazandzhiev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/alexander.kazandzhiev/32/16287_2.png) [@alexander.kazandzhiev](https://forums.chaos.com/u/alexander.kazandzhiev)\
**Post date:** [August 4, 2014, 8:37am UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/4 "2014-08-04T08:37:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daveyjones26](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@daveyjones26](https://forums.chaos.com/u/daveyjones26)\
**Post date:** [August 4, 2014, 5:47pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/5 "2014-08-04T17:47:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexander.kazandzhiev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/alexander.kazandzhiev/32/16287_2.png) [@alexander.kazandzhiev](https://forums.chaos.com/u/alexander.kazandzhiev)\
**Post date:** [August 5, 2014, 9:10am UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/6 "2014-08-05T09:10:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gregvfx](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@gregvfx](https://forums.chaos.com/u/gregvfx)\
**Post date:** [September 15, 2014, 12:29pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/7 "2014-09-15T12:29:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [September 15, 2014, 12:49pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/8 "2014-09-15T12:49:58Z")

</div>

General documentation about V-Ray and MaxScript is here:

> **[Chaos Docs](https://documentation.chaos.com/)**

For access to the forum, please email [support@chaosgroup.com](mailto:support@chaosgroup.com)

Best regards,  
Vlado

---

<div class="post-metadata">

**Author:** ![gregvfx](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@gregvfx](https://forums.chaos.com/u/gregvfx)\
**Post date:** [September 16, 2014, 2:13am UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/9 "2014-09-16T02:13:32Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![gregvfx](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@gregvfx](https://forums.chaos.com/u/gregvfx)\
**Post date:** [September 16, 2014, 11:02am UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/10 "2014-09-16T11:02:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alexander.kazandzhiev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/alexander.kazandzhiev/32/16287_2.png) [@alexander.kazandzhiev](https://forums.chaos.com/u/alexander.kazandzhiev)\
**Post date:** [September 17, 2014, 2:24pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/11 "2014-09-17T14:24:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gregvfx](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@gregvfx](https://forums.chaos.com/u/gregvfx)\
**Post date:** [September 19, 2014, 3:51am UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/12 "2014-09-19T03:51:20Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [September 19, 2014, 7:45am UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/13 "2014-09-19T07:45:06Z")

</div>

> [@mparticles](https://forums.chaos.com/t/mparticles/45814/8):
>
> I am thinking in the bus on the way to the office, can the trace list override the visible to reflection/refraction?

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

Best regards,  
Vlado

---

<div class="post-metadata">

**Author:** ![gregvfx](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@gregvfx](https://forums.chaos.com/u/gregvfx)\
**Post date:** [September 19, 2014, 11:40am UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/14 "2014-09-19T11:40:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [September 19, 2014, 1:33pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/15 "2014-09-19T13:33:50Z")

</div>

> [@The Future of NAIAD](https://forums.chaos.com/t/the-future-of-naiad/45821/28):
>
> 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…

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

---

<div class="post-metadata">

**Author:** ![gregvfx](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@gregvfx](https://forums.chaos.com/u/gregvfx)\
**Post date:** [September 19, 2014, 5:48pm UTC](https://forums.chaos.com/t/vray-trace-sets-maxscript-help/50574/16 "2014-09-19T17:48:02Z")

</div>

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.
