OpenGL Water Tutorial 8: Soft Edges (FINAL)

Channel:
Subscribers:
244,000
Published on ● Video Link: https://www.youtube.com/watch?v=qgDPSnZPGMA



Category:
Tutorial
Duration: 13:10
38,966 views
667


Final episode of the tutorial series about programming 3D water using OpenGL!

Smoothing up those hard water edges this week!

DuDv Map and Normal Map:
https://www.dropbox.com/sh/z21kj5s448vzfql/AADy_KocZ6gDgK1lYjv7_SBAa?dl=0

Conversion Code:
https://www.dropbox.com/s/4b0xv8crvn68ip5/Conversion%20Code.txt?dl=0

Conversion Explanations:
http://web.archive.org/web/20130416194336/http://olivers.posterous.com/linear-depth-in-glsl-for-real
http://stackoverflow.com/questions/6652253/getting-the-true-z-value-from-the-depth-buffer

gl_FragCoord:
https://www.opengl.org/sdk/docs/man/html/gl_FragCoord.xhtml

One thing I didn't mention: if you want to make deeper water look murky then you can add something like this into the fragment shader:
refractColour = mix(refractColour, murkyWaterColour, clamp(waterDepth/60.0, 0.0, 1.0));


Common Problems:

-If the edges of the water quad look a bit glitchy and jagged (especially when you zoom out with the camera) then you may have a problem with the precision of the depth buffer. This can be fixed by increasing the NEAR_PLANE value of your projection matrix in the MasterRenderer, or by changing "new PixelFormat()" to "new PixelFormat().withDepthBits(24)" when creating the display.


Series Overview:

1. Introduction
2. Rendering to textures
3. Clipping planes
4. Projective texturing
5. Du Dv Maps
6. Fresnel Effect
7. Lighting
8. Depth Effects

Tumblr: http://thinmatrix.tumblr.com/
Facebook Page: https://www.facebook.com/thinmatrix
Instagram: http://instagram.com/thin_matrix
Twitter: https://twitter.com/ThinMatrix
Pinterest: https://uk.pinterest.com/thinmatrix/
Check out my game on IndieDB: http://www.indiedb.com/games/socuwan

Contact me: thinmatrix@gmail.com

End of video music- Kai Engel, "Waking Stars":
http://freemusicarchive.org/music/Kai_Engel/Evening_Colors/01_-_Waking_Stars







Tags:
OpenGL
lwjgl
java
programming
tutorial
glsl
water
opengl water tutorial
programming water
3d water
game development
beginners opengl tutorial
opengl 3+
water shader
water shader tutorial
java game tutorial
lwjgl water tutorial
3d game
opengl 3d game
shaders tutorial
glsl water
3d game development
game engine
3d rpg
OpenGL tutorial
lwjgl tutorial
opengl reflection
3d game engine
c++
java 3d
realistic 3d water
depth
soft edges
water depth