Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/TeamWisp/WispRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
VZout committed May 6, 2019
2 parents 7697df8 + 642342f commit a900d67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion resources/shaders/path_tracer.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ void RaygenEntry()
float3 cpos = float3(inv_view[0][3], inv_view[1][3], inv_view[2][3]);
float3 V = normalize(cpos - wpos);

normal = lerp(normal, -normal, dot(normal, V) < 0);

float3 result = float3(0, 0, 0);

nextRand(rand_seed);
Expand Down Expand Up @@ -323,7 +325,7 @@ void ReflectionHit(inout HitInfo payload, in MyAttributes attr)

//float3 fN = N;
float3 fN = normalize(mul(output_data.normal, TBN));
if (dot(fN, V) <= 0.0f) fN = -fN;
fN = lerp(fN, -fN, dot(fN, V) < 0);

// Irradiance
#ifdef OLDSCHOOL
Expand Down
2 changes: 1 addition & 1 deletion resources/shaders/raytracing.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void ClosestHitEntry(inout HitInfo payload, in MyAttributes attr)
const float3x3 TBN = float3x3(T, B, N);

float3 fN = normalize(mul(output_data.normal, TBN));
if (dot(fN, V) <= 0.0f) fN = -fN;
fN = lerp(fN, -fN, dot(fN, V) < 0);

// Irradiance
float3 flipped_N = fN;
Expand Down
4 changes: 3 additions & 1 deletion resources/shaders/rt_hybrid.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ void RaygenEntry()
return;
}

normal = lerp(normal, -normal, dot(normal, V) < 0);

// Describe the surface for mip level generation
SurfaceHit sfhit;
sfhit.pos = wpos;
Expand Down Expand Up @@ -292,7 +294,7 @@ void ReflectionHit(inout ReflectionHitInfo payload, in MyAttributes attr)
float3x3 TBN = float3x3(T, B, N);

float3 fN = normalize(mul(output_data.normal, TBN));
if (dot(fN, V) <= 0.0f) fN = -fN;
fN = lerp(fN, -fN, dot(fN, V) < 0);

//Shading
float3 flipped_N = fN;
Expand Down

0 comments on commit a900d67

Please sign in to comment.