flip input normals to treat backfaces like normal
This commit is contained in:
parent
ffc9e3fecb
commit
9aeafa7ba0
1 changed files with 3 additions and 2 deletions
|
@ -24,7 +24,8 @@ psIn vs(vsIn input, uint id : SV_InstanceID) {
|
|||
float3 world = mul(float4(input.pos.xyz, 1), sk_inst[id].world).xyz;
|
||||
o.pos = mul(float4(world, 1), sk_viewproj[o.view_id]);
|
||||
|
||||
float3 normal = normalize(mul(input.norm, (float3x3)sk_inst[id].world));
|
||||
// flip input normals to treat backfaces like normal
|
||||
float3 normal = normalize(mul(-input.norm, (float3x3)sk_inst[id].world));
|
||||
|
||||
|
||||
float3 norm_shade = float3(0.5) + (normal * 0.5);
|
||||
|
@ -34,7 +35,7 @@ psIn vs(vsIn input, uint id : SV_InstanceID) {
|
|||
|
||||
// rim lighting
|
||||
float rim = 1.0 - saturate(dot(normalize(view_dir), normal));
|
||||
o.color = float4(norm_shade * rim * rim * 0.2, 1);
|
||||
o.color = float4(norm_shade * rim * rim * 0.0666, 1);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue