Community
Arnold for Cinema 4D Forum
Rendering with Arnold in CINEMA 4D using the C4DtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multi texture shader to cloner objects

36 REPLIES 36
Reply
Message 1 of 37
Anonymous
4739 Views, 36 Replies

Multi texture shader to cloner objects

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.

Tags (2)
Labels (2)
36 REPLIES 36
Message 21 of 37
peter.horvath6V6K3
in reply to: Anonymous

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?

Message 22 of 37
mikkelsandner
in reply to: Anonymous

@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!

Message 23 of 37

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).

Message 24 of 37

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...

Message 25 of 37

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

Message 26 of 37

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

Message 27 of 37
darioOrtisi
in reply to: Anonymous

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

Message 28 of 37
haykal_sulaiman
in reply to: Anonymous

how about images?


Message 29 of 37
ayush.tanna
in reply to: Anonymous

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

Message 30 of 37
peter_horvath
in reply to: Anonymous

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
in reply to: peter_horvath

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.

Message 32 of 37
peter_horvath
in reply to: Anonymous

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
Message 33 of 37

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?

 

Message 34 of 37

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?

Message 35 of 37
peter_horvath
in reply to: Anonymous

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
Message 36 of 37
ssjenforcer191191191
in reply to: Anonymous

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?

Message 37 of 37
peter_horvath
in reply to: Anonymous

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

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

Post to forums  

Autodesk Design & Make Report