Skip to content

Commit

Permalink
Fixed in all shaders: unclamped values in lighting pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Melioli committed Sep 23, 2024
1 parent 4b52149 commit b1bccaa
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ float4 ps_model(vs_out i, bool vface : SV_ISFRONTFACE) : SV_TARGET
float3 shadow_area = (float3)1.0f;
shadow_area = shadow_area_transition(lightmap.y, i.v_col.x, ndotl, material_id);
// metalshadow = shadow_area_transition(lightmapao, vertexao, ndotl, material_id);
if(_UseFaceMapNew) shadow_area = ndotl;
if(_UseFaceMapNew) shadow_area = saturate(ndotl);
// shadow = outshadow;

float bright = lightmap.y > 0.9f && !_UseFaceMapNew;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ float4 ps_model (vs_out i, bool vface : SV_ISFRONTFACE) : SV_Target
#endif
#ifdef _IS_PASS_LIGHT
float light_intesnity = max(0.001f, (0.299f * _LightColor0.r + 0.587f * _LightColor0.g + 0.114f * _LightColor0.b));
float3 light_pass_color = ((diffuse.xyz * 5.0f) * _LightColor0.xyz) * atten * light_shadow * 0.5f;
float3 light_pass_color = ((diffuse.xyz * 5.0f) * _LightColor0.xyz) * atten * saturate(light_shadow) * 0.5f;
float3 light_color = lerp(light_pass_color.xyz, lerp(0.0f, min(light_pass_color, light_pass_color / light_intesnity), _WorldSpaceLightPos0.w), _FilterLight); // prevents lights from becoming too intense
#if defined(POINT) || defined(SPOT)
out_col.xyz = (light_color) * 0.5f;
Expand Down
2 changes: 1 addition & 1 deletion Shaders/Honkai Impact/Includes/Part2-program.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ float4 ps_model(vs_out i, bool vface : SV_ISFRONTFACE) : SV_TARGET
}
float light_intesnity = max(0.001f, (0.299f * _LightColor0.r + 0.587f * _LightColor0.g + 0.114f * _LightColor0.b));
shaded_area.x = smoothstep(0.0f, 0.5f, shaded_area.x) * 0.8f + 0.1f;
float3 light_pass_color = ((diffuse.xyz * 5.0f) * _LightColor0.xyz) * atten * shaded_area.x * 0.5f;
float3 light_pass_color = ((diffuse.xyz * 5.0f) * _LightColor0.xyz) * atten * saturate(shaded_area.x) * 0.5f;
float3 light_color = lerp(light_pass_color.xyz, lerp(0.0f, min(light_pass_color, light_pass_color / light_intesnity), _WorldSpaceLightPos0.w), _FilterLight); // prevents lights from becoming too intense
#if defined(POINT) || defined(SPOT)
color.xyz = (light_color) * 0.5f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ float4 ps_base(vs_out i, bool vface : SV_IsFrontFace) : SV_Target
#endif

float light_intesnity = max(0.001f, (0.299f * _LightColor0.r + 0.587f * _LightColor0.g + 0.114f * _LightColor0.b));
float3 light_pass_color = ((diffuse.xyz * 1.0f) * _LightColor0.xyz) * atten * shadow_area;
float3 light_pass_color = ((diffuse.xyz * 1.0f) * _LightColor0.xyz) * atten * saturate(shadow_area);
float3 light_color = lerp(light_pass_color.xyz, lerp(0.0f, min(light_pass_color, light_pass_color / light_intesnity), _WorldSpaceLightPos0.w), _FilterLight); // prevents lights from becoming too intense
#if defined(POINT) || defined(SPOT)
out_color.xyz = (light_color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ fixed4 ps_model (vertex_out i) : SV_Target
shadow_area = saturate(pow(shadow_area, 5.0f));
if(_MaterialType == 1) shadow_area = smoothstep(0.0, 0.5, saturate(dot(normal, light)));
float light_intesnity = max(0.001f, (0.299f * _LightColor0.r + 0.587f * _LightColor0.g + 0.114f * _LightColor0.b));
float3 light_pass_color = ((diffuse.xyz * 5.0f) * _LightColor0.xyz) * atten * shadow_area * 0.5f;
float3 light_pass_color = ((diffuse.xyz * 5.0f) * _LightColor0.xyz) * atten * saturate(shadow_area) * 0.5f;
float3 light_pass_a_color = lerp(light_pass_color.xyz, lerp(0.0f, min(light_pass_color, light_pass_color / light_intesnity), _WorldSpaceLightPos0.w), _FilterLight); // prevents lights from becoming too intense
if(_MaterialType == 6) light_pass_a_color = float3(0.0f, 0.0f, 0.0f);
#if defined(POINT) || defined(SPOT)
Expand Down

0 comments on commit b1bccaa

Please sign in to comment.