mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
510fce9af3
# Objective - The goal of this PR is to make it possible to move the density texture of a `FogVolume` over time in order to create dynamic effects like fog moving in the wind. - You could theoretically move the `FogVolume` itself, but this is not ideal, because the `FogVolume` AABB would eventually leave the area. If you want an area to remain foggy while also creating the impression that the fog is moving in the wind, a scrolling density texture is a better solution. ## Solution - The PR adds a `density_texture_offset` field to the `FogVolume` component. This offset is in the UVW coordinates of the density texture, meaning that a value of `(0.5, 0.0, 0.0)` moves the 3d texture by half along the x-axis. - Values above 1.0 are wrapped, a 1.5 offset is the same as a 0.5 offset. This makes it so that the density texture wraps around on the other side, meaning that a repeating 3d noise texture can seamlessly scroll forever. It also makes it easy to move the density texture over time by simply increasing the offset every frame. ## Testing - A `scrolling_fog` example has been added to demonstrate the feature. It uses the offset to scroll a repeating 3d noise density texture to create the impression of fog moving in the wind. - The camera is looking at a pillar with the sun peaking behind it. This highlights the effect the changing density has on the volumetric lighting interactions. - Temporal anti-aliasing combined with the `jitter` option of `VolumetricFogSettings` is used to improve the quality of the effect. --- ## Showcase https://github.com/user-attachments/assets/3aa50ebd-771c-4c99-ab5d-255c0c3be1a8 |
||
---|---|---|
.. | ||
3d_scene.rs | ||
3d_shapes.rs | ||
3d_viewport_to_world.rs | ||
animated_material.rs | ||
anisotropy.rs | ||
anti_aliasing.rs | ||
atmospheric_fog.rs | ||
auto_exposure.rs | ||
blend_modes.rs | ||
bloom_3d.rs | ||
clearcoat.rs | ||
color_grading.rs | ||
deferred_rendering.rs | ||
depth_of_field.rs | ||
fog.rs | ||
fog_volumes.rs | ||
generate_custom_mesh.rs | ||
irradiance_volumes.rs | ||
lighting.rs | ||
lightmaps.rs | ||
lines.rs | ||
load_gltf.rs | ||
load_gltf_extras.rs | ||
meshlet.rs | ||
motion_blur.rs | ||
orthographic.rs | ||
parallax_mapping.rs | ||
parenting.rs | ||
pbr.rs | ||
post_processing.rs | ||
reflection_probes.rs | ||
render_to_texture.rs | ||
rotate_environment_map.rs | ||
scrolling_fog.rs | ||
shadow_biases.rs | ||
shadow_caster_receiver.rs | ||
skybox.rs | ||
spherical_area_lights.rs | ||
split_screen.rs | ||
spotlight.rs | ||
ssao.rs | ||
ssr.rs | ||
texture.rs | ||
tonemapping.rs | ||
transmission.rs | ||
transparency_3d.rs | ||
two_passes.rs | ||
update_gltf_scene.rs | ||
vertex_colors.rs | ||
visibility_range.rs | ||
volumetric_fog.rs | ||
wireframe.rs |