Raytracing Oceans

category: code [glöplog]
Can you point me to a prod that rendered oceans using ray-techniques? (not vtxs)

Here's my raymarched implementation but I'm looking for reference prods.

BB Image
added on the 2012-02-08 02:04:47 by tz tz
It's not ray-tracing, it's polygons. But those technics are quite straightforward to transpose to raytracing

All glory to the hypnoIQ :D
Cannapaceus and Cognoscere had raymarched water, and a modified version was later used in Devolution.

The water heightmap is updated on GPU before raymarching so it's slightly different solution than an all-in-one raymarcher.
added on the 2012-02-08 08:44:01 by pommak pommak
We did that for Lunaquatic
added on the 2012-02-08 10:10:10 by xTr1m xTr1m
Ah thanks pommak! That was exactly what I was hoping to come across
added on the 2012-02-08 10:10:16 by tz tz
...and the predecessor, Valleyball, although that's just a plane with normal mapping there.
added on the 2012-02-08 10:17:53 by xTr1m xTr1m
Thanks! great prods there xTr1m. Though I guess I'm first going to mimic nvidia's fft/tess ocean demo's.

If anyone knows of any others, posting would be greatly appreciated.
added on the 2012-02-08 10:25:44 by tz tz
since you speak or raymarching, i assume it is a look/shader what you are searching for, not help with the simulation part.

if you need references, i would strongly recommend NOT looking to CG images (specially nvidia demos, man!). in the other hand, doing a raytraced/raymarched ocean is no different to an opengl/dx ocean. still, if you insisted, here go some basic renderings.

raymarched, 2010 (http://www.iquilezles.org/www/articles/raymarchingdf/raymarchingdf.htm):
BB Image

raytracer, 2005 (http://www.flipcode.com/archives/03-18-2005_rt.shtml):
BB Image

rasterized, 2005 (http://www.iquilezles.org/www/articles/simplewater/simplewater.htm):
BB Image

added on the 2012-02-08 18:20:29 by iq iq
in the other hand, doing a raytraced/raymarched ocean is no different to an opengl/dx ocean.

what's an opengl/dx ocean?
Thanks for the images!

BB Image

Well I'm try to match this image as far as detail vs speed (right now I'm at about half the speed roughly the same quality). Using polys tend to be faster but I can have more much more detail when raymarching removing the need for tessellation. But I'm finding that there is an important balance between detail and smoothness when trying to achieving realism.
added on the 2012-02-09 00:02:33 by tz tz
I got raytraced quiet seas surface like this
* 4 layers of FBM, made with Simplex Noise. The 4 layers are generated from entirely different seeds. They are not the same layer repeated 4 times with a rotation/translation, it would be cheap and often makes visual artifacts. 4 blurred gaussian noise texture would do as well.
* each layer is 2x frequency of previous one
* 1st, lower frequency layer is used as actual heightmap. If you raytrace, you can first compute intersection with the "sea plane" as first approximation, then from that intersection, raymarch to the actual intersection. In practice, fast enough.
* 3 higher frequency layers are used to make the normal map :p
* I stretch the layers along one dimension of a factor, say 10, turns the bumps into waves :D
* mixing coeffs for the layers, well, trials and errors
* Shaded with mostly good old Lambert. Adding a tiny of reflection is ok, but it usually makes the pic crying loud "ho hai I haz raytracing". I would take in account reflection with the sky only. Never tried, there might be some more sophisticated way to shade thing.
Ocean tracer

Here is an example of an all procedural ocean renderer in GLSL with shader src.

It's not super schmancy but it might help.
added on the 2012-02-09 04:11:25 by Voltage Voltage
BB Image

Lifeforce by ASD
added on the 2012-02-10 09:41:17 by tz tz
out of interest, how come you specifically want to raymarch it?
added on the 2012-02-10 09:59:45 by smash smash
Not sure if it can give any inspiration (only visually, if any).. but here's my latest try at rendering an ocean... not raytraced. and for sure not very impressive tech-wise.

(It's done by rendering the ocean mesh from the top into a normal map+height in alpha for easy repetition, then doing displacement in vertex shader with some various weights to get more out of the FFT).

refmap is really what is left to fix, it's totally wrong at the moment.

BB Image
added on the 2012-02-10 11:34:39 by jaw jaw
(btw, we used the tessendorf fft method in ceasefire)

added on the 2012-02-10 11:36:51 by smash smash
I guess the biggest problem is the wave function than the rendering itself.
added on the 2012-02-10 11:52:33 by Navis Navis
In demoscene prods the one I particularly like is the ocean in Stargazer by Andromeda.
added on the 2012-02-10 11:53:38 by maq maq
Did anyone ever code an ocean with waves tipping over and splash?
Maybe the raymarching approach would make sense here?
added on the 2012-02-10 12:00:22 by maytz maytz

Partly because it is possible to get more detail and partly because raymarching is elegant.

That and I'm interesting to see if it's possible to match the high quality tessellated ocean and fft demos by nvidia in terms of rendering speed on new hardware.
added on the 2012-02-10 12:12:36 by tz tz
maybe the subsurface thing in hofn was done by trace?
BB Image
added on the 2012-02-10 17:29:53 by the_Ye-Ti the_Ye-Ti
about the tessendorf method - one thought I had which I think I'm going to try, is to run a pretty high-res (256x256) FFT in a thread and then doing linear interpolation on the texture - i.e. only generate a new FFT mesh every 5-10 frames or so, but might work if the ocean isn't too busy.
added on the 2012-02-10 18:26:29 by jaw jaw
jaw: looks great
added on the 2012-02-11 16:16:27 by xernobyl xernobyl