pouët.net

Go to bottom

Raymarching Beginners' Thread

category: code [glöplog]
If we account voxel landscapes as 2d raycasting/raymarching (which it is) then there are plenty of them on C64. I forgot the twisters. It's just a version of the landscape raycasting but on a cylinder. But raymarching in the true sense of 3d rays and some of the tricks here is something I haven't seen on any 8bits. Maybe in lowres and not expecting many frames per second. Who knows, I might try it oneday on the CPC :)

The most impressive raymarcher / platform is in js imho.
added on the 2011-02-06 09:01:19 by Optimonk Optimonk
bbcode fail, my first
added on the 2011-02-06 09:16:13 by xTr1m xTr1m
BB Image
Stereographic projection fun. Demoish object.
added on the 2011-02-06 11:14:32 by las las
BB Image
added on the 2011-02-06 11:29:54 by las las
iq: yes, and I modded it.

Is that a problem? If so, I apologise :(
added on the 2011-02-06 11:46:51 by mudlord mudlord
Is the hsv2rgb conversion needed in these algorithms and why?
added on the 2011-02-06 12:47:36 by Optimonk Optimonk
optimus:
Only in case you want to use the HSV-color-model you need that conversion.
added on the 2011-02-06 13:07:22 by las las
Are there some advantages in the hsv for raymarching?
added on the 2011-02-06 13:17:38 by Optimonk Optimonk
Well, you can easily loop through hue based on iteration count for trippy background colours, which I guess is what las did in that last image.
added on the 2011-02-06 13:21:41 by msqrt msqrt
exactly.
added on the 2011-02-06 13:27:56 by las las
BB Image
added on the 2011-02-06 13:38:28 by Anat Anat
optimus: It's a lot easier to find good colors in HSV space then in RGB. It's also easier to animate from one color to the next in a nice way. If you do it in RGB you can easily end up with 'coder art' colors. But just pick the color space that fits what your doing. Sometimes RGB is the way to go. Best way to go is to try (and fail) and try again. If nothing else experience will be gained.
added on the 2011-02-06 13:46:37 by Xetick Xetick
XT95: looks amazing! Do you have a higher resolution version of it?
Why does the grass (it's supposed to be grass, isn't it) look so lined?
added on the 2011-02-06 14:50:31 by joooo joooo
Quote:
If we account voxel landscapes as 2d raycasting/raymarching (which it is) then there are plenty of them on C64.


Optimouse: are you sure of this? so what you're saying is that raymarching is actually a 3d-raycaster? i did 2d voxel-landscapes before. if raymarcher is 3d-raycasting then its much easier for me to get a grasp of what's going on even if i havent read a raymarcher-tutorial before.
added on the 2011-02-06 15:03:56 by rudi rudi
part 3 of this c64-demo is a 2d-raymarcher?
added on the 2011-02-06 15:10:05 by rudi rudi
@joooo : for the higher resolution not yet but it's not finished :)
added on the 2011-02-06 15:44:40 by Anat Anat
@rudi: The terms used for raycasting, raytracing, raymarching are a bit convoluted sometimes. I have heard people using the same terms meaning different things some times.

But raymarching for me is what the word says, a ray that marches, aka moves at constant(or even not) steps towards it's direction till it hits something.

I will refer to this pdf by iq from now on.

Page 17 shows the constant steps. At page 18 we can see in what different things we can raymarch and it also happens on a heightmap. Now, the one other I tried is on a procedural isosurface (the blue ugly plasma thing I posted) where you also can raymarch at constant steps and just evaluate a function (for example f(x,y,z) = sin(x) + sin(y) +sin(z) + more sines..) at each step and if the result is over a threshold of your choice and if it is you stop and render.

In page 19 there are distance fields which is another way to raymarch. And the trick is visually shown from page 23 to 29. This helped me to understand. I have to agree that most raymarchers in the scene is distance field base and not the typical move along a ray in constant small steps which is the easiest thing. In distance fields you just have to write functions that given a current point and the ray direction you ecaluate which could be the safest biggest distance to jump to that direction for each box or sphere in the scene and jump using the minimum of them. You have to write specialized functions for box, sphere and other objects, which can have few math, but it's not that hard if you get it.

So, yes raymarching is also done with constant steps on a heighfield (either 2d steps or 3d steps through a plane), on volume data, on procedural isosurfaces which you evaluate during each step, but also on perfect sphere and boxes with distance fields (non constant steps). It's a bit trickier but really easy if you get the grasp. I think in our older thread we discussed already what the code of those distance field functions for a box, a sphere and other objects are. And the pdf helps grasp the nice idea behind it.

Maybe I haven't explained well the stuff here, mostly focused in the fact that raymarching means a lot of different things, so we could talk further if you want.

About the C64 demo. I don't know about that effect. It's a twister scroller and an effect I adore. I think it's just some different gfx for each scanline of rotated parts that can form letters if combined together and chosing which lines to display.

When we talked about voxel twisters on C64, we were meaning this effect (at 1:40). The example is a PC demo but I couldn't remember where I have seen a similar effect on C64 (must be a smash designs demo)
added on the 2011-02-06 23:07:17 by Optimonk Optimonk
sent it already, but.. raymarching:

BB Image
added on the 2011-02-07 02:07:10 by iq iq
That grass o_O
How?
added on the 2011-02-07 02:32:36 by xernobyl xernobyl
(assuming it's procedural)
added on the 2011-02-07 02:32:52 by xernobyl xernobyl
does anyone know how to do a stereographic (or polar) projection effect?
added on the 2011-02-07 04:23:28 by gngbng gngbng
er, just stereographic actually. i brainfarted and forgot how polar worked for some reason.
added on the 2011-02-07 04:33:10 by gngbng gngbng
optimouse:

Quote:
@rudi: The terms used for raycasting, raytracing, raymarching are a bit convoluted sometimes. I have heard people using the same terms meaning different things some times.

yes ive seen that too, thats why sometimes i dont want to say to much about the discussion.

unsound minds / byterapers has some voxels twister or tunnel. but i believe its just raycasting, and nothing more fancy.
yea, youre probably right about the legoland demo. its probably just some prerendered images. i dont have time to read the doc you posted. maybe ill take a look at it later. its strange to raymarch if it is what i think it is, wont it happen to miss some objekt if it jumps over. same as adaptive sub-sampling in 2d-screenspace, but would not be right the same. i also know subdivision surfaces with marching cubes. but probably not the same.
added on the 2011-02-07 11:41:53 by rudi rudi

login

Go to top