APOCALYX is a...

free Game Engine based on OpenGL (MAIL) (SITE) (FORUM) (BLOG)

Friday, May 16, 2008

Ocean shader

One of the oldest features of APOCALYX was the Ocean terrain (uh, what an oximoron!), that is a simulated water surface where waves are computed with fast fourier transforms. To make that “ocean” more “realistic” an animated texture with caustics was applied. The effect was acceptable only for the very first years of the century, but now is very outdated, in fact, GLSL shaders can simulate very realistic sea surfaces.

You can see in the screenshot the old way to render an ocean on the left, while the modern way on the right. The right side is almost indistinguishable from a real water surface.
APOCALYX already support GLSL shaders, but there is still a problem. In the picture above, only the skybox is reflected on the water, while ships or seagulls and other objects above the surface are ignored. To make the surface reflect all the environment, one must render the scene upside down (like in a horizontal mirror), capture the result in a texture and then render the water surface, passing the texture as an argument to the shader.
The only step, that is still missing in the engine, is the rendering of the reflected scene in a texture, but in the next version all the procedure will be correctly implemented. Stay tuned for more… sailing!

No comments: