-
Notifications
You must be signed in to change notification settings - Fork 69
Underwater Camera Roadmap
Turbidity and light attenuation are important underwater effects that give water its volume. In order to get some effects (volumetric shadows, god rays, etc…) working, water must be rendered as a volume / participating medium.
It becomes much more difficult to see at depths so a light source near the camera may need to be implemented. Attenuation and in-scattering can be adjusted to an amount that doesn’t degrade visibility at depths.
Create a fragment shader that calculates the in-scattering between the camera and the current fragment. Calculate the reflectance of the fragment surface and combine the two calculations to get the output color.
Reflections from particles / dust floating around in water produces backscatter. To best demonstrate the effect, the particles should be animated and should also have their reflections attenuated.
To simulate movement, one will create multiple different animated textures that contain backscatter with a transparent background. After rendering the scene normally, a subpass will be created that will render multiple spheres with the backscatter texture applied. The spheres should be rendered around the camera with increasing radii. As the camera moves around, the sphere that has just been passed through by the camera will be repositioned and rescaled. With proper fading values, the transition between spheres will be seamless.
Before the renderpass, generate a group of primitives that will represent the particles in the backscatter. Add a subpass after the original renderpass that will render the generated primitives with a given shader.
Since the turbidity effect renders water as a volume, lights should be able to cast shadows on the volume.
A simple solution is to add a hue compositor, but in order to get a physically accurate representation of color distortion, one would need to calculate the water light absorption given a wavelength. This approach is more viable through ray tracing and monte carlo sampling but will be much harder to implement through a raster engine.
Camera distortion is already implemented in both Gazebo Classic and Ignition. Parameters can set the lens to have a barrel or pincushion distortion.
To create either a pincushion or barrel distortion, adjust the SDF distortion values for the camera.