How do you scatter objects based on color MAP

   2940   2   2
User Avatar
Member
1 posts
Joined: 3月 2018
Offline
Hello.I am a new user to Houdini.
I imported an unwrapped model (In UDIM format) . I then Painted on the object in MARI for preparing it to scatter on the locations where there is color(Black). I Imported them in Houdini and got them on my object using attribute to MAP.
My object now has the paint. I want to know how do I scatter on the specific black color only and nowhere else?
User Avatar
Member
1743 posts
Joined: 3月 2012
Offline
If you have the colour as a Cd attribute, you can, in an Attribute Wrangle, do something like:

// Make dark areas 1.0, and everywhere else 0.0
@density = (length2(v@Cd) < 1e-4) ? 1.0 : 0.0;

Then, you can enable the Density Attribute option on the Scatter SOP. If you have a texture map as a regular image file, (sorry, no direct UDIM support in the Scatter SOP), you'll want where you want points to be scattered to be white, and where you don't want points to be scattered to be black, so you may need to invert the image. You can then set Generate to “In Texture Space”, and crank up the Density Scale. (It will probably need to be in the 10,000's to 100,000's range, since it's the average number of points scattered into the unit square of texture space.)

Hopefully one of those works for you!
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
7835 posts
Joined: 9月 2011
Offline
You can get UDIM working with a foreach network, scattering for each UDIM. You'll need to create the UDIM prim attribute yourself, but the scatter itself should work how ndickson describes.
  • Quick Links