Been using and developing quite a few scattering modules over the years for specific purposes and Lately I have had a need for quite simple systems but that was not something solved by the built in modules.
For example: let’s say you want to distribute a selection of boxes(not cubes) on a surface but the boxes can not be scaled and should not overlap. Sounds super easy but not sure how to do this with built in modules. Should I have to make my own “check bounding box intersection thingy” in a loop? Misuse uv layout per entagmas old tut? I am curious if there is a quick and smart way to solve this and would be very happy to see solutions.
Simple but not stupid scattering?
2192 4 1- filipw
- Member
- 138 posts
- Joined: March 2018
- Offline
- kahuna031
- Member
- 897 posts
- Joined: July 2018
- Offline
These problems often branches of into very specific solutions depending on your requirements. Is it for 3d, do you have angle axis oriented boxed, do you have soft constraints like "prefered" solutions in cases when there's more than one solution?
Even breaking down to atomic nodes are difficult as Houdini isn't a great fit for custom data types like "box".
Without good information about your particular case, my guess
Even breaking down to atomic nodes are difficult as Houdini isn't a great fit for custom data types like "box".
Without good information about your particular case, my guess
- For a perfect solution with perfect control it's best to just wrangle the whole thing. Implement custom box overlap functions and calculate good positions until you've filled the space.
- 3d For a more expensive, simpler but also a lot more readable setup I would loop-feedback it with intersection checks.
- 2d, guessing this is what Entagma does, use the uv layout to place squares on the mesh that you then replaces with boxes.
B.Henriksson, DICE
- filipw
- Member
- 138 posts
- Joined: March 2018
- Offline
- kahuna031
- Member
- 897 posts
- Joined: July 2018
- Offline
filipwIf I understand you correctly, you'd like ready nodes/functions to use- This is where one would need to understand your exact constraints to even begin tackling it. Just filling a single polygon with squares is a difficult problem. Would you instead say that you can accept working on a grid then the same challenge become trivial- just move the grid over the polygon and delete what's outside. But then again, say you also need it to work for multiple polygons in 3d and the distribution needs to be continuous across edges and the grid solution becomes very difficult.
As you saw from the first post, I am hoping for a genre “0” ? so I can lazily jump to other issues.
Fundamentally it's about how packing problems is ambiguous and lack good universal methods. UV packing is the best there is.
B.Henriksson, DICE
- Digipiction
- Member
- 166 posts
- Joined: March 2014
- Offline
If you don't need the packing to be very tight you can use the point relax node, it takes pscale into account and gives pretty good results. The less cube-shaped your boxes are the bigger the gaps will become, because the point relax assumes spherical points.
A more accurate non-VEX solution would be to use Vellum. The idea being that you scatter them initially with 0.5x their size, ensuring that they don't overlap. Then on the Vellum configure (should probably use Vellum Configure Strut Softbody) you set their rest length scale to 2x, this way they'll scale themselves to their intended size on frame 2.
On the Vellum solver you would want to increase friction static threshold and wind drag a lot (maybe to 5 each or something) so that they don't separate too much when they get scaled up. Also set stretch and bend stiffness very high and increase constraint iterations if needed.
Setting the Vellum solver to quasistatic will output only a single frame instead of a simulation (although internally it does have to calculate frame by frame, so you may want to cache the resulting frame).
Just tested this, and the packing can be very tight when you do it like this.
A more accurate non-VEX solution would be to use Vellum. The idea being that you scatter them initially with 0.5x their size, ensuring that they don't overlap. Then on the Vellum configure (should probably use Vellum Configure Strut Softbody) you set their rest length scale to 2x, this way they'll scale themselves to their intended size on frame 2.
On the Vellum solver you would want to increase friction static threshold and wind drag a lot (maybe to 5 each or something) so that they don't separate too much when they get scaled up. Also set stretch and bend stiffness very high and increase constraint iterations if needed.
Setting the Vellum solver to quasistatic will output only a single frame instead of a simulation (although internally it does have to calculate frame by frame, so you may want to cache the resulting frame).
Just tested this, and the packing can be very tight when you do it like this.
-
- Quick Links