diff options
| author | yum <yum.food.vr@gmail.com> | 2024-07-28 14:14:30 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-07-28 14:14:30 -0700 |
| commit | 22d3a28ef6ac9f4fc9204ae3bc0c67d82feac46e (patch) | |
| tree | 1cfe361a86a731e630ceece702e7654ce62cfabf /pbr.cginc | |
| parent | aa932e9df0691f1de27fb44e06e8d786400c3d2a (diff) | |
Implement stereo instancing
Seems to fix VR flickering bug.
Also:
* Add vertex lighting factor
* Remove clearcoat 10x factors
* Lighting factors now affect clearcoat
* Simplify `#pragma multi_compile` bits
Diffstat (limited to 'pbr.cginc')
| -rw-r--r-- | pbr.cginc | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -192,6 +192,7 @@ float4 getLitColor( normal = lerp(normal, spherical_normal, normals_mode == 1); UnityIndirect indirect_light; + vertexLightColor *= _Vertex_Lighting_Factor; indirect_light.diffuse = getIndirectDiffuse(vertexLightColor, normal); indirect_light.specular = getIndirectSpecular(view_dir, normal, smoothness, worldPos, uv); @@ -229,10 +230,6 @@ float4 getLitColor( } #endif - direct_light.color *= _Lighting_Factor * _Direct_Lighting_Factor * enable_direct; - indirect_light.specular *= _Lighting_Factor * _Indirect_Specular_Lighting_Factor; - indirect_light.diffuse *= _Lighting_Factor * _Indirect_Diffuse_Lighting_Factor; - if (_Reflection_Probe_Saturation < 1.0) { direct_light.color = RGBtoHSV(direct_light.color); direct_light.color[1] *= _Reflection_Probe_Saturation; @@ -249,6 +246,11 @@ float4 getLitColor( indirect_light.diffuse = clamp(indirect_light.diffuse, _Min_Brightness, _Max_Brightness); indirect_light.specular = clamp(indirect_light.specular, _Min_Brightness, _Max_Brightness); + // TODO move back before clamping + direct_light.color *= _Lighting_Factor * _Direct_Lighting_Factor * enable_direct; + indirect_light.specular *= _Lighting_Factor * _Indirect_Specular_Lighting_Factor; + indirect_light.diffuse *= _Lighting_Factor * _Indirect_Diffuse_Lighting_Factor; + // Apply AO indirect_light.diffuse *= ao; float3 direct_color = direct_light.color; @@ -303,7 +305,7 @@ float4 getLitColor( cc_LoH, cc_H); pbr.rgb += clearcoat * saturate(dot(i.normal, cc_L)) * - cc_mask * direct_color * 10; + cc_mask * direct_color * _Direct_Lighting_Factor; } // Indirect specular lighting #if 1 @@ -319,7 +321,7 @@ float4 getLitColor( in_LoH, in_H); pbr.rgb += clearcoat * saturate(dot(i.normal, in_L)) * - cc_mask * indirect_light.specular * 1; + cc_mask * indirect_light.specular * _Indirect_Specular_Lighting_Factor; } #endif #if defined(VERTEXLIGHT_ON) @@ -341,7 +343,7 @@ float4 getLitColor( vlh, vhalf); pbr.rgb += clearcoat * saturate(dot(i.normal, vl)) * - cc_mask * c * 10; + cc_mask * c * _Vertex_Lighting_Factor; } #endif #endif |
