pouët.net

Go to bottom

Raymarching Beginners' Thread

category: code [glöplog]
Another one ;)
BB Image
Quote:
BB Image


Really nice! :)
added on the 2011-03-04 13:11:22 by Rob Rob
Got no idea why it is not working. Per loop I first raymarch to color buffer and then do:
Code: glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, tColor); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 512, 512, 0); glUseProgram(postProcHandle); const int sampler = glGetUniformLocation(postProcHandle, "color"); glUniform1i(sampler, 0); glRectf(-1,-1,1,1);

no errors. Fragment shader code is:
Code: uniform sampler2D color; void main() { //gl_FragColor = vec4(gl_FragCoord.xy / vec2(512, 512), 0, 1); gl_FragColor = 0.5 * texture2D(color, gl_FragCoord.xy / vec2(512, 512)); }

and it compiles sucessfully.
All square, power-2 textures/viewports too and no glError()s.
added on the 2011-03-04 14:26:40 by raer raer
With and without glGenTextures().
added on the 2011-03-04 14:27:16 by raer raer
You don't need to call glGen*** if you want to save some space. just make sure you use always the same id.
added on the 2011-03-04 14:38:47 by xernobyl xernobyl
Just saying it doesn't make a difference...
The shader runs apparently. When I uncomment the commented line I get a colored quad.
added on the 2011-03-04 14:48:07 by raer raer
Paulo, aahhh yeah, 2 polar repeats ;) Cool.
added on the 2011-03-04 17:57:22 by las las
Paulo: thanks. Great looking stuff you have there!

I didn't get time to try polar today. Still playing with complex repetition... I'm this close: <--> to doing something wonderful with a single cube. The shape is there, but so are the intersection glitches ;( (no screenshots of this, if it works, it'll go in a demo ;)
added on the 2011-03-04 18:12:42 by psonice psonice
Thanks, I did these experiments in rendermonkey in 2008 after reading IQ rgba_slisesix.txt
And I have a lot more stuff :P
But I have no time now to do make a decent demo. Buahh!
So I share some images and code ;)
From rgba_slisesix.txt
Quote:
this is some cpu raymarching on a big 3d scalar field. no rasterization
nor primitive intersections are used. there is a big math function that
tells the distance to the closest surface at any 3d point in space. you
can then evaluate the function to guess how much you can safely advance
before eventually hitting any surface and so take the step. i call this
"rendering with distance field", i wonder what is the official techical
name for it.

Yes... it is called SphereTracing. But i prefer the term rendering with distance field ;)

THANKS IQ! For innumerous hours of pure function/math raycasting fun!!! ;)
Raymarching not raycasting...
Any idea how to transparency? Can't seem to find any information on how to do it? :/
added on the 2011-03-05 06:56:17 by Mewler Mewler
just continue marching if you encounter a transparent surface.
added on the 2011-03-05 08:35:23 by pommak pommak
Yes, march through the surface.
added on the 2011-03-05 10:25:51 by las las
BB Image
added on the 2011-03-06 13:47:25 by revival revival
\o/ Another member of the "ball intersecting cube" club, welcome :D
added on the 2011-03-06 17:08:37 by psonice psonice
Raymarching challenge...

Generic method to blur anything.

Anyone know how to do this?

Is possible to blur just like 2d image blur... but it just so slow... and the result is not a smooth surface...
meepmup
added on the 2011-03-06 21:43:39 by unc unc
Paulo: not sure it's possible (within the raymarch itself of course, and in a fast way). Same reasons I gave for DOF being hard - you really have to march multiple rays for each point in the blur (absolute minimum two for a really crappy blur, more likely 10+) and you have to calculate lighting, colour + texture etc. for each ray. It's frustrating, because you have so much of the information you need during a single march, but never quite enough :(

It's easy + fast to do in a separate pass with a regular texture blur (or even fake DOF), but then your code is so much bigger.
added on the 2011-03-06 22:25:09 by psonice psonice
Balls intersecting cubes are the new chrome spheres on checkerboards...
Welcome to the club.

New challenge: Create an octopus.
added on the 2011-03-07 00:47:26 by las las
BB Image
Moar checkerboards.
added on the 2011-03-07 01:42:49 by las las
las: zoom out a bit more. Moire checkerboards.
added on the 2011-03-07 01:49:31 by psonice psonice
nice las. does it really displace the outer silhouette? that's hard to see on that lil screenie.
added on the 2011-03-07 02:08:28 by yumeji yumeji
yumeji: Yes.
added on the 2011-03-07 02:24:11 by las las
yumeji: there's no displacement mapping or whatever, that's pure 3d object. If you zoomed in, you could fly between the bumps on the surface. No polygons, no bump maps :)

That's what makes this technique so cool. You can make an object like that, make it as detailed as you want without any performance hit (depending on how you do it, anyway). Then you can add an unlimited number of objects like that on screen, with minimal speed hit. Then you can animate them all, any way you want to. Still no speed hit :)
added on the 2011-03-07 02:27:36 by psonice psonice

login

Go to top