Skip to content

Commit

Permalink
glsl: fix heightmap orientation, black is low and white is high
Browse files Browse the repository at this point in the history
there is only one heightmap standard: black is
low and white is high

xreal was doing white is low and black is high
for heightmap in alpha channel of normal map
but was doing black is low and white is high
for heightmap in loose file which does not
make sense

in any way daemon seems to have been forked
before the addition of shader keywords to
support heightmap loose file so only heightmap
in alpha channel is supported at this point
  • Loading branch information
illwieckz committed Feb 27, 2019
1 parent be89425 commit 2b2648e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/forwardLighting_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ void main()
Vts = normalize(Vts);

// size and start position of search in texture space
vec2 S = Vts.xy * -u_DepthScale / Vts.z;
vec2 S = Vts.xy * u_DepthScale / Vts.z;

float depth = RayIntersectDisplaceMap(texNormal, S, u_NormalMap);

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/lightMapping_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void main()
V = normalize(V);

// size and start position of search in texture space
vec2 S = V.xy * -u_DepthScale / V.z;
vec2 S = V.xy * u_DepthScale / V.z;

#if 0
vec2 texOffset = vec2(0.0);
Expand Down
4 changes: 2 additions & 2 deletions src/engine/renderer/glsl_source/liquid_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ void main()
// ray intersect in view direction

// size and start position of search in texture space
//vec2 S = V.xy * -u_DepthScale / V.z;
vec2 S = V.xy * -0.03 / V.z;
//vec2 S = V.xy * u_DepthScale / V.z;
vec2 S = V.xy * 0.03 / V.z;

float depth = RayIntersectDisplaceMap(texNormal, S);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void main()
Vts = normalize(Vts);

// size and start position of search in texture space
vec2 S = Vts.xy * -u_DepthScale / Vts.z;
vec2 S = Vts.xy * u_DepthScale / Vts.z;

#if 0
vec2 texOffset = vec2(0.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void main()
Vts = normalize(Vts);

// size and start position of search in texture space
vec2 S = Vts.xy * -u_DepthScale / Vts.z;
vec2 S = Vts.xy * u_DepthScale / Vts.z;

#if 0
vec2 texOffset = vec2(0.0);
Expand Down

0 comments on commit 2b2648e

Please sign in to comment.