Fixed occlusion bias

This commit is contained in:
Joshua Barretto 2022-07-10 16:56:45 +01:00
parent d4906f55bc
commit 4e854a28ff
3 changed files with 3 additions and 5 deletions

View File

@ -20,9 +20,7 @@ uniform u_rain_occlusion {
float rain_occlusion_at(in vec3 fragPos)
{
float bias = -0.2;
vec4 rain_pos = rain_occlusion_texture_mat * vec4(fragPos, 1.0) - vec4(0, 0, bias, 0);
vec4 rain_pos = rain_occlusion_texture_mat * vec4(fragPos, 1.0);
float visibility = textureProj(sampler2DShadow(t_directed_occlusion_maps, s_directed_occlusion_maps), rain_pos);

View File

@ -244,7 +244,7 @@ void main() {
drop_pos.z *= 0.5 + hash_fast(uvec3(cell2d, 0));
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 near_cell = (cell + 0.5 + (off - 0.5) * 0.5) / drop_density;

View File

@ -148,7 +148,7 @@ impl WeatherSim {
cell.rain = ((1.0 - pressure - RAIN_CLOUD_THRESHOLD).max(0.0)
* self.consts[point].humidity
* 2.5)
.powf(1.5);
.powf(0.75);
cell.wind = Vec2::new(
rain_nz.get(spos.into_array()).powi(3) as f32,
rain_nz.get((spos + 1.0).into_array()).powi(3) as f32,