renormalize world normal in pixel shader
parent
393b8bcb03
commit
f972392544
Binary file not shown.
|
@ -25,7 +25,7 @@ BEGIN_CONSTANTS
|
|||
float3 LightPositions[4] _ps(c4) _cb(c4);
|
||||
float3 PositionLightColors[4] _ps(c8) _cb(c8);
|
||||
|
||||
float3 LightDirections[4] _ps(c12) _cb(c12);
|
||||
float3 LightDirections[4] _ps(c12) _cb(c12);
|
||||
float3 DirectionLightColors[4] _ps(c16) _cb(c16);
|
||||
|
||||
float3 EyePosition _ps(c20) _cb(c20);
|
||||
|
@ -57,7 +57,7 @@ struct PixelShaderInput
|
|||
PixelShaderInput main_vs(VertexShaderInput input)
|
||||
{
|
||||
PixelShaderInput output;
|
||||
|
||||
|
||||
output.TexCoord = input.TexCoord;
|
||||
output.PositionWS = mul(input.Position, World).xyz;
|
||||
output.NormalWS = mul(input.Normal, (float3x3)WorldInverseTranspose).xyz;
|
||||
|
@ -155,14 +155,14 @@ float3 ComputeLight(
|
|||
}
|
||||
|
||||
float4 ComputeColor(
|
||||
float3 worldPosition,
|
||||
float3 worldNormal,
|
||||
float3 albedo,
|
||||
float metallic,
|
||||
float3 worldPosition,
|
||||
float3 worldNormal,
|
||||
float3 albedo,
|
||||
float metallic,
|
||||
float roughness
|
||||
) {
|
||||
float3 V = normalize(EyePosition - worldPosition);
|
||||
float3 N = worldNormal;
|
||||
float3 N = normalize(worldNormal);
|
||||
|
||||
float3 F0 = float3(0.04, 0.04, 0.04);
|
||||
F0 = lerp(F0, albedo, metallic);
|
||||
|
@ -204,7 +204,7 @@ float4 None(PixelShaderInput input) : SV_TARGET0
|
|||
{
|
||||
return ComputeColor(
|
||||
input.PositionWS,
|
||||
input.NormalWS,
|
||||
input.NormalWS,
|
||||
AlbedoValue,
|
||||
MetallicValue,
|
||||
RoughnessValue
|
||||
|
|
Loading…
Reference in New Issue