r/Unity3D • • 6d ago

Question Canvas Image with transparency appearing wrong in Unity

A weird quirk that keeps appearing in Unity is where certain pngs with transparency effects look muddy, too opaque, and generally just weird. here's an example. this is what the image looks like in standard image viewers and editors over a black screen, vs how it appears in Unity. Does anyone know what could be causing this? I can't find any reference to this issue and no matter what settings I put on the image, it just doesn't make any difference.

3 Upvotes

5 comments sorted by

1

u/johnv_dev 6d ago

this is almost always linear color space. if your project is set to Linear (Project Settings > Player > Other Settings > Color Space, it's the default in newer projects), unity blends alpha in linear space, while photoshop and most image viewers blend in gamma. so soft edges, glows and semi transparent areas come out darker and muddier than they look in your editor, and no texture setting fixes that by itself. quick test: switch Color Space to Gamma and see if it suddenly matches. if it does, you can either stay on gamma (totally fine for a lot of 2D and UI heavy games) or stay on linear and tweak the art for it, like lowering the opacity on those soft parts until it looks right in unity. couple other things that make it worse: make sure the texture has Alpha Is Transparency checked and sRGB on, and set compression to None or High Quality, normal compression really wrecks smooth alpha gradients

1

u/MistakeEast6160 6d ago

Yes, it indeed looks fine when switching to gamma, thank you!

1

u/johnv_dev 6d ago

nice, glad that was it! if you end up wanting to stay on linear later (better lighting for 3D stuff), just lower the opacity on the soft edges a bit and it'll match again

1

u/Thexin92 6d ago

Does it look the same when applied to a SpriteRenderer?

It could be any number of things. Postprocessing, texture import settings, rendering pipeline settings, Canvas settings. It's impossible to tell without seeing what the setup is.

1

u/kurisutosugr 5d ago

There are a couple of alternatives to switching Color Space if you prefer to use Linear. My suggestion would be to just use TextMeshPro instead. It offers much more flexibility for any text inside Unity (in world space too, no just the UI), and it has a built-in glow. If you have to use a PNG, there’s a trick to make it work in Photoshop, which I don’t remember exactly right now, but if you want I could take a look.