3D surface from Image Sampler without points in black areas

Hi,
I’m generating a heightfield from an Image Sampler: I create a point grid, sample grayscale values, remap them to Z, and build a Surface from Points. I’d like the black background to be completely ignored, so the 3D surface is created only from the remaining regions.

My goal is to get a surface only from the non-black area, with a clean boundary, so I can later turn it into a closed solid. I tried culling points by a threshold, but then Surface from Points breaks because it requires a full rectangular grid. I also tried a mesh approach (Deconstruct Mesh → Construct Mesh), but the topology becomes unstable and everything drifts/misaligns.

I’m attaching the .gh file and screenshots. Any help would be greatly appreciated—thanks!

image sampler.gh (3,8 MB)

Hello
if mesh and use of Nautilus plugin are OK here is a way with mesh Iso Splitting
The idea is to use MEsh Iso Splitting then connect naked edges (topology of 2 meshes MUST be the same)

I think it could be good to not put the same resolution in U and V and uses the one of the image.
image sampler LD.gh (3.3 MB)

Or there is also this way if you can have value on faces

Decon the mesh, get the centrepoint of each face, test for Z coord, use that to filter the face indices when reconstructing the mesh. I’ll give this a go…

Better late than never - a similar solution with vanilla components.


image sampler_TN.gh (1.7 MB)

I tried to get rid of the stair steps on the spine, but couldn’t see a clean way.

Thank you! :folded_hands: I’m just wondering how or if it’s possible to remove the step effect at the top

Thank you :folded_hands: Your generated mesh looks very good

Yes, it’s possible

But the method needs to be reworked to generate the infill “spine”
Instead of doing all the mesh work and then cutting, the mesh needs to be generated on the flat before cutting, then reprojected to both sides before doing the offsets. I can work on this later, but not now.

Step effects is due to the option “Interpolate” in Image Sampler that is not set.

IsoValue has also an effect.


Here a version with different resolution on X and Y
image sampler LD.gh (3.3 MB)

shakes fist at Laurent

First use a low-resolution surface to get a contour line, at an adjustable height to get the desired cut-off:

Use that line to split a flat mesh:


(Low resolution shown for clarity)
I do it this way because cutting the offset mesh directly makes a much more ragged edge.

Sporph it onto the target surfaces and offset the vertices, then stitch up the seam.


image sampler_TN2.gh (3.3 MB)

Hey @Tomaszko1, I know the topic is solved so I’m just sharing for future reference—prior to generating your height field, if it helps: there’s a handy import image component that brings in your image as a mesh with the colors, so you can quickly use them and keep only the faces with the brightness values you determine:

I believe you can also give it a rectangle boundary if you intend to do some mapping to the 3D surface or vice versa.

Cheers

This works incredibly well. I’m very grateful.
Is it possible to drive an attractor using the generated cutting curve? I’d like to control the offset of the points shaping this structure based on the top edge — specifically, I want the top line to have the same thickness along its entire length.
I realize a major limitation is the Image Sampler input, but maybe there’s a way to work around it.

Thank you.

It’s a trade-off between a clean line in plan vs elevation, so yes you could have a consistent width, but it would be at a cost of an inconsistent profile. I didn’t take a screenshot, but when I tried it the profile became quite obviously a slice through a stepped mesh.

So you’re right - you’d need to massage the mesh near the boundary to tidy the edge up. Ideally you’d be in the flat phase to collect the data for which vertices to move, based on distance to the splitting curve, then blend those weights with the image sampler output. This would avoid doing any modification to the actual displaced meshes, which would get messy.

I don’t have time to experiment right now, but there’s definitely a way through.

Here you go. You can play with the Blend Width slider and graph mapper to get the fall-off curve you want. The “spine” width is 2x the minimum offset parameter.


image sampler_TN3.gh (3.3 MB)

It works so great! appreciate it :folded_hands: