Community
Arnold for Maya Forum
Rendering with Arnold in Maya using the MtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Texture Randomly via element

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
r.blumenstein
1017 Views, 4 Replies

Texture Randomly via element

I am looking to color elements without having to renumber them individually. I have tried different approaches to no success. The place that has gotten me the closest is https://answers.arnoldrenderer.com/questions/4677/drive-aiswitch-index-via-objectid.html, but I still cannot find a way to break things down into elements. I know that there is multitexture and mutliid but that is too slow on a tree and uses too much memory. Any suggestions would be greatly appreciated.

Labels (3)
4 REPLIES 4
Message 2 of 5
madsd
in reply to: r.blumenstein

I made a video some time ago, going over it.
You can check it out here:
https://www.youtube.com/watch?v=dP2MAYwA3JY

Made a couple of Material ID's make a color data channel with DCM, catch it with the shader, and use it to drive pr element random generator.

If you have some issues setting it up, let me know, and I will produce a small generic scene with some Forest pack type grass patch we will add element ID to and control random diffuse textures on each straw, as an example.

Message 3 of 5
madsd
in reply to: r.blumenstein

https://i.imgur.com/vwGXe2J.jpg

https://i.imgur.com/t6Do4vd.jpg

https://i.imgur.com/bBDyupV.jpg


2020 file.

https://we.tl/t-X9q8HWXhz6

Just swap out the bitmap and have a play.

You can add in additional tools that provoke certain tendencies in the scattering effect, Bias a particular map % over others, filter things in and out. All kinds of things.

The Control map can be extended to control all practical settings one would typically sit and play with, across whole network, its practical and speeds production up significantly pulling settings to a UI.

Message 4 of 5
r.blumenstein
in reply to: madsd

Thanks @Mads Drøschler

I am sorry that I took so long to respond, The first answer is good but only if you have 3 or less variations. Anything more than that and it will go out of the range of the variation images. The second solution that you gave is really great, but it seams to break more easily. I copied the solution to the library and put it on another object and it breaks. I guess I don't use OSL that much. Do you have any good resources for OSL? Also I really appreciate your responses, do you have a place to buy you coffee?

https://www.dropbox.com/s/nhgh0vq7k5njq5b/color%20test.max?dl=0

Message 5 of 5
madsd
in reply to: r.blumenstein

Try look here.

I created a small custom OSL shader node. The "Steps" value is what you want to increase to expand the range of items that gets picked up by the random generator.

Think of Obj_gain_max as an integer slot instead of float. just handle nice simple entries like 0,1,2,3 and so forth. You need to manual that part out so it matches with the number of entries you want to pick up.

So if you want 5 bitmaps in the mix, change this "Steps" value to 5.

4454-ss.jpg

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report