Paint Active Attribute

   1989   4   1
User Avatar
Member
86 posts
Joined: April 2016
Offline
I'd like to use a paint node to determine active/inactive areas for a fracture sim. I've got two questions on this…

First, what the best way to approach this? I've added a Paint node to my network and used red to indicate inactive areas. After the Assemble node, added an Attribute Wrangle with the following to set the active state for the points:


if (@Cd == (1, 0, 0)){
    i@active=0;
} else {
    i@active=1;
}

That appears to be setting everything to active=1. The node isn't throwing an error, but I'm guessing there's an issue with my code.

Second, when searching both here and ODForce for solutions, I found a good dozen or so responses to similar questions that were all answered with examples of using volumes/volumes with color to set the active variable but no answers that actually walked through doing it with a paint node, even though that's what the OP asked.

Why is that? Is it actually not possible to strictly use color set by a paint node for this?

Thanks!


mC

Attachments:
Metaball_Paint_Test_01.hiplc (525.8 KB)

User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
I haven't worked with varoni fractures so I don't know if this helps.

But pointing out some things may help you.

First, because you are running your geo through the assemble node, it is set to ‘Create Packed Geometry’, you now have a very different set of points.

After packing the points numbers don't refer to same same thing in your geometry, they now are ‘linked’ to the packed primitives.

One point per primitive.

So you lose access to the Cd attribute in the packed primitive context.

So in your vex, there is no Cd attribute so it creates one with the default value of {1,1,1}.

So your code is comparing to the default, which is always one for @Cd.x

Also, although it doesn't make a difference in this case, you are comparing a float to a vector.

@Cd.r to {1,0,0}

It should be

if(@Cd.r == 1)

Now if you unpack then your @Cd will be seen again, and your Vex will work as intended - not all of the ‘active’ attributes will be set to 1.

But I suspect, again haven't done varonni fractures before, you need to keep the geo packed for you dopnet.

If so keep your eyes peeled to this topic post as someone might be able to help if what I have said hasn't aided you.
Edited by BabaJ - Sept. 12, 2018 17:51:05
User Avatar
Member
731 posts
Joined: Dec. 2006
Offline
If you put “Cd” in the transfer attributes field when assembling (with “pack” option on), and follow the advice above, you should be golden.
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
User Avatar
Member
86 posts
Joined: April 2016
Offline
Gah…forgot that packing geo is basically the Houdini Witness Protection Program; everything gets a new identity.

Thanks, BabaJ and mrCatfish…appreciate the help!


mC
User Avatar
Member
86 posts
Joined: April 2016
Offline
Replying to this post in case the working (yay!) file can benefit someone else looking to control fractures with painted attributes. (This is now an H17 file)

I've also got a minor followup question…I can't figure out why it is that once I pack the geo and transfer the Cd attribute, it appears to go along for the computational ride but I can no longer see the painted color (red) in the view port. All the primitives pick up the other color (black).

If I don't transfer the attribute, I can still see the painted Cd.

What's happening there?


mC

Attachments:
Metaball_Test_04.hiplc (2.2 MB)

  • Quick Links