0
$\begingroup$

A project I'm currently working on requires turning a 2D shape (simple but random 2D shape, typically a face extracted from another object, can be tilted) into a Point Cloud of some specific specs (thickness, point distance, density, etc.) for further process.

So the idea I came up with is using Geometry Nodes to:

  1. use Extrude Mesh node to turn the 2D shape into a 3D geometry
  2. generate a box shaped point cloud bigger enough to cover the entire geometry
  3. use the method from this tutourial https://www.youtube.com/watch?v=v8pI_f-S6bg to delete all the points outside of the geometry

However, I get some fairly weird artifacts, as you can see in the attached screenshots. So besides those points inside the 'boundary', there are also some bits outside of the boundary somehow didn't get deleted as expected. I can swap the 'boundary' geometry to some default meta shapes (cube, torus, etc.), and the whole thing works just fine. A simple 2D plane The entire node tree The 'Point Cloud' node group The weird result

Any idea of why it acts like that, and how I can fix it?

(I know I didn't close the bottom of the extruded mesh, but that's not the issue and doesn't help either as I've tried.)

Here's the blend file: https://drive.google.com/file/d/1rLv0_lpGD8k9FVskyj3TkI3ukkh5WNZS/view?usp=sharing

$\endgroup$
2
  • $\begingroup$ I wonder if this is actually a bug. $\endgroup$
    – Raven
    May 26, 2023 at 5:05
  • $\begingroup$ Note: in my actual case, the point cloud is more complicated and has a specific pattern, so it is made separately, hence why I took that 'boundary-check-remove-excesses' approach... Also the actual face will very likely be tilted with its normal facing all sorts of direction but its Z axis, but the point cloud (in its own pattern) does need to align with that face's normal. $\endgroup$
    – Raven
    May 28, 2023 at 11:39

1 Answer 1

0
$\begingroup$

To transform a two-dimensional shape into a point cloud, you can use the following setup:

enter image description here

Here I extrude the 2D shape to get a solid body.

But instead of creating a grid, and removing the excess points, I use the nodes Mesh to Volume and Distribute Points in Volume to create points in a grid within this mesh.


(Blender 3.4+)


Update

In your specific use case or based on your example, you can also simply use the node Raycast and send a ray upwards. This way you filter all points that do not hit a surface:

enter image description here

$\endgroup$
4
  • $\begingroup$ Appreciate it. In my actual case though, the point cloud is more complicated and has a specific pattern, so it is made separately, hence why I took that 'removing' approach... Also the actual face will very likely be tilted with its normal facing all sorts of directions but its axis, making distributing points in it a bit tricky. $\endgroup$
    – Raven
    May 28, 2023 at 11:28
  • $\begingroup$ @Raven Ah, all right, maybe the suggestion in the update will help you. $\endgroup$
    – quellenform
    May 28, 2023 at 12:03
  • $\begingroup$ Brilliant! It worked well in my actual case. I can use the face normal to direct the ray's direction. Never fully understood how Raycast works, but the outcome is perfect. Thank you! $\endgroup$
    – Raven
    May 28, 2023 at 15:24
  • $\begingroup$ @Raven Imagine that with Raycast simply a ray is sent from a certain position in a certain direction. If the ray hits an obstacle, a Hit is generated, and you have additional information about the point that was hit (normal, position, distance, etc.). $\endgroup$
    – quellenform
    May 28, 2023 at 15:29

You must log in to answer this question.

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