5
$\begingroup$

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?

enter image description here

$\endgroup$
1
  • $\begingroup$ Inset the face by the 'radius' of the object (radius of the sphere completely encompassing the object; half of the minimum distance in the Poisson Disk distribution), then distribute points on it. $\endgroup$ Jul 28 at 10:05

3 Answers 3

8
$\begingroup$

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):

enter image description here

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).

enter image description here

$\endgroup$
6
$\begingroup$

In general there are two approaches:

  • You can prevent objects of being instanced, as shown in the solution from taiyo. This is a more pragmatic and performant approach.
  • You can delete the unwanted objects after being created. This is a more exact approach but takes more computation time.

Following, I explain a way of how you could delete unwanted objects after creation. This approach is based on raycasting.

result

result 2

node tree

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.

$\endgroup$
0
$\begingroup$

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.

enter image description here enter image description here

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"

$\endgroup$
5
  • $\begingroup$ But how would you actually do "Edge"-"Maximum distance of a vertex of instanced obj from it's origin"? $\endgroup$
    – taiyo
    Jul 27 at 16:18
  • $\begingroup$ It can be done, it's just too big of a node tree to show here. We can use the bounding box min and max for that.(This will work only for a plane though) $\endgroup$ Jul 27 at 16:21
  • $\begingroup$ @taiyo as for the "Maximum distance of a vertex of instanced obj from it's origin" we an actually do the same thing, the bounding box min and max. But yeah it's going to be complicated. But yeah your setup is just perfect for a unsubdivided plane compared to mine. $\endgroup$ Jul 27 at 16:22
  • 3
    $\begingroup$ Dont get me wrong, but "it can be done, its just too complicated" is just not an satisfying answer. I think to show multiple approaches to solve a problem has value because every approach has different pros and cons, i updated my answer in that regard. I can imagine that your approach would not suffer from subdivision of the distribution geometry. $\endgroup$
    – taiyo
    Jul 27 at 18:17
  • $\begingroup$ @Akshay2005 I agree with taiyo, you're only stating what you could do in theory but there is no actual implementation the OP can use or test to see if your answer actually works so this wont be so helpful to the OP or most people visiting this thread, especially beginners. $\endgroup$ Jul 27 at 23:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .