I’m working on an application which has a large ocean. I did some research and the best visual -performance approach was working up something similar to the demo provided in the SDK. Everything works great and it looks amazing, but now I am trying to figure out a good way to create a wave effect for when the ocean moves up and down on the beach. Right now I have the plane moving up and down on the beach, but since it is made up of a few points, it doesnt look so great.
I’ve been considering using particle effects but would like something cheaper. The white paper that is provided with the demo mentions something about ‘fins’. I have no idea what that is in a reference to and was hoping someone could shed some light. Or any good way to create a wave / foam type effect that is fast and cheap!
Also the demos and tools that you guys provide are fantastic. Keep up the good work.
We decided to omit wave effects from the demo as it was too expensive on most devices when the demo was written. There are a number of ways to add waves, and the best suited to your use case depends on the balance between performance and visual quality/art style you are looking for.
1. Tessellate the water plane and transform vertices
In addition to the current effect (or instead of it) you could have more complex geometry for your water so that you can transform the positions of vertices within the plane to create waves. Two ways of doing this are to use a displacement map and vertex texture reads to displace the vertices, and another is to transform the vertices on the CPU and resubmit the updated vertex positions to the GPU. The displacement mapping approach is likely to be the cheapest technique, but it’s not as flexible as having the full control over vertex positions that you can have when editing them on the CPU. Transforming the vertex positions on the CPU would allow you to create crashing wave effects, but it can be quite difficult to achieve a realistic wave crash without drastically increasing the complexity and performance cost of the effect.
2. Use fins and/or particle effects along intersections
I’ve re-read the Water doc, and fins aren’t explained (i’ll file a bug for this to be updated). Fins in the sense the doc explains are similar to those used in many fur simulation techniques (search “Shells and fins” online and you can find some white papers). Basically, fins are simple geometry that can be placed along the edges of intersections. Similarly to fur effects, they are best placed along silhouettes. Particle effects can then be used in conjunction with fins to fill the gaps.
Particle effects can be fairly cheap, as long as you find a good balance between visual quality and the number of particles used. Also, you should avoid using alpha text/discard and favour alpha blending as this will be more much more efficient for the GPU to process.
Thanks for the praise. Appreciate the feedback
Thanks for the quick follow up. I spent some time researching shells and fins. It’s pretty interesting. For now I’m leaning more towards the alpha blending with particle effect. Once I get some benchmarks on performance, maybe i will add something like that in. Thanks for the advice and quick response.