Go to bottom

Raymarching Beginners' Thread

category: code [glöplog]
las: By the way, great idea for SSS. I really really like it. I think I am gonna steal it! :D However, here's an addition: Instead of sampling on the ray into the geometry you can sample on the inverse of the normalised direction to the light into the geometry. In the end SSS is an approximation of how much light scatters below the surface, so using the inverse of the normalised direction towards the light source would mean you're exactly doing that. :D
added on the 2011-02-09 12:15:49 by decipher decipher
Yeah that also works - I prefer the look of that what happens when just following the (refracted) ray direction :)
added on the 2011-02-09 12:31:05 by las las
I'm also curious about the Distance Fields Modeling tool.

my 'tool' looks like that:

- create a mini application which opens a render window, listens to some keyboard events with getasynckeystate and has a render loop which checks each frame if a shader source file has changed.

- that shader source file can be opened in any text editor of your choice (i use notepad++ to have syntax highlighting)
and as soon as ctrl-s is pressed to save the file it will be recompiled and shown in the render window.

- add some keys to switch between several techniques/shaders, some play/pause rewind functionality, maybe some camera movement keys which go into the vertex shader and of course a time parameter and you're pretty much set

that costs about 1 hour to implement and is still more flexible than any kind of building blocks within a real fancy tool
added on the 2011-02-09 12:39:18 by gopher gopher
That's exactly what one wants - even better than pressing a reload button :D
added on the 2011-02-09 12:50:27 by las las
essentially you dont even need to leave the text editor at all, just find some key combinations which are good for you to use, listen to them in your mini app and make sure they dont trigger some function in the editor :)
added on the 2011-02-09 12:56:26 by gopher gopher
vvvv for the masses! It is really comfortable thing, and very powerful
i can share my "framework" setup btw - simple render window + texteditor + simple shader on 2d quad
vvvv (up to 40beta23) has a very nice codeeditor - hlsl highlighting, error messages, pretty much everything you need, and it even may compile shader right after you stop typing <3
added on the 2011-02-09 17:55:23 by unc unc
I use quartz composer on mac. Exactly what unc said, except glsl. It's part of xcode, which is supplied on the OS dvd :)

Additional super-useful stuff in this kind of setup: Plugging LFOs, audio output or whatever into shader inputs for instant animation. Plugging webcam video into a texture input for instant fun. And doing stuff like feedback with a couple of mouse clicks.

I've been writing a lot of shaders this way for iphone apps, even allowing for a little glsl -> glsles conversion productivity is WAY higher.

I'll do a quick example QC file with a simple shader setup if anyone wants one.
added on the 2011-02-09 18:06:03 by psonice psonice
psonice: I'm sure you mean "glsl -> essl"... There's no such thing as "glsles" ;)
added on the 2011-02-09 18:10:18 by kusma kusma
I use my old linux codeblocks framework but will switch to windows sooner or later. Visual Studio ftw.
added on the 2011-02-09 18:59:11 by las las
Raymarching through volumes? How does that work, is it a volume of distances based off the data-set?

Traditionally we are not talking about the distance field based raymarching but the constant step raymarching into a volume (a 3d texture usually). Remember, the term raymarching has more meanings and distance field is usually attributed to it but it's not the only.

But if you want to use the distance method to accelerate volumes then maybe it's possible to store additional information for each voxel in the volume data that describes the farthest safe radius to jump from that voxel without the possibility to hit any non empty voxel. Your volume data would need to be static in this case and some heavy precalculation maybe. I was discussing this technique with my supervisor for my volume rendering thesis and he told me about this technique in volume rendering after I was discussing with him about the raymarching distance field techniques in the demoscene :)
added on the 2011-02-09 19:45:16 by Optimonk Optimonk
I was discussing this technique with my supervisor for my volume rendering thesis and he told me about this technique in volume rendering after I was discussing with him about the raymarching distance field techniques in the demoscene :)

Confusing. I mean, I was discussing in an irrelevant chat about distance fields and 4k intros, and he came up with the idea to use it specifically in voxels (or I think there were already scientific literature on this). Anyway, fact is I never tried it in practice (as with a lot of other things we were planning to do) :P
added on the 2011-02-09 19:48:11 by Optimonk Optimonk
unc, i'd be interested in that "framework" (if only to give it a try, i must admit).
added on the 2011-02-09 20:41:28 by skrebbel skrebbel
psonice: I'm sure you mean "glsl -> essl"... There's no such thing as "glsles" ;)

I'll accept your point purely because 'essl' is easier to say than 'glsles' :)
added on the 2011-02-09 21:00:28 by psonice psonice
http://www.sendspace.com/file/sl9m6y here is three simple vvvv patches
2d singlepass shader, twopass shader (render to texture, then postprocessing), and a basic raymarcher
to run those, download vvvv_40beta23 @ vvvv.org
added on the 2011-02-09 21:05:47 by unc unc
(in raymarcher patch, RMB+mousemove for camera lookaround)
added on the 2011-02-09 21:12:56 by unc unc
Since we are talking about editors. The one I currently use
BB Image
Precomputed shader input values in the 'expression' random/beat/noise/.., shader editor with limited intellisense that compiles the shader at each change. No save/build needed. This of course has it's pros and cons.

added on the 2011-02-09 22:04:13 by Xetick Xetick
yes, major con with quartz composer: it's easy to crash it with a dodgy shader (especially with these nasty loops in ray marching). Worst case you can take down the graphics driver, meaning a hard reboot is needed.
added on the 2011-02-09 23:04:40 by psonice psonice
Seems that Win7 and Ubuntu 10.* are mostly able to recover from a dying nvidia gfx driver.

Using multisampling on a machine with a not so state of the art graphics card might be not a good idea for untested raymarching scenes.
added on the 2011-02-09 23:23:12 by las las
/me goes and codes a modified shader recompiler...
added on the 2011-02-09 23:25:39 by xernobyl xernobyl
It may not be pretty, but it's progress. Lit raymarched sphere:

BB Image

I'm starting to 'get it' now. Need to get a texture lookup from the sphere next, then... the difficult part, with the transform of the sphere I have in mind :(
added on the 2011-02-10 13:43:05 by psonice psonice
Playing with SSS & AO and some noise.
BB Image
BB Image
added on the 2011-02-10 22:03:08 by las las
The SSS looks cute.
added on the 2011-02-10 22:34:29 by xernobyl xernobyl
Las : make an intro about it !! :)
added on the 2011-02-10 23:09:54 by Anat Anat
Las: nice. Bet it looks much better in motion though. Demo or video please :)
added on the 2011-02-10 23:28:48 by psonice psonice
Provide me a 1k win32 framework for GLSL or HLSL I will deliver.
If you have what I need - get in contact with me on IRCnet /query las
added on the 2011-02-11 09:10:01 by las las


Go to top