Skip to content

Commit

Permalink
Update PS_Diffuse.hlsl
Browse files Browse the repository at this point in the history
  • Loading branch information
Serbernus authored Mar 13, 2024
1 parent 6933f16 commit 361804d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions D3D11Engine/Shaders/PS_Diffuse.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ DEFERRED_PS_OUTPUT PSMain( PS_INPUT Input ) : SV_TARGET
fx = TX_Texture2.Sample(SS_Linear, Texcoord);
#endif

float4 color = TX_Texture0.Sample(SS_Linear, Texcoord);

// Apply normalmapping if wanted
#if NORMALMAPPING == 1
nrm = perturb_normal(Input.vNormalVS, Input.vViewPosition, TX_Texture1, Texcoord, SS_Linear, MI_NormalmapStrength);
#endif

float4 color = TX_Texture0.Sample(SS_Linear, Texcoord);

// Do alphatest if wanted
#if ALPHATEST == 1
ClipDistanceEffect(length(Input.vViewPosition), DIST_DrawDistance, color.r * 2 - 1, 500.0f);
Expand All @@ -262,13 +262,13 @@ DEFERRED_PS_OUTPUT PSMain( PS_INPUT Input ) : SV_TARGET
#endif

float specular = SPECULAR_MULT * fx.r;
float roughness = ROUGHNESS_MULT * clamp((ceil(fx.g) - fx.g), 0.0f, 1.0f);
float roughness = ROUGHNESS_MULT * (ceil(fx.g) - fx.g);

DEFERRED_PS_OUTPUT output;
output.vDiffuse = float4(color.rgb, Input.vDiffuse.y);

output.vNrm = float4(nrm.xyz, 1.0f);

output.vSI_SP.xy = float2(specular, roughness);
output.vSI_SP = float2(specular, roughness);
return output;
}

2 comments on commit 361804d

@lucifer602288
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged into repository https://github.com/Kirides/GD3D11
Do you have roughness/parallax materials to test?

@lucifer602288
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last shader version has a bug inside buildings / caves. It creates a dark circle area around player:
kirides#162

Please sign in to comment.