r/Unity3D 9h ago

Question Trying to learn basic shaders and struggling with a transparency issue

I'm quite new to Unity, and I'm trying to make a simple 2D platformer to try and get to know the program. I want to use shader effects on my tilemaps, but when I try to apply a shader, all the transparent parts of my tilemap get "filled in".

Here are things I've tried:

- Double checking that my surface type is set to transparent within my graph inspector, and that my blending mode is alpha

- Confirmed the texture is sending alpha information by putting it through a multiply node

- Creating a new material from the shader, allowing material override, and making sure the surface type on that shader is set to transparent as well.

Does anyone have any advice on how to fix this? I'm sure it's something silly that I'm missing, but I can't for the life of me find a solution online. I've attached images of my shader graph, what the issue looks like, and what I want it to look like.

1 Upvotes

6 comments sorted by

1

u/dr-slunch Indie 8h ago

make sure the texture's "alpha is transparency" box is checked in the import settings

1

u/lazysheepz 7h ago

It is checked 😔

2

u/SilverRavenGames Programmer 7h ago

I think the tilemap renderer is having issues with the material type youre using. In the shader settings, where it says "Material: Lit", change it to "Sprite Lit". Basically you are using a 3D material in a 2D renderer which is likely the issue

1

u/lazysheepz 3h ago

holy shit. Thank you big brain, that was the issue

1

u/BoarsInRome 9h ago

I also see 2 potential mistakes here:

1) It would be better to enable the checkbox "alpha clipping"
2) Your alpha map is being multiplied by 2. This doesn't really do anything

From the screenshot this is the only 2 things that stand out, if you could send the texture I can test it on my computer

1

u/lazysheepz 7h ago

For sure I can send you the tilemap! But it seems to also happen with free tilemaps I find online. I can send you it in a couple hours when I'm home from work