Quantcast
Viewing latest article 5
Browse Latest Browse All 18

Additive Surface Shader in Unity 5

I just upgraded from Unity 4 to Unity 5, and it seems a lot of shaders are behaving differently. It seems that in Unity 5, all my transparent shaders are not blending correctly. I KNOW! I have read the documents and made the following modifications: 1. adding the "alpha" or "alpha:blend" or "alpha:fade" options to the surface shader pragma line 2. write the SurfaceOutput Alpha to my custom lighting model function's output. Basically if Half4 c is the output of my lighting model, then I will assign SurfaceOutput o, c.a = o.a; Yes to some degree this is enough, but if you read the compiled vertex/fragment shader the options above only adds: Blend SrcAlpha OneMinusSrcAlpha to the forward base pass. It completely ignores my Blend SrcAlpha One option in the surface shader...In Unity 4 this would work perfectly, but in Unity 5 it just ignores you. And I went on to read the Unity 5 built-in shaders, and it seems that every time they want to do some custom blending in Unity 5, they simply just write vertex/fragment shaders... For me, writing my own vertex/fragment shaders is NOT an option! I developed a program that can compile "surface shaders" to have a special effect, so currently I have like 700+ shaders in my project, most of them are compiled by my tool and it only works for surface shaders.

Viewing latest article 5
Browse Latest Browse All 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>