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.
The most impressive raymarcher / platform is in js imho.
bbcode fail, my first
Stereographic projection fun. Demoish object.
iq: yes, and I modded it.
Is that a problem? If so, I apologise :(
Is that a problem? If so, I apologise :(
Is the hsv2rgb conversion needed in these algorithms and why?
optimus:
Only in case you want to use the HSV-color-model you need that conversion.
Only in case you want to use the HSV-color-model you need that conversion.
Are there some advantages in the hsv for raymarching?
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.
exactly.
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.
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?
Why does the grass (it's supposed to be grass, isn't it) look so lined?
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.
part 3 of this c64-demo is a 2d-raymarcher?
@joooo : for the higher resolution not yet but it's not finished :)
@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)
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)
sent it already, but.. raymarching:
That grass o_O
How?
How?
(assuming it's procedural)
does anyone know how to do a stereographic (or polar) projection effect?
er, just stereographic actually. i brainfarted and forgot how polar worked for some reason.
http://en.wikipedia.org/wiki/Stereographic_projection#Definition
Take the (x,y,z) = ... variant.
Take the (x,y,z) = ... variant.
optimouse:
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.
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.