I have a hexagon sprite MainTex over which I want to render an outline texture SecondaryTex independent of the alpha value of the MainTex. Since I have a fairly large grid with many hexagons, two sprite renderers are not possible.
I have already achieved the overlay, but can’t get it to decouple from the MainTex alpha. Whenever I set the alpha of the sprite renderer to 0, the outline is also affected. I already tried to use a Maximum Node with the MainTex and the SecondaryTex alpha and use this value, but it doesn’t work.
How can I overlay and display the outline even if the MainTex / Sprite Renderer alpha is 0?
For anyone who is interested, I got a really good answer on gamedev.stackexchange:
If you’re using a Unity version prior to 2023.3.0a10, this is unfortunately unavoidable in shader graphs. The vertex colour (what you set in the
SpriteRenderer’s Color property) gets multiplied by the values you pass to the Base Color and Alpha pins after your shader graph runs. So any alpha fading you apply to in theSpriteRendererapplies to everything the shader draws. […]
