jbouny / ocean

Realistic water shader for Three.js

Home Page:http://jeremybouny.fr/ocean/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mirror Fog

titansoftime opened this issue · comments

commented

The reflected elements do not have fog applied to them. At least not when using FogExp2, not sure about regular Fog.

The problem is due to the fact that the frustum of the mirrored camera correspond to the water plane.

The distance taken into account to compute the fog is the distance between the object and the plane, instead of the distance to the camera.

I currently really don't know how to fix this problem ... This problem will be the same on the basic Mirror of three.js.

A hacky solution is to multiply the scene fog by some factor before rendering water then restoring it before rendering the scene. This fades the objects out as you move deeper into the surface of the water, but does not color the objects correctly as the problem states is the main issue.

@jbouny what about a vignette shader applied to the generated mirror texture, just acting on left, top and right side of the texture?, with a radius proportionally corresponding to normalized fog near / far distance relative to camera near / far values, and the color of the vignette would be the same of the fog.