Skip to content

Commit

Permalink
Fixed an oversight with the face shadow softness
Browse files Browse the repository at this point in the history
I used a regular if else statement to test the softness to be above a certain threshold. This controlled whether or not the shader should step() the shadow region or if it should use it as it comes from the shadow_ndotl() function.
This wouldn't normally be a problem except that this is something that should ONLY be used when the material is toggled as a face material.
  • Loading branch information
Manashiku authored Apr 1, 2023
1 parent cfbb856 commit f87a9b9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions shader.fxsub
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,13 @@ float4 ps_model(vs_out i, float vface : VFACE, uniform bool backface_uv2) : COLO
shadow = (shadow - cont_shadow_dark) * (cont_shadow_bright + 1.0f) * (float3(cont_shadow_r, cont_shadow_g, cont_shadow_b) + 1.0f);
shadow_region.x = saturate(shadow_region.x);
float shadow_soft = FACE_SHADOW_SOFTNESS;
if(shadow_soft <= 0.045f)
{
#ifdef USE_FACE_SHADOW_MAP
shadow_region.x = step( 0.975f, shadow_region.x);
shadow = lerp(shadow, (float3)1.0f, step( 0.975f, shadow_region.x));
}
else
{
#else

shadow = lerp(shadow, (float3)1.0f, shadow_region.x);
}
#endif
// they dont do it like this in the game code but this is the easiest and thing im most used to
// shadow = shadow * saturate(model_color.xyz + 0.25f); // this will decrease the shadow brightness when the light color is decreased

Expand Down

0 comments on commit f87a9b9

Please sign in to comment.