Add medium check to rain

This commit is contained in:
IsseW 2022-06-09 12:16:40 +02:00
parent ab707b6df1
commit 5b7b13adce
3 changed files with 9 additions and 4 deletions

View File

@ -114,7 +114,7 @@ void main() {
// of rain_dir this has issues with being in a place where it doesn't rain
// and seeing rain.
float rain = rain_density_at(cam_wpos.xy);
if (rain > 0.0) {
if (medium.x == MEDIUM_AIR && rain > 0.0) {
float rain_dist = 50.0;
for (int i = 0; i < 4; i ++) {
float old_rain_dist = rain_dist;

View File

@ -5641,7 +5641,11 @@ impl FigureMgr {
tick: u64,
camera_data: CameraData,
) {
span!(_guard, "render_rain_occlusion", "FigureManager::render_rain_occlusion");
span!(
_guard,
"render_rain_occlusion",
"FigureManager::render_rain_occlusion"
);
self.render_shadow_mapping(drawer, state, tick, camera_data, |state| {
state.can_occlude_rain()
})

View File

@ -1316,7 +1316,6 @@ impl<V: RectRasterableVol> Terrain<V> {
return min.partial_cmple(&max).reduce_and();
};
let (visible_light_volume, visible_psr_bounds) = if ray_direction.z < 0.0
&& renderer.pipeline_modes().shadow.is_map()
{
@ -1409,7 +1408,9 @@ impl<V: RectRasterableVol> Terrain<V> {
drop(guard);
span!(guard, "Rain occlusion magic");
// Check if there is rain near the camera
let max_weather = scene_data.state.max_weather_near(focus_off.xy() + cam_pos.xy());
let max_weather = scene_data
.state
.max_weather_near(focus_off.xy() + cam_pos.xy());
let (visible_occlusion_volume, visible_por_bounds) = if max_weather.rain > RAIN_THRESHOLD {
let visible_bounding_box = math::Aabb::<f32> {
min: math::Vec3::from(visible_bounding_box.min - focus_off),