1
$\begingroup$

I have a mesh that I got from an external program (called PlantFactory), it looks like this:

enter image description here

As you can see, each leaf is one rectangular mesh with a transparent texture applied to it (ignore the small gaps spread across the mesh, this is due to using the trial version). What you see above is the raw mesh imported from an FBX file, no modifiers or anything else have been applied.

What I want to achieve is to delete all mesh faces that have transparent texture. I tried doing this with geometry nodes, but the result I get is not what I expected to get:

enter image description here

I'm using the alpha channel of the leaf texture image to remove faces from the geometry. But it seems to go wrong. Maybe the problem is that the alpha values are being queried at the wrong image coordinates?

Is there some way to directly retrieve (in the geometry node editor) the applied alpha value that is used in the shader settings? Or to somehow map the alpha values to the correct image coordinates?

enter image description here

I've added the blend file as an attachment.

$\endgroup$
2
  • $\begingroup$ I think you forgot to pack your resources (File > External Data > Pack Resources), so there are no textures in the file i.imgur.com/ZfyJfAE.png $\endgroup$
    – Kuboå
    Commented Jan 9, 2023 at 18:17
  • $\begingroup$ Thanks, I updated the post, the textures should be included now. $\endgroup$ Commented Jan 10, 2023 at 9:12

1 Answer 1

1
$\begingroup$

Maybe the problem is that the alpha values are being queried at the wrong image coordinates?

Your suspicion is right. You should provide a correct mapping Vector to your Image Texture node. Easiest way to do that would be to use the current UV map of your geometry. You can use a Named Attribute node to access the relevant UV map. By default, its name should be UVMap for geometry created inside Blender:

enter image description here

However, that can be changed, or might be different for geometries imported from other software. In any case you can find the correct name by simply selecting it from the Name dropdown on the Named Attribute node (look for a 2D Vector attribute in Face Corner domain), or by checking the Properties > Object Data (green mesh icon) > UV Maps subpanel:

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks, that did it! Although I had to set 'LayerUV_0' in the 'name' field of the Named Attribute. When I used "UVMap" it did not work, the whole leaf was deleted instead. I'm also missing the 'Exists' socket below the 'Attribute' socket. $\endgroup$ Commented Jan 10, 2023 at 9:12
  • 1
    $\begingroup$ @SamDeMeyer UVMap is the default uv map name in Blender, it might be different for geometry imported from other software like in your case. Socket not being there is probably about the version you're using, I'm on the latest, 3.5. $\endgroup$
    – Kuboå
    Commented Jan 10, 2023 at 9:20

You must log in to answer this question.

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