mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Faster sub-voxel noise function
This commit is contained in:
parent
628dc7c47e
commit
cd925e8cea
@ -33,7 +33,7 @@ float snoise(in vec4 x) {
|
||||
}
|
||||
|
||||
vec3 rand_perm_3(vec3 pos) {
|
||||
return sin(pos * vec3(1473.7 * pos.z + 472.3, 8891.1 * pos.x + 723.1, 3813.3 * pos.y + 982.5));
|
||||
return abs(sin(pos * vec3(1473.7 * pos.z + 472.3, 8891.1 * pos.x + 723.1, 3813.3 * pos.y + 982.5)));
|
||||
}
|
||||
|
||||
vec4 rand_perm_4(vec4 pos) {
|
||||
|
@ -48,7 +48,7 @@ void main() {
|
||||
diffuse_light *= f_light * ao;
|
||||
diffuse_light += point_light * ao;
|
||||
|
||||
vec3 col = f_col + snoise(vec4(mod(floor(f_pos * 3.0), 100.0) * 10.0, 0)) * 0.02; // Small-scale noise
|
||||
vec3 col = f_col + hash(vec4(mod(floor(f_pos * 3.0), 100.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);
|
||||
|
Loading…
Reference in New Issue
Block a user