Feedback

What's your question?

By: [ Editor ] Asked

How can I use my per particle attributes to control the shading of each instance?

Hello Maya wizards,

I instanced a cube on my particles and each particle has a different color. I would like each instanced cube to have its corresponding color. This would be to render in Mental Ray.

What rendering node would allow me to do this?

Any help would be most appreciated.

Add comment viewed 619 times Latest activity 7 months ago

or Cancel

4 answers

  • 2

julian [ Admin ]

Unfortunately Maya's instancer doesn't give any information about the particle that created a given instance. The only hacks I can think of are not very robust.

I think the fastest, most reliable and most portable way to solve this in maya is to write a python scripted plugin instancer that outputs a mesh (assuming your input is a mesh).

In the mesh class there are methods to specify how your UVs are laid out. You could either copy the layout of the input mesh UVs but have them offset based on the id of the particle, or you could attach blind data to the output mesh components. In the latter case you would need to write a hardware shader to access the blind data if you also wanted to see textures in the viewport.

or Cancel
  • 1

georg kaltenbrunner [ Editor ]

Maya really doesn't give you an easy option to do this. A simple but not very robust way would be to bake the instances into geometry, and assign your shaders by hand. Nimble Tools - Uninstancer does that for you.

I hate to say it, but if you want a procedural approach, you either have to do what Julian said (plugin) or think about using Houdini, which gives you tons of options for those type of things.

hope thats useful.

or Cancel
  • -1

bflat

you should use the particleSamplerInfo node, along with some userScalarPP or userVectorPP attributes

NN comments
ultragotcha
-

userScalarPP and userVectorPP don’t seem to matter to the shading of the instancer. I understand they work for particle shading but how would you make them control the shading of each geometry of the instancer?

or Cancel
  • -1

manny [ Editor ]

Try using the particleSamplerInfo node to run the colorGain of your shader. Use a white ramp so colorGain can assign the color.

Hhhhmmmm...Why not just control the color of the shader? Just a suggestion. Haven't tried it.

NN comments
ultragotcha
-

The problem is the same as above. See my answer to bflat: particleSamplerInfo doesn’t seem to be aware of the context of the particle corresponding to the geometry instance being rendered. So the user values (userScalarPP or userVectorPP) only seem to apply to rendering particles (–>cloud shader), not the instancer.

or Cancel