FFTOcean is one of the most complex challenges I’ve faced in my game development career. This project involves multiple technical aspects, including ocean simulation, Fourier transform algorithms, projected grids, rendering pipeline planning, and water lighting simulation. In particular, improper handling of the MRT texture rendering and RenderPass operation flow can lead to performance issues. The main goal of this project is to ensure smooth operation on mobile platforms.
From left to right, and top to bottom, the first four images are displacement maps, followed by two slope maps, and the final one is a Jacobian foam map. The entire process uses Fourier transform to calculate the RenderTexture results.
To support ScreenSpaceDecals, it’s necessary to generate depth textures for the ocean. Considering that this project will run on platforms supporting OpenGLES 3.0 and above, we adopted the CopyDepthPass approach. However, since this method causes issues when running in the Editor (which uses its own independent RenderTexture), we implemented AppendDepthPass to address the problem.
Another noteworthy aspect is the integration of planar reflection textures in the distance. The rendering result transitions to the reflection based on the camera’s distance, achieving a seamless blend with the sky at far distances and avoiding visible edge lines.
In the image above, there is no visible edge line where the ocean surface meets the skybox.
As for the lighting effects, standard BRDF is used with no particular differences. However, it’s worth mentioning that sub-surface scattering is simulated here, resulting in a gem-like green tint visible on the water surface.
Throughout the implementation process, Ceto and CRest provided a wealth of reference material. You can find their GitHub links below:
沒有留言:
張貼留言