I got it! Thanks for all the help!! I also read the catlikecoding article before, but didn’t understood a step correctly.
But it works now! I’m not sure if it’s the most optimized version, because the struct lines for the vertex program get duplicated for the fragment program, like catlikecoding explained in the article but it works alteast.
Ok so here’s a what you have to do:
→ Download the shaders from the unity website, make a copy of the Standard.shader, UnityStandardCoreForward.cginc and the UnityStandardCore.cginc (I would suggest to rename them, atleast during the testing stage. If you rename them, remember to change the references in these files as well. The order, in which they, reference each other is this one: Standard.shader references UnityStandardCoreForward, which references UnityStandardCore) All the main changes we do get done in the UnityStandardCore.
→ Then put #pragma multi_compile _ LOD_FADE_CROSSFADE into every Pass of the Standard.shader just above the other #pragma multi_compile (except in the Meta Passes)
→ Then go into the UnityStandardCore.cginc (to open them, just drag them into VisualStudio) and copy the struct VertexOutputForwardBase completly and paste it in right after, so that you basically have the same struct two times. Now change the name of the duplicate to FragmentOutputForwardBase (just for good readability) and replace float4 pos : SV_POSITION with this code:
#if defined(LOD_FADE_CROSSFADE)
UNITY_VPOS_TYPE vpos : VPOS;
#else
float4 pos : SV_POSITION;
#endif
(The float4 pos is still in there, just in an if statement)
->Then go to half4 fragForwardBaseInternal (VertexOutputForwardBase i) and replace the VertexOutputForwardBase with our FragmentOutputForwardBase. After that, paste in these lines of code right at the top inside the half4 fragForwardBaseInternal (VertexOutputForwardBase i) function:
csharp* *#if defined(LOD_FADE_CROSSFADE) ApplyDitherCrossFade(i.vpos); #endif* *
And actually that was it! I hope this helps somebody and I’m also gonna upload my version here (I used the shader variants of Unity 5.6.3p1, just keep that in mind.)
If you really want to understand what’s happening here, checkt out the two links from bgolus, especially the catlikecoding Tutorial!
3595380–291500–CustomUnityStandardShader.zip (7.73 KB)