[Blog recommendations] Unity3D mobile terminal real-time sea water Rendering
This blog post is from the jxw167 blogger of BKJIA. If you have any questions, go to the blog homepage for an interactive discussion!
Blog: http://jxwgame.blog.51cto.com/943299/1597183
Real-time Simulation of sea water has always been a hot topic. The simulation of mobile-end sea water is hot. At present, there have been a lot of research in this area, but the results are not very satisfactory, here we will introduce an algorithm for real-time rendering on mobile terminals, which meets the running requirements of mobile terminals and can display highlights, reflections, and refraction effects on the sea surface, the rolling effect of the waves, the bubble effect on the sea, and the effect of the objects on the sea that are under and under the waves, truly simulate the formation of the waves.
The generation of waves at the mobile end is particularly limited. Here we use grid blocks to splice them to achieve infinite terrain. GPU rendering also needs to be able to run on the Mobile End. First, we will show it:
Reflection, refraction, and sea-level illumination are available, and the foam effect is achieved.
Next, we will analyze how it is implemented.
First, we need to customize the generation of grid blocks, and then splice them to generate a height chart, as shown in the grid.
The Code is as follows:
The following figure shows the rendering of the Sea highlight:
The Code is as follows:
Because the rendering of reflection and refraction involves the Shader programming, we implement the Code as follows:
The following shows how to roll and bubble the waves:
The implementation code is as follows:
The above code is implemented using the Fourier algorithm, and its direction is set through enumeration.
The rendering Shader is as follows:
The above shows the real-time simulation of the mobile terminal sea water, and finally shows the operation on the mobile phone: