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: 

Assign random shaders to objects

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
pproestos
2762 Views, 15 Replies

Assign random shaders to objects

With mental ray I used the randomizer script. With this script I create a multi-subobject shader and assing different maps on it. Then I choose an amount of different objects, I assign to them the subobject shader and I have many materials assigned to many different objects automatically.

Now with Arnold, does not work anymore.

Anyone has an idea how to assign in once different materials to different object??

thx....

15 REPLIES 15
Message 2 of 16
Anonymous
in reply to: pproestos

Hi
You can use one shader for multi object, with color aiColorJitter,or one shader with multi texture for multi object, with aiUserDataString

Message 3 of 16
pproestos
in reply to: pproestos

Rachid thanks for your answer. After 27 years using 3d Studio (from DOS and on) Arnold is THE renderer I always dreamed about. I know your answer is correct but it's me that I don't know how to do this... I will search it and be back... thx 🙂

Message 4 of 16
Anonymous
in reply to: pproestos

Hi Petros
You have to touch other soft, that way you'll understand better how to do it in 3dmax, in general it's the same, just follow the principle and apply it to your preferred software!
Here is the link for Color Jitter:

https://support.solidangle.com/display/A5AFMUG/Color+Jitter

And this one for aiUserDataString

https://support.solidangle.com/display/AFMUG/Ai+User+Data+String

Message 5 of 16
lee_griggs
in reply to: pproestos

MAXtoA links:

Color Jitter

User Data Shaders

Lee Griggs
Arnold rendering specialist
AUTODESK
Message 6 of 16
Shawn_Kearney1
in reply to: pproestos

If you want random *shaders* to be applied to multiple objects, one way would be to use color jitter to generate a random int using the random node to drive a switch shader's selection.

In c4d you can use multiple shader references to select from a range of shaders. Not sure if this is available in MtoA or not.

Message 7 of 16
madsd
in reply to: pproestos

Eventhough this seems to be solved, I dusted up an old test case i'll show.

So, we drive a random generator, pipe that to a range node, that controls the likelyhood of which sub shader gets distributed - I highlighted the max input, it can filter the 4 different shaders in fluidly in probablility riasing and lowering it.

The random funtion is sourced to the UV transform node, which in this case just provoke a single random position, but it can be piped to anything for inreased random effects.
I also wired the UV transform and Random shuffle board into a CC node, where the hue is changed on each tile as well.

So this is a very dynamic rig and fun to play around with.

626-2017-12-23-14-41-53.jpg

628-werwerw.gif

Message 8 of 16
pproestos
in reply to: madsd

wow... now that's an early Christmas gift from an arnold guru...

thx for the answer. 🙂

Check also this script that works with Arnold, but of course

your method controls and assign better the shaders..

thx Mads Drøschler...

randomizer.zip

Message 9 of 16
madsd
in reply to: pproestos

Attached scene file. I saved it to max 2016 and reloaded it in 2018 without any problems. So should work.

I renamed maps with small description, all you need to do is load 4 maps and start expanding it.

color.zip

Message 10 of 16
pproestos
in reply to: madsd

thx again Mads.. you're genius!

I will definitely use your shader as a standard

to assign different maps into wood floors, tile walls ecc

wich is a critical factor for nice renderings.

I use arnold only for architectural visualization proposes and

I am sure that is the BEST renderer ever made.

thx again, best wishes.

Cheers from Greece.

Message 11 of 16
losluises
in reply to: pproestos

hello mads. can you please upload the max. file with the shader so i can open it. i culdnot make it work.. thanks in advance

Message 12 of 16
madsd
in reply to: losluises

What version of max are you using?
And its the shader that can randomly assign textures to instances, correct?

Message 13 of 16
pixelwash
in reply to: pproestos

Excuse me, this is the "Arnold for Maya" forum, some of us even now I think would appreciate it if someone answered the question of how to assign random values within a shader on a per object basis from a single Maya Arnold shading network, that is MAYA please....specifically if someone could tell me how to create a random texture offset, that would be really great....

Message 14 of 16
lee_griggs
in reply to: pixelwash

You can use the Maya TripleShadingSwitch node to randomly assign shaders:
https://docs.arnoldrenderer.com/display/A5AFMUG/Shading+the+Room

There are many ways to randomly offset the texture in Maya:
https://forums.cgsociety.org/t/randomize-uv-offset-without-changing-object-uv/1885460
https://www.google.com/search?q=random+texture+offset+maya&rlz=1C1GCEU_enES1014ES1015&oq=random+text...
Lee Griggs
Arnold rendering specialist
AUTODESK
Message 15 of 16
pixelwash
in reply to: lee_griggs

Thanks for the quick (and nasty) answer, Lee. I can use Google also, and the links that come up in that search you posted are all out of date, or irrelevant. Sorry for my not so fast reply, as I wanted to check everything.

 

(Many of the much easier ways there are to achieve random texture offsets and rotations in competitive products ie Pixar Renderman and Chaos Vray, especially its most recent incarnation for Maya.)

 

The "leaf" UV random offset matrix shader by that Aussie guy has long since stopped working, it was a staple in my work, it stopped in 2019 I think if I remember correctly, and he no longer maintains the website that was the source of it.

 

I finally found a YouTube video myself that dealt with translating the 3dStudio related answer you posted in this Maya forum to an earlier question about randomly assigning shaders in Arnold Maya using a switch node, which is great, but the whole question of how Maya Arnold handles UV mapping manipulation remains unaddressed, as I can't for the life of me get Maya to add some sort of input node to the texture U and V offset nodes, or the texture rotation node.

 

I've tried using the standard UV placement node with all sorts of input nodes, not just the two "random" ones in Arnold ie the jitter or random nodes, but trying to simply assign a clamped color or grey scale, converting to everything I could think of using various utility nodes, nothing seems to allow me to attach a value as an input to the U and V offset or rotation parameters.

 

I also tried using the aiTexture node rather than the basic Maya UV placement node, and it has an oddity when it comes to even showing the UV parameters in the shader node itself, as if you choose to "Expand All" nodes in the Hypergraph, none of the many UV related parameters, which show in the Attribute Editor, show in the Hypergraph.

 

Google suggested method https://forums.cgsociety.org/t/randomize-uv-offset-without-changing-object-uv/1885460 

using a "frame offset" as an input to the U or V value to achieve randomized offsets does not work, it produces no change in my recreation of this Hypergraph in my copy of Maya 2023, and I am curious about the whole idea of using a "frame offset" anyhow if there is no animation keyframes in the project, which is my situation, as these are for architectural still illustrations.

 

This was the first method I attempted actually, as I did a Google search myself before posting here.

Message 16 of 16
lee_griggs
in reply to: pproestos

https://www.youtube.com/watch?v=NO0CELHVu8Q

Lee Griggs
Arnold rendering specialist
AUTODESK

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

Post to forums  

Autodesk Design & Make Report