pouët.net

Raymarching Beginners' Thread

category: code [glöplog]
nystep: which 4k are you btw talking about?
added on the 2011-06-07 00:38:44 by las las
Cool, that's quite a speedup :) Guess it'll depend heavily on the scene, but it's one more weapon in the battle for speed.

It's going to add code to the VS though. I'm guessing that as the code can be near identical to the FS code, the compressor will nearly eliminate that? If not I guess it'd be easy to write the duplicate code out twice when setting up the shaders.
added on the 2011-06-07 01:35:58 by psonice psonice
psonice: If it only was "finding new uses for old tricks"; it's "reinventing the exect same ways of using old tricks". Which doesn't mean it's an useless method, but I think you have to accept that it's not novel any more ;)
added on the 2011-06-07 02:20:33 by kusma kusma
who cares? :)
added on the 2011-06-07 02:21:37 by las las
kusma: doing a low-res pre-pass is obviously not novel, doing it for raytracing definitely isn't, doing it in the vertex shader possibly is (though I'd be surprised), but yeah, who cares? it's something a lot of us discussing it here weren't doing before, and it seems it was worth suggesting it :)

(and tomorrow, if i get time and manage to get the lighting bugs fixed first, I'll add this to my raytracer to optimise out the ground and sky, just pass texture coords + normal through. Maybe I can hit 60fps on my olden radeon 2600 box :)
added on the 2011-06-07 02:37:35 by psonice psonice
las, well i didn't want to spoil the thread for self-promo either.. :p i just meant something like that. At least it can give you an idea of the performance increase that is possible.. x2 is not so bad. :)

As for shadow rays, it's also possible to store a nearer z where to start the shadow ray from the light source to the point to shade. so we can get "shadow maps" in raymarching? for spot lights it requires one texture and for point lights a cube map.. no big surprise. For reflections there's no magic solution, except that you can of course (and HAVE to) start the reflected ray with the epsilon obtained at your intersection. It's not only faster, it's also that your cone is getting bigger and bigger as you reflect the ray, which is quite interresting to acheive other effects (atmospheric and mie scattering in particular?).

Anyway, you can use the epsilon at the primary ray intersection as a "lod factor" when looking up textures and evaluating the material...

Nothing special then again, all of this is already possible with rasterisation, and yes, there is heavy conjecture content in this post. :) i guess it's all possible, but i haven't tried yet.
added on the 2011-06-07 13:55:41 by nystep nystep
Hmm.. some interesting ideas there! Use the epsilon to determine the noise octaves for example, so noise gets cheaper with distance. And shadow maps for fixed geometry/lights (or would it work as a separate pass at low res for lighting?)

Speaking of lighting, how about doing the shadows in the vertex shader pass? It'd be low res lighting, but cheap. With some tweaking, it might produce at least a passable glow? Not sure, but could be worth trying.

Back to fixing my raytrace lighting, nearly there :)
added on the 2011-06-07 14:02:10 by psonice psonice
1. Using bounding geometry is a good idea.
2. Using exit early and dynamic branching is a good idea.
3. Avoiding expensive texture lookups is also a pretty good idea.
4. And using one rough (without lookups for noise) and one high quality (with lookups) marching step is a pretty damn good idea.

To apply that all you have to know your scene pretty well.
But this crap now runs with 80fps at 1024x768. And that's way faster than 15 fps.
added on the 2011-06-07 14:02:31 by las las
\o/

Of course you also want:
5. Raytrace anything you can once, before rendering, and remove those objects form the distance function.

added on the 2011-06-07 14:12:52 by psonice psonice
Ohh... And it's 1280x1024... reaching 93 fps.
added on the 2011-06-07 15:14:16 by las las
Over 100 \o/
4 Steps in the refinement pass are enough - wtf.
added on the 2011-06-07 15:27:58 by las las
You know you're finished optimising when it's still doing 60+ and you can't turn the res up any higher :)
added on the 2011-06-07 15:42:02 by psonice psonice
screenshot or it didn't happen! (so that we can see the type of scene also, else numbers don't mean anything) :)
added on the 2011-06-07 15:51:32 by nystep nystep
True, such speeds are easily achieved with an empty scene ;) Somehow I think las is a bit past that stage though :D
added on the 2011-06-07 16:40:53 by psonice psonice
true, i expect something nice from him. :)
added on the 2011-06-07 16:45:43 by nystep nystep
It pretty much looks like http://pouet.net/prod.php?which=56922 - better.
No screenshots before evoke - sorry :)
added on the 2011-06-07 17:51:36 by las las
And I use some kind of proper 3d noise texture - painfully expensive. You just can not march that thing brute force.
added on the 2011-06-07 18:01:48 by las las
Quote:
No screenshots before evoke - sorry :)


I like that answer better than the screenshot ;)
added on the 2011-06-07 22:10:53 by psonice psonice
A little 'off-focus' but at least not offtopic: I've ported my Revision PC 4k sphere tracing/raymarching entry to JOGL (as las would say "better readable for java-pussy-coders") and published the original+commented code on Github. Maybe someone could learn stg from it :) enjoy ...

Original 1:1 port (minified shader)
Commented port (development shader)
Thank you, though i had your commented source already because i noticed it was just a cut&paste minified version of what is done on http://www.fractal.io. ;D
added on the 2011-06-08 13:48:48 by nystep nystep
ScenePassivist: very nice work - as I mentioned earlier this should have been in the top3. :)

Fractals - are fractals, - are fractals. That's kinda getting boring.
added on the 2011-06-08 14:05:40 by las las
a13X_B:
That one http://vimeo.com/23018524 impressed me - how fast is it?
Did you improve it any further? Better material? Want to see code :)
added on the 2011-06-08 14:08:17 by las las
People still use java? I thought everyone was already using .net / mono.
added on the 2011-06-08 15:33:19 by xernobyl xernobyl
well, that's true las. fractals get boring, i'd better switch to something new.
added on the 2011-06-08 15:56:04 by nystep nystep
I m still impressed by fractals
added on the 2011-06-08 16:09:23 by nytrik nytrik

login