Varying Instanced Geometry

   4691   5   2
User Avatar
Member
50 posts
Joined: Aug. 2009
Offline
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
User Avatar
Member
7899 posts
Joined: July 2005
Offline
You need special shader support for this. In H14, there's a new parameter (enabled by default?) that will do as you expect on the Mantra Surface material.
User Avatar
Member
76 posts
Joined: March 2007
Offline
This is exactly what I'm looking for.
I have a bunch of packed primitives and want to color them individually in the viewport. It's just for visual feedback in a tool.

Neither Cd attribute or shader seem to have an effect.

Any ideas?

cheers,
benS
User Avatar
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:

Attachments:
packedCd.hip (272.1 KB)

User Avatar
Member
76 posts
Joined: March 2007
Offline
Yes that example file works. But this doesn't solve my problem.

I want the colors to show up in the viewport. I'm not rendering in mantra but on a Playstation4 8)

Also.. I'm still on Houdini 14.

cheers,
benS
User Avatar
Member
143 posts
Joined: Feb. 2012
Offline
ahhh, yeah, sorry about that
Will not show up in the viewport as the original brick is sitting in memory and being streamed to the video card, so it cant be modified on the way and stay nice and instanced
  • Quick Links