mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed sub-voxel noise flickering on NVIDIA cards
This commit is contained in:
parent
514281c837
commit
7edd0e701c
@ -4,6 +4,7 @@
|
||||
#include <random.glsl>
|
||||
|
||||
in vec3 f_pos;
|
||||
in vec3 f_chunk_pos;
|
||||
flat in uint f_pos_norm;
|
||||
in vec3 f_col;
|
||||
in float f_light;
|
||||
@ -48,7 +49,7 @@ void main() {
|
||||
diffuse_light *= f_light * ao;
|
||||
diffuse_light += point_light * ao;
|
||||
|
||||
vec3 col = f_col + hash(vec4(mod(floor(f_pos * 3.0), 100.0) * 10.0, 0)) * 0.02; // Small-scale noise
|
||||
vec3 col = f_col + hash(vec4(floor(mod(f_chunk_pos, 100.0) * 3.0) * 10.0, 0)) * 0.02; // Small-scale noise
|
||||
vec3 surf_color = illuminate(srgb_to_linear(col), light, diffuse_light, ambient_light);
|
||||
|
||||
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);
|
||||
|
@ -13,6 +13,7 @@ uniform u_locals {
|
||||
};
|
||||
|
||||
out vec3 f_pos;
|
||||
out vec3 f_chunk_pos;
|
||||
flat out uint f_pos_norm;
|
||||
out vec3 f_col;
|
||||
out float f_light;
|
||||
@ -21,7 +22,8 @@ out float f_ao;
|
||||
const float EXTRA_NEG_Z = 65536.0;
|
||||
|
||||
void main() {
|
||||
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z) + model_offs;
|
||||
f_chunk_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z);
|
||||
f_pos = f_chunk_pos + model_offs;
|
||||
|
||||
f_pos.z -= 250.0 * (1.0 - min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0));
|
||||
f_pos.z -= 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0);
|
||||
|
Loading…
Reference in New Issue
Block a user