Closed stephen-hqxu closed 2 years ago
Here is a very simple demonstration of what the new rendering system can produce. Water is shaded similar to the terrain with normal mapping, specular highlight and aerial perspective; water is capable of receiving shadow but unsable to cast so.
The left and bottom part of the image has no reflection nor refraction due to the fact that ray travels beyond the screen. Also the reflection seems
The next screenshot shows the water plane culling mechanism. Water plane is discarded when it goes below the terrain or it is currently not in a watery biome. To avoid over-culling which causes water leakage, cullinig testing will be extended to some distance beyond the culling boundary.
The highlight in this release is the new water rendering component added to the scene.
Water is treated as a transparent object which is a newly added object type to
SuperRealism+
, it features a fully procedural animation and reflection as well as refraction.In addition, we have also improved the free-slip system to achieve a significant amount of performance improvement.
STPWater
The water object class is built based-on the terrain object
STPHeightfieldTerrain
as it shares most data with it.User should provide a water biome dictionary which allows looking up water level with biome ID to specify the placement of water plane. For biomes that do not require any water, it will be culled using the water plane culling algorithm. Water plane will then go through tessellation process similar to the terrain.
Water animation is achieved by using fractal of trigonometric functions, it is fast and does not require any noise function implementation. Finally water normal will be generated using the same animation function in the fragment shader before writing data to G-Buffer, and passed to deferred renderer.
STPBidirectionalScattering
This rendering component processes rendering queries for transparent objects, such as water.
It currently supports reflection and refraction with Fresnel effect using screen-space ray-marching which tries to detect the point on the screen where the reflected or refracted ray it hit. The final output is blended with light colour. The currently implementation still does not provide good quality for water and limitations can be enumerated, such as:
It has been realised that screen-space technique may not be suitable for procedural generation because there is no pre-baked lightmap or environment map available, I might just consider using global illumination in the future.
Free-slip Logic
We previously believed that linear copy is faster than 2D copy when transferring map data between host and device, therefore a lookup table is used to convert index space. Recent benchmark shows that 2D copy is marginally slower than linear copy, and lookup table causes major slowdown during erosion. Therefore the most sane way is to replaced the global-local index table with a simple 2D copy.
It has demonstrated that the performance is improved by at most 10 times.
Checklist
Water
BSDF
Others