pouët.net

Raymarching Beginners' Thread

category: code [glöplog]
psonice: i know this' not actual geometry... so i wasn't talking about that kinda displacement. I just remembered the green jelly a few pages ago which didn't 'demarch' the surface in that league of detail. so...

anyway... this' nice development to see. ;)
added on the 2011-03-07 02:35:00 by yumeji yumeji
Quote:
\o/ Another member of the "ball intersecting cube" club, welcome :D

Is it gay if the balls intersect?
added on the 2011-03-07 10:04:55 by raer raer
las : wow it looks like a real time version of one of my favorite wild entry : http://www.pouet.net/prod.php?which=9489 vit by noice. A real time version was made some times ago but it sucks
added on the 2011-03-07 10:50:54 by nytrik nytrik
yumeji: you take the formula that produces the spike ball, and comine it with the formula that makes the noise bump (guess it's the cellular noise?). You can change the size of either, making the spike ball big and the noise small gives a nice detailed surface. Combining a bunch of formulas + scales, you can make sexy objects like that :)

Rare: intersecting is about the opposite of touching, so I'd say no. We need to start adding objects instead of subtracting :)
added on the 2011-03-07 11:49:13 by psonice psonice
Nope it's three octave of perlin noise.
Code: float d = spikeball(p); d += fn(p*90.)*0.05;
added on the 2011-03-07 11:56:13 by las las
A simple 5x5x5 blur on classic box minus sphere

BB Image

Nice, but it is just so slow... and the surface is not smooth :(
Oh, you're blurring the object rather than the rasterised output? Cool :D

I quite like how it looks actually. Looks polygon rendered. Hmm.. smoothing the object is an interesting idea. Perhaps marching with different values for the bailout and mixing the result?
added on the 2011-03-07 15:12:55 by psonice psonice
nice, missing smoothness gives it a cool look :)
hmm maybe "pretend" that there is a sphere on every point of the surface?
added on the 2011-03-07 15:13:28 by las las
How do you do that?
Quote:

return max(cube(), -sphere()) - radius;


Maybe? (Not tested at all.. i'll give it a go later)
added on the 2011-03-07 15:16:51 by psonice psonice
The thing behind the idea is called "sphere swept surfaces" and I'm not yet sure how to do that in rm.

psonice: that does not work :)
added on the 2011-03-07 15:41:55 by las las
Hmm.. it doesn't. And I'm a bit confused as to why.

With it being raymarching, you don't need a sphere on every point of every surface - just a sphere on the nearest point (assuming the spheres are all the same size).

So, we get the distance to the nearest point (on the sphere/cube object - is there a name for it?). Then we subtract from that distance the radius of the sphere. That gives the distance to the closest point on a sphere on the surface of the object, no?

Well, except that it clearly doesn't work :D There's a big hole in my reasoning somewhere.
added on the 2011-03-07 16:17:14 by psonice psonice
Something with moving the surface in the direction of the normal? Wild guess...
added on the 2011-03-07 16:30:05 by raer raer
The direction doesn't matter, the sphere trace tells us the distance to the nearest surface, and the distance to the surface of a sphere at that point is always the same because it's a sphere. So distance to surface minus radius of sphere should be correct for all points on the surface.. but it doesn't work :)

Oh well, cases like this are good for learning. Sometimes. ;)
added on the 2011-03-07 16:42:27 by psonice psonice
Some AA distance field scenes here, with a fake global illumination.
added on the 2011-03-08 00:27:22 by Anat Anat
XT95 - great! - how do you do the fake GI? Is it realtime?
added on the 2011-03-08 00:33:01 by las las
XT95: nice. I remembered the distocubesub "shape" from ergon, but that's it!! ...and the rest is fake illumination? even more nice. ;)
added on the 2011-03-08 00:48:37 by yumeji yumeji
las: not real time because of the big supersampling but it's possible ..
For the fake GI, it's a small trick, not normal oriented :
Just add a color and modulate her by the distance of the object
Code: color += vec4(1.,.5,.1,1.) /(1.+object(p)*10.)


(Sorry for my bad english ..)
added on the 2011-03-08 00:55:12 by Anat Anat
XT95: very nice. Cool trick with the lighting too, i was wondering how that worked when the long glowy shapes appeared :)
added on the 2011-03-08 01:03:54 by psonice psonice
Any more thoughts on why subtracting a number from the minimum distance doesn't smooth the surface btw? That's really bugging me :)

It seems to just make the object bigger. Why does it keep a square corner on a (non-rounded) cube, when we're adding a fixed distance? That should make a rounded corner.
added on the 2011-03-08 11:46:08 by psonice psonice
XT95, thank you, great trick - just tried it - using an exponential falloff works also pretty nice.

Code: finalColor += objColor/(1.+exp(obj(p))*0.25)


psonice: that is because you subtract distance "everywhere" - draw a figure and you see what happens. You have to find a way to subtract less at some positions... maybe one needs to consider the curvature or something like that - didn't really think about it yet - I just wanted to share the "basic idea".
added on the 2011-03-08 12:26:44 by las las
las: I drew a figure, it shows a cube getting bigger but with rounded corners :(
added on the 2011-03-08 12:40:42 by psonice psonice
Really cool XT95! :)
XT95:
We (urs & me) just thought about an improvement - because it also lights objects that are facing away from the emitter... maybe multiplying with max(dot(gradF(p),-gradObj(p)), .0) might be a good idea (untested).
added on the 2011-03-08 13:00:58 by las las
XT95 do you have an executable that generates this video?

login