# Turn 2D shape into a Point Cloud

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.

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

• I wonder if this is actually a bug. Commented May 26, 2023 at 5:05
• 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. Commented May 28, 2023 at 11:39

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

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:

• 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. Commented May 28, 2023 at 11:28
• @Raven Ah, all right, maybe the suggestion in the update will help you. Commented May 28, 2023 at 12:03
• 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! Commented May 28, 2023 at 15:24
• @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.). Commented May 28, 2023 at 15:29