Heyho,
I am working on a project for my school which is a first person Metroidvania based mostly in caverns.
For this i have lots of LOD’s for the rocks and stones.
Currently i am having the problem of the LOD fading lacking my expectations and i have been reading up some stuff on that and searched for sources.
The exact problem i am having is that the default cross fading and unitys enabled dithering in the standart shader are not what i would like to have in the final result.
So i found an example shader with a really good fading between LOD’s (Source: GitHub - keijiro/CrossFadingLod: (Unity) Cross-fading LOD shader example)
Problem is that this is just a simple example with only one input on albedo.
So i tried to implement this fading inside the standart shader. Well, I failed multiple times.
I have a big problem in using any sort of code for anything. I do understand how it works and what it does but can’t get around making it myself what so ever.
So if someone could help me and knows how to implement this fading into the standart shader instead of the unity inbuild dithering which you have to enable, i would be really greatfull.
Here is a comparision between the default fading:
crazylighthaddock
and the smooth fading from the custom shader:
likelyrealboutu
As you can see it is much better compared to the default one.
So as an extra attachement here is the code from the custom shader which has the lines containing what i need. At least i guess that these lines are the ones.
#ifdef LOD_FADE_CROSSFADE
float2 vpos = IN.screenPos.xy / IN.screenPos.w * _ScreenParams.xy;
UnityApplyDitherCrossFade(vpos);
#endif
So what i tried, was to just insert these lines but it didnt work.
#pragma multi_compile_fwdbase
#pragma multi_compile_fog
#pragma multi_compile_instancing
// Uncomment the following line to enable dithering LOD crossfade. Note: there are more in the file to uncomment for other passes.
//#pragma multi_compile _ LOD_FADE_CROSSFADE
#ifdef LOD_FADE_CROSSFADE
float2 vpos = IN.screenPos.xy / IN.screenPos.w * _ScreenParams.xy;
UnityApplyDitherCrossFade(vpos);
#endif
#pragma vertex vertBase
#pragma fragment fragBase
#include "UnityStandardCoreForward.cginc"
ENDCG
so, in the end again, if someone could help me out on this it would be awesome.