Jump to content

  • Log In with Google      Sign In   
  • Create Account

Normal mapped water is awesome


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 george7378   Members   -  Reputation: 1290

Like
2Likes
Like

Posted 23 May 2013 - 08:01 AM

Well, I've been practicing a lot with HLSL lately, and I've always wanted to make some decent water. I tried the usual technique of animated normal maps, and it's awesome! I'm using the same normal map tiled twice, with different texture coordinates each time, which removes the need for two different normal maps.

 

WaterNMap2.jpg

 

WaterNMap1.jpg

 

Anyway, just thought I'd make this post because I'm pretty pleased with the results.

 

Also, here's a video (probably more useful!):

 


Edited by george7378, 23 May 2013 - 08:35 AM.


Sponsor:

#2 george7378   Members   -  Reputation: 1290

Like
2Likes
Like

Posted 26 May 2013 - 03:05 PM

Might aswell add this in here too - the same program but with refraction modelled too:

 



#3 Kryzon   Prime Members   -  Reputation: 3314

Like
0Likes
Like

Posted 26 May 2013 - 06:14 PM

Can you describe in more detail the refraction part of the technique?



#4 george7378   Members   -  Reputation: 1290

Like
1Likes
Like

Posted 27 May 2013 - 02:38 PM

Sure, the process is:

 

1. Render the container (and anything else that is fully or partially immersed in the water) to an offscreen texture (same size/format as the back buffer - basically a copy of what you see on the screen). This is the refraction map, which you later apply to the plane of the water.

 

2. Render the plane using normal mapping, and apply the texture you previously stored to it. The refraction is simply determined by how you sample the texture - to create the effect I add on the xz components of the normal vector to the texture coordinates. This way, you sample from the texture based on the curvature of the water at that point in the pixel shader.

 

It's not 'true' refraction (it doesn't use raytracing) but it creates exactly the same effect as you'd see, with small differences.

 

Here's a proper tutorial: http://www.rastertek.com/dx10tut29.html



#5 george7378   Members   -  Reputation: 1290

Like
1Likes
Like

Posted 03 June 2013 - 05:40 PM

...and I might aswell share the 'final' version - now with reflections and the Fresnel term for lerping between reflection and refraction:

 

 

This is the last one, I promise ;)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS