I create points with Distribute Points on Faces and instantiate other objects at these points. However, some of these objects overhang the surface.
How can I remove these objects?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.
Sign up to join this communityI create points with Distribute Points on Faces and instantiate other objects at these points. However, some of these objects overhang the surface.
How can I remove these objects?
You can use the Geometry Proximity
node with the Edges option for that. The threshold in the following Greater Than
node controls the selected points depending on their distance to the edges.
Setup (assuming the plane is not subdivided):
Edit: This method works also for arbitrary Ngons, but may deliver undesired results with subdivided geometry (although it's completely in the logic of the Edges mode).
In general there are two approaches:
Following, I explain a way of how you could delete unwanted objects after creation. This approach is based on raycasting.
The Delete Geometry node iterates over all points of all realized instances. A point gets deleted, if at least one point of the same instance is overhanging.
How do we check for this? We cast a ray in the normal direction of the target face that is closest to the current point. And we do the same in the opposite direction. If none of these rays hits the target object, we get a result of 1 – otherwise 0. Using the accumulate field node, we add all these values for every instance by using the instance index as a grouping value. The result is 0 if the values of all points of the same instance are 0 and >0 if at least the value of one point of the same instance is 1.
The Distribute on Points node simply distributes points. What you instance on it will decide whether it will stay on the geometry, or be in your words, overhanging. Look at this images of distributed points and spheres distributed on them for example. The point itself is on the surface. But the sphere, although instanced on this same point, some of it is outside the plane. This is simply because the distance between the point and the edge of the plane is smaller than the radius of the sphere.
This can be solved though. It's just going to be a bit of work. Get a position of your points by using a capture attribute node and delete any instance that is outside a certain range. This range will be "Edge"-"Maximum distance of a vertex of instanced obj from it's origin"