# Auto LightSelect script?

**URL:** <https://forums.chaos.com/t/auto-lightselect-script/88239>\
**Category:** General\
**Created:** [April 19, 2018, 12:32pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239 "2018-04-19T12:32:15Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ihno](https://avatars.discourse-cdn.com/v4/letter/i/c0e974/32.png) [@Ihno](https://forums.chaos.com/u/Ihno)\
**Post date:** [April 19, 2018, 12:32pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/1 "2018-04-19T12:32:15Z")

</div>

Hey guys,  
does anyone know a skript like this:  
[http://www.scriptspot.com/3ds-max/sc…raylightselect](http://www.scriptspot.com/3ds-max/scripts/auto-render-element-vraylightselect)  
But working with the full LightSelect an its modes?  
Also it would be cool if it could use the light names for the naming of the elements.

I’m loosing alot of time these days setting up the LightSelects.

Would be a nice button for the vray toolbar too… wouldn’t it? 🙄

---

<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:** [April 20, 2018, 9:57am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/2 "2018-04-20T09:57:09Z")

</div>

Can you not rework that script to support the full mode?

Best regards,  
Vlado

---

<div class="post-metadata">

**Author:** ![Ihno](https://avatars.discourse-cdn.com/v4/letter/i/c0e974/32.png) [@Ihno](https://forums.chaos.com/u/Ihno)\
**Post date:** [April 20, 2018, 10:05am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/3 "2018-04-20T10:05:54Z")

</div>

Unfortunatly no.  
I didn’t found the time to lern maxScript yet.  
I’m planning to do so though.  
I guess it would be a nice first project…

---

<div class="post-metadata">

**Author:** ![Vizioen](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/vizioen/32/59355_2.png) [@Vizioen](https://forums.chaos.com/u/Vizioen)\
**Post date:** [April 20, 2018, 10:31am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/4 "2018-04-20T10:31:40Z")

</div>

Just ask the guy for an update.

---

<div class="post-metadata">

**Author:** ![Ihno](https://avatars.discourse-cdn.com/v4/letter/i/c0e974/32.png) [@Ihno](https://forums.chaos.com/u/Ihno)\
**Post date:** [April 20, 2018, 12:46pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/5 "2018-04-20T12:46:26Z")

</div>

I’ll try, but I have not great hope for it since his last activity was 2014.

---

<div class="post-metadata">

**Author:** ![danio](https://avatars.discourse-cdn.com/v4/letter/d/cab0a1/32.png) [@danio](https://forums.chaos.com/u/danio)\
**Post date:** [April 22, 2018, 4:41am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/6 "2018-04-22T04:41:02Z")

</div>

is vraylightselect automatic setup part of the vray next roadmap? Seems like it would be a highly appreciated feature!

---

<div class="post-metadata">

**Author:** ![Art48](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Art48](https://forums.chaos.com/u/Art48)\
**Post date:** [April 24, 2018, 9:02am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/7 "2018-04-24T09:02:22Z")

</div>

> [@Ihno](#):
>
> I’ll try, but I have not great hope for it since his last activity was 2014.

I asked him for an update some months ago regarding some stuff I wanted changed. He replied quite quickly (days) and even did the stuff himself. It was small stuff tho, just changing some defaults. Anyways - your chances of establishing contact are quite good.

---

<div class="post-metadata">

**Author:** ![Ihno](https://avatars.discourse-cdn.com/v4/letter/i/c0e974/32.png) [@Ihno](https://forums.chaos.com/u/Ihno)\
**Post date:** [June 1, 2018, 8:05am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/8 "2018-06-01T08:05:51Z")

</div>

**EDIT: Latest version: [https://forums.chaosgroup.com/forum/…41#post1012441](https://forums.chaosgroup.com/forum/v-ray-for-3ds-max-forums/v-ray-for-3ds-max-general/992329-auto-lightselect-script?p=1012441#post1012441)**  
Hey guys.  
A student who does an internship semester at our company had nothing to do. So I told him to learn MaxScript and write the auto light select script since ecXimer didn’t answer.  
EcXimer’s script is encrypted, so he had to start from scratch.  
Here is what he came up with so far:  
[LightSelectElementScript v1.3.zip](https://forums.chaosgroup.com/core/filedata/fetch?id=998276&d=1527840187)

It’s tested in max 2019 with Vray 3.6.04  
He’s got one day left to work on this. So I’d be grateful if you guys could test it and quickly respond if you find any bugs.  
He’ll try to add grouping by selection set later today.  
[LightSelectElementScript v1.3.zip](https://forums.chaos.com/uploads/short-url/6Ajdp2kUE4iwxbriRN9AdhnGTyq.zip) (2.4 KB)

---

<div class="post-metadata">

**Author:** ![M.Max](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/m.max/32/26870_2.png) [@M.Max](https://forums.chaos.com/u/M.Max)\
**Post date:** [June 2, 2018, 1:54am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/9 "2018-06-02T01:54:14Z")

</div>

I’ve tried it in Max 2016 and V-ray 3.6.04 and everything worked fine .  
I like the additional options you added (add instance as one and duplication )  
I think the UI could use more polishing tho .  
Anyway thanks for sharing !

---

<div class="post-metadata">

**Author:** ![JezUK](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/jezuk/32/62402_2.png) [@JezUK](https://forums.chaos.com/u/JezUK)\
**Post date:** [June 2, 2018, 9:58am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/10 "2018-06-02T09:58:33Z")

</div>

> [@Ihno](#):
>
> Hey guys.  
> A student who does an internship semester at our company had nothing to do. So I told him to learn MaxScript and write the auto light select script since ecXimer didn’t answer.  
> EcXimer’s script is encrypted, so he had to start from scratch.  
> Here is what he came up with so far:  
> [LightSelectElementScript v1.3.zip](https://forums.chaosgroup.com/core/filedata/fetch?id=998276&d=1527840187)
> 
> It’s tested in max 2019 with Vray 3.6.04  
> He’s got one day left to work on this. So I’d be grateful if you guys could test it and quickly respond if you find any bugs.  
> He’ll try to add grouping by selection set later today.

Kudos to your student - to have learned Maxscript from scratch and written this is commendable.

I’ve tried in 2019 and it seems to work fine for me.

Thanks for sharing - it’ll save me time and encourage me to set up LightSelect Elements more often 🙂

---

<div class="post-metadata">

**Author:** ![Ihno](https://avatars.discourse-cdn.com/v4/letter/i/c0e974/32.png) [@Ihno](https://forums.chaos.com/u/Ihno)\
**Post date:** [June 6, 2018, 2:38pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/11 "2018-06-06T14:38:20Z")

</div>

**EDIT: Latest version: [Auto LightSelect script? - General - Chaos Forum](https://forums.chaosgroup.com/forum/v-ray-for-3ds-max-forums/v-ray-for-3ds-max-general/992329-auto-lightselect-script?p=1012441#post1012441)**  
Update:  
[LightSelectElementScript v1.32.zip](https://forums.chaosgroup.com/core/filedata/fetch?id=998905&d=1528295615)

Changed:  
-LightSelection by selection sets.  
-Improved UI.  
-There was a bug when using sun or ies lights and “only activated lights” was checked because its called “enabled” instead of “on” in those lights.

To come:  
-Grouping by selection sets.  
-Two options for Sorting. “alphabetical” and “by mode”.  
-UI changes: Mostly more radiobuttons instead of checkboxes to limit the possible combinations and prevent pointless settings.  
I.e deleting all elements and deleting all LightSelect elements.

Don’t know when he’ll find the time to work on this again.  
This weekend maybe.

Test the hell out of it as long he can do stuff!  
[LightSelectElementScript v1.32.zip](https://forums.chaos.com/uploads/short-url/4G4aVr9zujSD3GTsWdbzpaJhk5r.zip) (3.22 KB)

---

<div class="post-metadata">

**Author:** ![fraggle](https://avatars.discourse-cdn.com/v4/letter/f/34f0e0/32.png) [@fraggle](https://forums.chaos.com/u/fraggle)\
**Post date:** [June 10, 2018, 7:00am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/12 "2018-06-10T07:00:01Z")

</div>

+1 to get it part of Vray UI instead of using script with auto naming from light name.  
Thanks to share the script anyway, that’s very helpfull.

---

<div class="post-metadata">

**Author:** ![MANUEL\_MOUSIOL](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/manuel_mousiol/32/2905_2.png) [@MANUEL\_MOUSIOL](https://forums.chaos.com/u/MANUEL_MOUSIOL)\
**Post date:** [July 7, 2018, 10:00pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/13 "2018-07-07T22:00:27Z")

</div>

Terrific! Just used it today. Saved Me a lot of time.  
Thanks for sharing!

---

<div class="post-metadata">

**Author:** ![danio](https://avatars.discourse-cdn.com/v4/letter/d/cab0a1/32.png) [@danio](https://forums.chaos.com/u/danio)\
**Post date:** [July 8, 2018, 4:18am UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/14 "2018-07-08T04:18:14Z")

</div>

> [@danio](#):
>
> is vraylightselect automatic setup part of the vray next roadmap? Seems like it would be a highly appreciated feature!

+1 to my old post 🙂

---

<div class="post-metadata">

**Author:** ![Brendan\_Coyle](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@Brendan\_Coyle](https://forums.chaos.com/u/Brendan_Coyle)\
**Post date:** [September 19, 2018, 3:09pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/15 "2018-09-19T15:09:40Z")

</div>

Thanks for sharing this - first thing I did was use the ‘add instance as one’ - such a clever option to have. It worked so quickly/cleanly that I almost didn’t think it worked at all. The pre-script action ‘Clear all LightSelects’ also seems like a smart inclusion. I’ll use that as I get further in my scene and things start to change.

I went into the script and changed a few of my favorite checkboxes to ‘true’ so I wouldn’t need to manually tick them every time I opened the script. Awesome!

---

<div class="post-metadata">

**Author:** ![Ihno](https://avatars.discourse-cdn.com/v4/letter/i/c0e974/32.png) [@Ihno](https://forums.chaos.com/u/Ihno)\
**Post date:** [September 26, 2018, 3:22pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/16 "2018-09-26T15:22:35Z")

</div>

I managed to do an update on my own.  
I took the last version my Student made before he left and added the LS modes of Vray Next.

[RenderElementScript v1.361.zip](https://forums.chaosgroup.com/core/filedata/fetch?id=1012442&d=1537975120)

The last version he made had some additions to the last one I posted here:

**Light Selection:**  
**-In any selection set** : adds only lights which are in selection sets.  
If a light is in two selection sets it gets added just once.

**-All Selection Sets:** adds only lights which are in a selection sets.  
It will add lights which are in more than one selection sets as often as they appear in a different set. (I think this was necessary for the following)

**Grouping:**  
-by selection set: Is only active when ‘All Selection Sets’ is checked.  
It will group the lights using the selection sets they’re in. The LS will then have the name of the selection set.  
If you put a light in two selection sets it’ll appear in both LS!

**Sorting:**  
**-Sort elements by name:** Self describing.

**Known issues:**  
-‘Only activated lights’ will result in an error if ‘all selection sets’ and group ‘by selection set’ are both checked.

I didnt really needed any scripting skills to add the Vray Next modes.  
Fixing the issue and making a more user friendly ‘group by selection set’ option is a completely different thing.  
It might take a while till I’m able to address those since I have to first find the time to learn MAXScript.😉

I think the script will still work with 3.6 (except the modes from Next). But I can’t test it right now.  
[RenderElementScript v1.361.zip](https://forums.chaos.com/uploads/short-url/pgb54HPTFvbyK3zjjzZQv5GwzO1.zip) (5.39 KB)

---

<div class="post-metadata">

**Author:** ![JezUK](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/jezuk/32/62402_2.png) [@JezUK](https://forums.chaos.com/u/JezUK)\
**Post date:** [October 13, 2018, 2:04pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/17 "2018-10-13T14:04:22Z")

</div>

I love this script but what code would need to be added for a checkbox for to auto set all the Denoisers on/off for each light before the LightSelect render elements are created ?

PS - I’d have thought by default Denoiser for LightSelect should always be selected as on ?

---

<div class="post-metadata">

**Author:** ![Ihno](https://avatars.discourse-cdn.com/v4/letter/i/c0e974/32.png) [@Ihno](https://forums.chaos.com/u/Ihno)\
**Post date:** [October 13, 2018, 2:15pm UTC](https://forums.chaos.com/t/auto-lightselect-script/88239/18 "2018-10-13T14:15:33Z")

</div>

Um that might be very easy… I’ll take a look tomorrow.
