Hey guys and girls, I have to code 3D water, and I can't think of an Idea.
I'm currently using Unity and reading stuff for meshes in Unity and to be honest, I'm not getting anywhere far with the Unity mesh architecture, but I'll get there... (ASAP)
So my problem is that I don't have so much experiance with 3D graphics programming, but I have my linear math skills.
I need to code water, with waves and splashesh with particles etc.
But I have no idea how to code water behaviour in 3D.. (I have few ideas, but they are far from the reality)
If you people know good tutorials and books about water behaviour and water coding I would be very happy.. xD

Back in the day, I created some water effects (and other similar effects) using Perlin Noise. There are also alternatives to that classic method, but the general idea is the same. You can generate textures, height-maps (almost-flat mesh, with a regular x-y grid), and/or bump-maps (a texture that is used as "bumps" instead of colors).

The nice thing with these "noise" methods is that they are adjustible and additive. So, for example, you could have a height-map that contains only the most visible waves (low freq., high amplitude), and on top of that, a texture and bump-map for smaller ripples.

To make things dynamic (moving with time), the simplest method is just to generate the textures / maps at regular intervals (e.g., once or twice per second), and interpolate (e.g., through a pixel / vertex shader) continuously between the last and the next model. That has worked out very well for me back in the day (more than a decade ago), and as far as I know, this is still a popular method (it's just that now, you can do it with much more detail and depth that I used to be able to do it with the older hardware).

Also, for water, you have to remember that specular reflection (mirror-like reflection) is very important to really achieve the perfect effect. And bump mapping also becomes even more important when specular reflection is applied.

If I were you, I would say, just go step by step. First try to generate some "noise" texture. Then, try to add some structured waves to it. Then, try to give it movement (animate the texture). Then, try to render the structured waves as a height-map, with the noisy texture applied to it. Then, try to add bump mapping, and specular reflection (which is easy).

Here is a nice tutorial on Perlin Noise, it's a bit old, but nice. Here is a more up-to-date tutorial. Perlin noise (and related techniques) is really awesome because you can really generate almost any "natural" thing with it.

As for doing the water splashing... well, that requires a particle system. This is another totally different topic, and also an interesting one. I recommend that you first worry about creating a nice, moving, reflecting, water surface, and then, worry about implementing a particle system (or using one that is already a part of Unity, I mean, most of the stuff you are asking for (water and splashing) is probably already part of Unity, so, pick what you want to work on, and use unity features for the rest).

Thank you very much, I will start reading right away!
I really like the highmap idea, and Unity supports it so for now I'm saved. I'm going step by step just as you said. :)
And the particle system, this is actually my diploma project, to make a particle system for splashing, but first I wanted to make water effects on my own.
Thank you very much. :)
If someone else wants to share I'll always accept more solutions. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.