콘텐츠로 건너뛰기

Virtual back lighting method test

Purpose of implementations.

  • Avoiding increasing draw-call.
这是手机游戏预览的真实预览。
#if USE_SECOND_DIRECTIONAL_LIGHT
    half2 RoL = max(0, half2(dot(ReflectionVector, DirectionalLightDirection), dot(ReflectionVector, _WorldSpaceLightPos1.xyz)));
    half2 PhongSpecular = PhongApprox(Roughness, RoL);
	half3 Directional = (Shadow * NoL) * DirectionalLightColor * (DiffuseColor + SpecularColor * PhongSpecular.x);
    
    half NoL2 = max(0, dot(normalWorld, _WorldSpaceLightPos1.xyz));
	Directional += NoL2 * _LightColor1 * (DiffuseColor + SpecularColor * PhongSpecular.y);
#else
    half3 halfDir = normalize(DirectionalLightDirection + s.viewdir);
    half RoL = max(0, dot(ReflectionVector, DirectionalLightDirection));
    half RoLDual = max(0, dot(ReflectionVector , -s.viewdir * halfDir));
    
    half3 Directional = (Shadow * NoL) * DirectionalLightColor * (DiffuseColor + SpecularColor * (PhongApprox(Roughness,RoL)));
    #if defined(USE_BACKLIGHT_SPECUAR)
        Directional = (Shadow * NoL) * DirectionalLightColor * (DiffuseColor + SpecularColor * (PhongApprox(Roughness,RoL) + (PhongApprox(Roughness, RoLDual))));
    #endif
#endif
태그:

댓글 남기기

%d 블로거가 이것을 좋아합니다: