Use ogre to make a highly efficient and beautiful water surface

Source: Internet
Author: User

In the past, the game's water surface practices were all texture animations implemented using sequence frames of many images. This method of Fixed rendering pipelines is particularly good at the lowest quality, however, for higher-level image quality, we should adopt a better surface.

Water surface rendering, ogre has a plug-in called hydrax, the effect is very good, but the efficiency is very low, there is no practical value. You have to make one by yourself.

In a beautiful 3D game, water wave simulation, bump mapping, reflection, refraction, fizol effect, underwater effect, etc. I am going to make some trade-offs to achieve high efficiency.

1) only the reflection is retained, and the refraction is removed. The camera angle is fixed because of the 2.5D game, and it does not need to be underwater.

2) Optimize the RTT rendering of the reflection and manually select which objects need to generate the reflection, which greatly reduces the rendering batches.

3) bump mapping uses the normal texture to calculate the illumination of the water surface.

4) the simulation of water waves is suitable for the sea and has little to do with it. The multi-sampling at different locations ensures the flow of water pattern.

5) Use a floating point to process water depth, improve accuracy, and ensure natural water depth transition.



Satisfactory results, natural water depth transition, sea water color, flow direction, texture size, etc. can be dynamically adjusted, and the efficiency is very high, only increasing the RTT overhead of a reflection, it also does not require art to provide sea water images, and shader computing is not complicated.


Material detail {// one upload {pass {diffuse 0.5 0.5 0.5 specular 1 1 1 leading off until {using worldviewprojmatrix extends eyeposition extends lightposition1 limit 1 param_named bumpscale float 0.35param _ named texturescale float2 1 bytes bumpspeed float2-0.025 bytes _ named_auto time limit 1001_param _ named ?float =_ named waveamp float 1.8} specify parameter {specify ambient parameter diffuseparameters limit specularparameters limit watercolor float4 0 0.6 0.7 1.0} // noisetexture_unit {// Perlin Noise volumetexture waves. DDS // min/MAG filtering, no mipfiltering linear none} // reflectiontexture_unit reflection {/will be filled in at runtimetexture reflectiontex_address_mode clamp}/2 pass, the height is calculated independently and is not affected by water depth, however, the highlights cannot be obscured by fog. technique {pass {commandid missing {commandid eyeposition was lightposition1 when 1 param_named bumpscale float Variable _ named texturescale float2 1 when bumpspeed float2-0.04 0.04param _ named_auto time limit 100w.param _ named limit float limit _ named waveamp float 1.8} specify limit {specify ambient limit deepcolor float4 0 0.3 0.5 1.0param _ named shallowcolor float4 0 1 1 1.0param _ named limit 1.0param _ named wateramount float 0.2} // noisetexture_unit {// Perlin Noise volumetexture waves. DDS // min/MAG filtering, no mipfiltering linear none} // reflectiontexture_unit reflection {/will be filled in at runtimetexture reflectiontex_address_mode clamp} // calculate the highlight separately, not affected by water depth pass {specular 1 1 1 commandid off commandid {{{%%eyeposition %lightposition1 %1 param_named bumpscale float 0.2param _ named texturescale float2 1 %bumpspeed float2-0.04 0.04par _ named_auto time time_0_x 1001_param _ named wavefreq float 0.028param _ named waveamp float 1.8} specify parameter {param_named_auto specularparameters parameter} // specify {// Perlin Noise volumetexture w. DDS // min/MAG filtering, no mipfiltering linear none }}// fixed pipeline technique {pass {ambient 0.588235 0.588235 0.588235 0.588235 1 diffuse 0.588235 0.588235 0.9 0.9 0.9 1 specular 20scene_blend effecondepth_write off texture_unit {anim_texture JPG _ sea water. DDS 28 2} texture_unit {texture water_depth.tga 1dcolour_op_ex source1 src_current ready one zeroalpha_op_ex modulate src_current ready 1tex_address_mode clampfiltering none }}}}

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.