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

xParticles xpTrails colors, how to control them?

Message 1 of 9
1091 Views, 8 Replies

xParticles xpTrails colors, how to control them?

I'm trying to do two things.
First: I have this emitter that emits particles with random colors, and that's ok, arnold does the job. The thing is, despite the trail object color is set to be the same as particle color, arnold renders all the trails the same color despite the color of the corresponding particle. Is there a workaround for this?
Second: Is it possible to assign random colors to the trails from a given color palette (ramp)? (not just random random colors)
Thank you.

Tags (2)
Labels (2)
Message 2 of 9
in reply to: Anonymous

Unfortunately the X-Particles SDK is limited and I can not read color of a trail or tell which trail belongs to which particle.

You can use the utility shader in uniform ID color mode to drive a ramp. Alternatively you can enable Export IDs in the Arnold tag of the xpTrail and read the id via a user_data_int shader. Use curve_id as the attribute.

Message 3 of 9
in reply to: Anonymous

I'm a bit confused about the order of the nodes. In the first solution, the ramp comes before or after the utility? which nodes connect to which? In the second solution, to which node connects the user_data_int?

Message 4 of 9
in reply to: Anonymous

The utility shader in uniform ID mode will generate a random color of each trail. You can connect it to the input of the ramp shader to randomly select a color.

Same for the user_data shader, you can connect it to a random shader for instance to generate a random color based on the id (trail index) and connect that to the ramp.

Message 5 of 9
in reply to: peter.horvath6V6K3

Hi again,
I can't see "curve_id" in the atributes for user_data_int, only "id". In the arnold tag assigned to the trail object "export IDs" is checked though.

Message 6 of 9

It's indeed not listed in the menu, just simply type in curve_id.

Message 7 of 9

Hello Peter Horvath,

I tried your workaround with Uniform ID. But I only manage to get random colors. I can't make it work that I can get the Uniform ID information do drive a ramp. Am I doing something wrong?


Message 8 of 9

Your setup looks correct to me. Here's a simple scene with colors picked up from a red to white gradient:

Just to clarify, the colors are still random but selected from a ramp (color palette).

I hope I can add direct support for xptrail colors in the near future.

Message 9 of 9

Oh well my bad, the shade mode has to be on flat. Mine was for whatever reason on ndoteye. But thank you for the help!

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

Post to forums  

Technology Administrators

Autodesk Design & Make Report