commit e71b8e1b60965f0805bc71e9279014823a52ff32
parent 1a7f735de69ab7a15c8882be01da6e3fcb257e51
Author: Michael Savage <mikejsavage@gmail.com>
Date: Sat, 4 Nov 2017 15:37:51 +0200
Fix terrain height being slightly lower than reference
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shaders/clipmap.glsl b/shaders/clipmap.glsl
@@ -34,7 +34,7 @@ void main() {
vec2 xy = offset + position.xy * scale + camera_pos.xy;
vec2 snapped_xy = floor( xy / scale ) * scale;
vec2 uv = snapped_xy / textureSize( heightmap, 0 ) + 0.5;
- float z = 255.0 * texture( heightmap, uv ).r + texture( heightmap, uv ).g;
+ float z = 256.0 * texture( heightmap, uv ).r + texture( heightmap, uv ).g;
v2f.view_position = V * vec4( snapped_xy, z, 1.0 );
v2f.world_position = vec3( xy, z );