I've got a bunch of identical objects all wrapped up as a packed primitive, having been instanced by the Copy SOP. (A bunch of bricks stacked up in a tower ready for collapsing in DOPs, if you're interested). Nothing complex.
I'd like to vary the color (and nothing more) of each primitive, which I would have thought is accomplished by simply adding a Cd attribute to the points which represent the instanced geometry, and throwing a material shader at the object.
Sadly not.
I understand that both the Viewport and Mantra do something special with packed primitives (and other forms of instancing) that requires only one copy of the geometry to be retained in memory for efficiency and whatnot. But surely there's a way to add unique color to each instance?
Do I have to unpack my packed primitive in order to apply color to each primitive? Is there some limitation of instancing at the *geometry* level that prevents point attributes like color being used in shaders? Does it only work when instancing at the *object* level (which is what most of the H13 documentation on the subject seems to refer to)? Although, that said, I've tried both and had no luck with either.
Really thought I was just getting to grips with packed primitives until now. Please help. My colorless bricks are beginning to look a little sad
Varying Instanced Geometry
4639 5 2- AndrewJBeard
- Member
- 50 posts
- Joined: Aug. 2009
- Offline
- edward
- Member
- 7871 posts
- Joined: July 2005
- Offline
- ben5ch
- Member
- 76 posts
- Joined: March 2007
- Offline
- JordanWalsh
- Member
- 143 posts
- Joined: Feb. 2012
- Offline
If you have Cd on the packed prim object then you need to pud down a renderState Node and add in packed:Cd in the value name. Set the signiture to vector and you should be good to go.
Other wise the just using a Parameter/Bind will try to get the attribute off the unpacked geo when rendering.
The mantra shader in 15 should do this exactly
edit:
works perfectly on the attached file:
Other wise the just using a Parameter/Bind will try to get the attribute off the unpacked geo when rendering.
The mantra shader in 15 should do this exactly
edit:
works perfectly on the attached file:
- ben5ch
- Member
- 76 posts
- Joined: March 2007
- Offline
- JordanWalsh
- Member
- 143 posts
- Joined: Feb. 2012
- Offline
-
- Quick Links