Real-time rendering of seawater at Unity3d Mobile end

Source: Internet
Author: User

Real-time simulation of seawater is a relatively hot topic, mobile water simulation is hot heating, at present in this aspect of the research has been many, but the results are not very close, here we introduce a real-time rendering in the mobile algorithm, to meet the requirements of mobile operation, and can be displayed on the surface of the high-light, Reflection, as well as refraction effect, wave rolling effect and sea foam effect, as well as objects in the sea with the waves up and down the effect, more realistic simulation of the formation of the waves.

The generation of mobile waves is particularly limited, where mesh blocks are used to achieve unlimited terrain. GPU rendering also needs to enable it to run on the mobile side. Show it first:

650) this.width=650; "title=" 1.png "src=" Http://s3.51cto.com/wyfs02/M02/57/9E/wKioL1SgxkmxegvgAAJ0H1Mwx9A903.jpg " alt= "Wkiol1sgxkmxegvgaaj0h1mwx9a903.jpg"/>

Reflection, refraction, sea light are all there, and the foam effect is achieved.

The next step is to analyze how it is implemented.

First we want to customize the generation of mesh blocks, and then splice them together, generating a height graph, as shown in the grid.

650) this.width=650; "title=" 2.png "src=" Http://s3.51cto.com/wyfs02/M01/57/A1/wKiom1SgyeayMn7VAAS5bF7e79w079.jpg " alt= "Wkiom1sgyeaymn7vaas5bf7e79w079.jpg"/>

The code looks like this:

650) this.width=650; "title=" 3.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M02/57/A1/ Wkiom1sgylirxk40aapuru8jdgm806.jpg "alt=" Wkiom1sgylirxk40aapuru8jdgm806.jpg "/>

650) this.width=650; "title=" 4.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M00/57/9E/ Wkiol1sgywvtz1gfaaluhyxh2wo360.jpg "alt=" Wkiol1sgywvtz1gfaaluhyxh2wo360.jpg "/>

Next you need to render the surface highlights as follows:

650) this.width=650; "title=" 5.png "src=" Http://s3.51cto.com/wyfs02/M02/57/A1/wKiom1SgyqqjwOKLAAFrXYuegGE382.jpg " alt= "Wkiom1sgyqqjwoklaafrxyuegge382.jpg"/>

The code looks like this:

650) this.width=650; "title=" 6.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M02/57/A1/ Wkiom1sgy8bsn-a0aar6rhxx2pi751.jpg "alt=" Wkiom1sgy8bsn-a0aar6rhxx2pi751.jpg "/>

650) this.width=650; "title=" 7.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M00/57/9E/wKioL1SgzHjS_ Lgbaajht7ttpla752.jpg "alt=" Wkiol1sgzhjs_lgbaajht7ttpla752.jpg "/>

Because reflection and the effect rendering of refraction involve shader programming, we implement its code as follows:

650) this.width=650; "title=" 8.png "src=" Http://s3.51cto.com/wyfs02/M02/57/A1/wKiom1Sgzbziz6ywAAOAfCVHndY232.jpg " alt= "Wkiom1sgzbziz6ywaaoafcvhndy232.jpg"/>

The following implements the rolling and foaming of the waves:

650) this.width=650; "title=" 10.png "src=" http://s3.51cto.com/wyfs02/M01/57/A1/wKiom1Sgzpei4jO5AAKubwWpC-o550.jpg "alt=" Wkiom1sgzpei4jo5aakubwwpc-o550.jpg "/>

The implementation code is as follows:

650) this.width=650; "title=" 9.png "src=" Http://s3.51cto.com/wyfs02/M02/57/A1/wKiom1SgzrmymfD7AAOQkAa1Mys529.jpg " alt= "Wkiom1sgzrmymfd7aaoqkaa1mys529.jpg"/>

The above code is implemented using the Fourier algorithm, which sets its direction by enumeration.

Its rendering shader is as follows:

650) this.width=650; "title=" 11.png "src=" http://s3.51cto.com/wyfs02/M01/57/9E/wKioL1Sg0IKTrl9wAALtH0TCxgQ451.jpg "alt=" Wkiol1sg0iktrl9waalth0tcxgq451.jpg "/>

The above realizes the real-time simulation of the mobile seawater, and finally the display of running on the mobile phone:

650) this.width=650; "title=" 14.jpg "src=" http://s3.51cto.com/wyfs02/M02/57/A1/wKiom1Sg0K7TWMM7AAM2DQCqqig896.jpg "alt=" Wkiom1sg0k7twmm7aam2dqcqqig896.jpg "/>

This article is from the "Kaiyukan mobile" blog, so be sure to keep this source http://jxwgame.blog.51cto.com/943299/1597183

Real-time rendering of seawater at Unity3d Mobile end

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.