Because KSPs ocean causes issues with HDR (likely their 'infinite vertex' solution, resulting in degenerate triangles, which are finally causing NANs in the bloom filtering).
https://www.gamedev.net/articles/programming/graphics/rendering-water-as-a-post-process-effect-r2642/
https://www.gamasutra.com/view/feature/3036/deep_water_animation_and_rendering.php?print=1
- Distort surface normals and depth through procedural means
- This will generate a new offset world surface position; store the inverse offset from the undisturbed surface position.
- Write world-position to output buffer (surfacePosBuffer)
- Determine world-position hit of the ray cast through the surface (raymarch depth buffer?), write this into a new buffer (refractionHitPosBuffer) or more easily reconstructed later if it were encoded as a (refractionWorldSpaceOffsetBuffer) denoting the difference in refracted hit position vs. the sampled screenspace UV position.
- What to do about world-hit pixels that are out of current view?
- For kerbin/etc, can use the PQS heightmap data to get accurate raytrace info?
- The complete ray can then be reconstructed as surfacePos -> refractionHitPos or (surfacePos -> surfacePos + refractionOffset)
Calculation of tangent-frame for a position on a sphere:
- Assume equirectangular spherical UV mapping.
- Determine UV coordinate for the current position
- Offset UV.x by predetermined percentage of sphere (1/360?), sample world-position at that UV
- Offset UV.y by ?, sample world-position at that UV
- Use the set of three positions as three vertices of a triangle
- From there it is standard tangent/bitangent calculation bits from geometry shaders...
Because KSPs ocean causes issues with HDR (likely their 'infinite vertex' solution, resulting in degenerate triangles, which are finally causing NANs in the bloom filtering).
https://www.gamedev.net/articles/programming/graphics/rendering-water-as-a-post-process-effect-r2642/
https://www.gamasutra.com/view/feature/3036/deep_water_animation_and_rendering.php?print=1
Calculation of tangent-frame for a position on a sphere: