Emmit random light color from mesh light

Emmit random light color from mesh light

pproestos
Collaborator Collaborator
926 Views
3 Replies
Message 1 of 4

Emmit random light color from mesh light

pproestos
Collaborator
Collaborator

I dont want to use the emission map.

I have three boxes attached all to gether to one single mesh.

I assign this to a mesh light.

I assign to the texture of the mesh light an OSL color switcher.

This method works to assign different color materials to a group

of objects.

How can I do a similar thing using mesh lighting?

I hope I explained it well..

thx.

image1.jpg

0 Likes
Accepted solutions (1)
927 Views
3 Replies
Replies (3)
Message 2 of 4

madsd
Advisor
Advisor
Accepted solution

Max 2020 file attached.

The 3 boxes are collapsed into 1 mesh, and each "element" is called ID:1 ID:2 ID:3
I droped down to Element in the mesh and clicked each one and gave them the numbers 1,2,3 in Material ID.
Source this ID with a Material ID node to 1 to 5 maps Index and set the colors R,G and B.
The boxes now sends out meshlight according the the array 3 first colors.

If you want them to flicker around between random colors, we setup a DCM modifier that injects a random float value, we can shuffle with the Arnold Jitter node, or by animating the DCM shuffle parameter.

4067-qweqwe.pngrgbboxlights.zip

0 Likes
Message 3 of 4

pproestos
Collaborator
Collaborator

You're a life savior @Mads God bless you prof...

I have totally ignored since now the existance of ID's.. 🙂

Again a BIG thanks 🙂

I will try also the dcm modifier...

And as I understand to have these objects also self illuminated, I have to assign

same osl node as emission color because light shape visible is always grayed out...

0 Likes
Message 4 of 4

madsd
Advisor
Advisor

That may be the case yes. but as you mention, you can use the same shader chain to pipe the the surface.
If you get stuck with the generation of Element ID for an animated shuffle let us know.

0 Likes