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.
Here's my raymarched implementation but I'm looking for reference prods.
It's not ray-tracing, it's polygons. But those technics are quite straightforward to transpose to raytracing
http://www.iquilezles.org/www/articles/simplewater/simplewater.htm
All glory to the hypnoIQ :D
http://www.iquilezles.org/www/articles/simplewater/simplewater.htm
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.
The water heightmap is updated on GPU before raymarching so it's slightly different solution than an all-in-one raymarcher.
We did that for Lunaquatic
Ah thanks pommak! That was exactly what I was hoping to come across
...and the predecessor, Valleyball, although that's just a plane with normal mapping there.
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.
If anyone knows of any others, posting would be greatly appreciated.
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):
raytracer, 2005 (http://www.flipcode.com/archives/03-18-2005_rt.shtml):
rasterized, 2005 (http://www.iquilezles.org/www/articles/simplewater/simplewater.htm):
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):
raytracer, 2005 (http://www.flipcode.com/archives/03-18-2005_rt.shtml):
rasterized, 2005 (http://www.iquilezles.org/www/articles/simplewater/simplewater.htm):
Quote:
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!
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.
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.
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.
* 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.
Here is an example of an all procedural ocean renderer in GLSL with shader src.
It's not super schmancy but it might help.
Lifeforce by ASD
out of interest, how come you specifically want to raymarch it?
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.
(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.
(btw, we used the tessendorf fft method in ceasefire)
I guess the biggest problem is the wave function than the rendering itself.
In demoscene prods the one I particularly like is the ocean in Stargazer by Andromeda.
Did anyone ever code an ocean with waves tipping over and splash?
Maybe the raymarching approach would make sense here?
Maybe the raymarching approach would make sense here?
@smash
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.
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.
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.
jaw: looks great