defc0n1 Posted January 3, 2017 Share Posted January 3, 2017 Hey guys. I'm pretty new to the houdini world, and I've been experimenting a lot of things. Is there a way to get the RGB values of scattered points using attrib wrangle? Im not too familiar with the VEX syntax, so Im having a hard time figuring it out. I have random colours signed to a scatter node and some geometry copied on to the points using a copy node. I want to limit scatter the geometry based on the colour of the scattered point. Thanks! Quote Link to comment Share on other sites More sharing options...
Atom Posted January 3, 2017 Share Posted January 3, 2017 (edited) Sure, with a wrangle running over points, you have access to each points color with the @Cd attribute. In this code, any objects that have a red color greater than 0.9 will be scaled to 0, thus not appear in the scene. All others will get a scale of 1 and appear in the scene. if (v@Cd.r > 0.9) { v@scale = 0; } else { v@scale = 1; } Edited January 3, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
Skybar Posted January 3, 2017 Share Posted January 3, 2017 5 minutes ago, Atom said: Sure, with a wrangle running over points, you have access to each points color with the @Cd attribute. In this code, any objects that have a red color greater than 0.9 will be scaled to 0, thus not appear in the scene. All others will get a scale of 1 and appear in the scene. if (v@Cd.r > 0.9) { v@scale = 0; } else { v@scale = 1; } Just a heads up that this can be problematic, even though they're not visible they are still there. So potentially you could end up with tons of infinitely small geometry; they aren't visible but still take up memory and whatnot. Quote Link to comment Share on other sites More sharing options...
Atom Posted January 3, 2017 Share Posted January 3, 2017 (edited) Skybar is right, just keeping it simple. This is an old mograph trick and is safe to use up to hundreds of objects/points on most hardware. If you get up into higher points counts you may want to remove the points that you don't want copies on. Like so. if (v@Cd.r > 0.9) { removepoint(0,@ptnum); } The @ptnum attribute is the actual point number that the wrangle is currently evaluating. If you are running over primitives there is a similar attribute called @primnum. Edited January 3, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
defc0n1 Posted January 3, 2017 Author Share Posted January 3, 2017 Thank a ton, guys! You're awesome. Works like a charm. The sheer power of Houdini has me in awe, actually. Can I export a variable or set a parameter based on the input Cd that I can access from other nodes? For example a switch? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.