mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed occlusion bias
This commit is contained in:
parent
d4906f55bc
commit
4e854a28ff
@ -20,9 +20,7 @@ uniform u_rain_occlusion {
|
|||||||
|
|
||||||
float rain_occlusion_at(in vec3 fragPos)
|
float rain_occlusion_at(in vec3 fragPos)
|
||||||
{
|
{
|
||||||
float bias = -0.2;
|
vec4 rain_pos = rain_occlusion_texture_mat * vec4(fragPos, 1.0);
|
||||||
|
|
||||||
vec4 rain_pos = rain_occlusion_texture_mat * vec4(fragPos, 1.0) - vec4(0, 0, bias, 0);
|
|
||||||
|
|
||||||
float visibility = textureProj(sampler2DShadow(t_directed_occlusion_maps, s_directed_occlusion_maps), rain_pos);
|
float visibility = textureProj(sampler2DShadow(t_directed_occlusion_maps, s_directed_occlusion_maps), rain_pos);
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ void main() {
|
|||||||
drop_pos.z *= 0.5 + hash_fast(uvec3(cell2d, 0));
|
drop_pos.z *= 0.5 + hash_fast(uvec3(cell2d, 0));
|
||||||
vec3 cell = vec3(cell2d, floor(drop_pos.z * drop_density.z));
|
vec3 cell = vec3(cell2d, floor(drop_pos.z * drop_density.z));
|
||||||
|
|
||||||
if (fract(hash(fract(vec4(cell, 0) * 0.01))) < rain_density * rain_occlusion_at(f_pos.xyz) * 2.0) {
|
if (fract(hash(fract(vec4(cell, 0) * 0.01))) < rain_density * rain_occlusion_at(f_pos.xyz + vec3(0, 0, 0.25)) * 2.0) {
|
||||||
vec3 off = vec3(hash_fast(uvec3(cell * 13)), hash_fast(uvec3(cell * 5)), 0);
|
vec3 off = vec3(hash_fast(uvec3(cell * 13)), hash_fast(uvec3(cell * 5)), 0);
|
||||||
vec3 near_cell = (cell + 0.5 + (off - 0.5) * 0.5) / drop_density;
|
vec3 near_cell = (cell + 0.5 + (off - 0.5) * 0.5) / drop_density;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ impl WeatherSim {
|
|||||||
cell.rain = ((1.0 - pressure - RAIN_CLOUD_THRESHOLD).max(0.0)
|
cell.rain = ((1.0 - pressure - RAIN_CLOUD_THRESHOLD).max(0.0)
|
||||||
* self.consts[point].humidity
|
* self.consts[point].humidity
|
||||||
* 2.5)
|
* 2.5)
|
||||||
.powf(1.5);
|
.powf(0.75);
|
||||||
cell.wind = Vec2::new(
|
cell.wind = Vec2::new(
|
||||||
rain_nz.get(spos.into_array()).powi(3) as f32,
|
rain_nz.get(spos.into_array()).powi(3) as f32,
|
||||||
rain_nz.get((spos + 1.0).into_array()).powi(3) as f32,
|
rain_nz.get((spos + 1.0).into_array()).powi(3) as f32,
|
||||||
|
Loading…
Reference in New Issue
Block a user