Texture2D doesn't render the image correctly

I can’t figure out why Texture2D doesn’t render the image correctly. I’m trying to make a shader from a guide. But one point is not clear to me: in the textures I have an image of leaves with a transparent background. And it displays fine. But as soon as I select it in the Shader graph it becomes like this:
8126375--1053809--upload_2022-5-14_0-5-58.png

8126375--1053800--upload_2022-5-14_0-4-55.png

There’s no bug. That’s what your texture actually looks like, and is what it should look like.

The shader graph preview is showing what the texture looks like without the alpha applied, as it doesn’t know if you intend to use the alpha as transparency or as a data channel (as is common for smoothness).

As far as I understand, the alpha channel is connected, but still nothing happens (it’s gray).

Notice the Alpha is grayed out, it is likely because your graph/material is set to Opaque without Alpha Clipping enabled. Look in the Graph Settings panel and checkmark “Alpha Clipping” so that pixels of the texture alpha that fall below the “Alpha Clip Threshold” will be discarded, thus creating the transparency.

If you want smooth edges, then you’ll want to change from Opaque to Transparent mode so alpha blending can be used, but this can come with other issues related to sorting if you’re planning to use this in 3D space, not 2D. And that’s a whole other subject to go over.

1 Like

Yes, I enabled Alpha Clipping and it worked. Thank you very much for your reply!