Multi texture shader to cloner objects

Multi texture shader to cloner objects

Anonymous
Not applicable
12,947 Views
36 Replies
Message 1 of 37

Multi texture shader to cloner objects

Anonymous
Not applicable

Hello. Is it possible to aplly a multi texture shader, in a linear order (1st, 2nd, 3rd, ...) to the objects of a linear cloner, just as the mograph shader does? Let's say, like pages in a magazine, one shader for multiple pages with the textures in the right pages in sequence, not randomly. I'm trying to do it with the Switch Shader nome but getting stuck in the index parameter. I've tryed the Range none attached to the index value of the Switch Shader, but no success.
Any help would be appreciated, thank you.

0 Likes
12,948 Views
36 Replies
Replies (36)
Message 21 of 37

peter.horvath6V6K3
Advisor
Advisor

I don't think anything has changed. I made a quick test and seems to be working fine. Can you send me a scene which is not working? Did you try the same in older versions to confirm it's related to R21 and/or Arnold 6?

0 Likes
Message 22 of 37

mikkelsandner
Explorer
Explorer

@Francisco Cunha - Can you get this to work with a simple cube (that has not been made editable)? My magazine pages are made of cubes and not planes, but somehow the shader doesn't work with cubes. Any other object seems to work fine!

0 Likes
Message 23 of 37

peter.horvath6V6K3
Advisor
Advisor

Unfortunately this is a current technical limitation, trying to solve this in a future release, yet it's a bit complicated. I guess the only option at the moment is to make the cube editable (make a polygon object).

0 Likes
Message 24 of 37

peter.horvath6V6K3
Advisor
Advisor

Or you can use a step effector and read the display color, which is not as straightforward because color transform is involved. See this thread where I posted an example, teste 1 v02.zip.

https://answers.arnoldrenderer.com/questions/22656/assigning-different-colors-to-mograph-object-base...

0 Likes
Message 25 of 37

peter.horvath6V6K3
Advisor
Advisor

Actually I may be able to fix it for Cubes. Will let you know.

0 Likes
Message 26 of 37

peter.horvath6V6K3
Advisor
Advisor

Clone indexes should be fixed for Cubes in the latest release, C4DtoA 3.0.1.2.

0 Likes
Message 27 of 37

darioOrtisi
Collaborator
Collaborator

Hi @rachid Hadj Abderrahmane. I'll try your method but it' didn't work. I made all the steps. Any hint? thanks

0 Likes
Message 28 of 37

haykal_sulaiman
Not applicable

how about images?


0 Likes
Message 29 of 37

ayush.tanna
Observer
Observer

Hi,

This method of using user_data_int with index as the attribute for assigning unique textures to each clone works perfectly. But as you mentioned there is a limit for 20 inputs in the switch_rgba node. @peter.horvath6V6K3 do you know if there is anyway I can change this or use different nodes to achieve the same result? I have 25 images to assign to 25 clones, how should I proceed to do this, besides creating individual objects from the cloner and manually applying the textures?

Thank you

0 Likes
Message 30 of 37

peter_horvath
Autodesk
Autodesk

You can chain switch shaders like this: connect multiple switch shaders to a main switch shader (in your case you need two since you have 25 textures). Divide your index input by 20 and connect it to the main switch shader. This will select which child switch is active. Then modulo your index by 20, and connect it to all child switch shaders. This will select the input of the active switch.

peter_horvath_0-1660322713614.png

 


// Peter Horvath
// C4DtoA developer
Message 31 of 37

ayush.tanna
Observer
Observer

Hi,

Thanks a lot @peter_horvath. This works like an absolute charm. I did the same in the Shader Network and not in the default C4D node space.

There is a slight problem though, for some reason, clone number 23 and 24 register both as 23 and display the same texture - You can check the top-most row of keys on the keyboard in the attached render. One letter is repeated on 2 keys.

I have attached a Shader Network screenshot as well for reference. I'll try to figure out why this is happening but just wanted to let you know.

Thank you for the response again, this was very helpful.

0 Likes
Message 32 of 37

peter_horvath
Autodesk
Autodesk

The shader network looks correct. (I assume the textures are properly set in number 23 and 24). Maybe the index coming from the cloner is wrong. You can check if you export the scene to an ASS file and look at the index parameter on the polymesh nodes.


// Peter Horvath
// C4DtoA developer
0 Likes
Message 33 of 37

daniel2SH2D
Advocate
Advocate

But how to get more than 20? Is that an absolute limit or is there a way to combine switch rgba nodes while still reading clone ID's?

 

0 Likes
Message 34 of 37

gremmler4ARLU
Contributor
Contributor

This is thread is very helpful! But now I'm also facing two wrong texture assignments on clone ID 23 and 28. I actually just want to reverse the texture sequence after ID 20 (screenshot attached). any ideas?

0 Likes
Message 35 of 37

peter_horvath
Autodesk
Autodesk

It is a precision error in the modulo shader output (2.9999 instead of 3.0 and that results to 2 when converted to an integer). You can overcome that by adding 0.5 to the result.

peter_horvath_0-1715605918599.png

You might have to de the same with the divide shader output, just in case.


// Peter Horvath
// C4DtoA developer
0 Likes
Message 36 of 37

ssjenforcer191191191
Advocate
Advocate

Does this work with scatter objects, as well?

Like if I want to have slight variation in hue or brightness for tree leaves in a scatter?

0 Likes
Message 37 of 37

peter_horvath
Autodesk
Autodesk

This thread is about assigning different textures (or shaders) based on the clone index. The scatter object does not set the index. For slight variation I'd recommend using the color_jitter shader, that works with scatter instances too.


// Peter Horvath
// C4DtoA developer
0 Likes