特效Shader对雾的处理

RFX4_Particle.shader案例

#ifdef BlendAdd
    UNITY_APPLY_FOG_COLOR(i.fogCoord, res, half4(0,0,0,0)); 
#endif
#ifdef BlendAlpha
    UNITY_APPLY_FOG(i.fogCoord, res);
#endif
#ifdef BlendMul
    res = lerp(half4(1,1,1,1), res, res.a);
    UNITY_APPLY_FOG_COLOR(i.fogCoord, res, half4(1,1,1,1)); // fog towards white due to our blend mode
#endif
#ifdef BlendMul2
        res = lerp(half4(0.5,0.5,0.5,0.5), res, res.a);
        UNITY_APPLY_FOG_COLOR(i.fogCoord, res, half4(0.5,0.5,0.5,0.5)); // fog towards gray due to our blend mode
#endif

重点是不同混合模式要对雾与颜色做不同的处理

 
 
 
 

转载于:https://www.cnblogs.com/CloudLiu/p/10446532.html

你可能感兴趣的:(特效Shader对雾的处理)