Raymarching Beginners' Thread
category: code [glöplog]
Another one ;)
Quote:
Really nice! :)
Got no idea why it is not working. Per loop I first raymarch to color buffer and then do:
no errors. Fragment shader code is:
and it compiles sucessfully.
All square, power-2 textures/viewports too and no glError()s.
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.
With and without glGenTextures().
You don't need to call glGen*** if you want to save some space. just make sure you use always the same id.
Just saying it doesn't make a difference...
The shader runs apparently. When I uncomment the commented line I get a colored quad.
The shader runs apparently. When I uncomment the commented line I get a colored quad.
Paulo, aahhh yeah, 2 polar repeats ;) Cool.
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 ;)
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 ;)
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 ;)
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
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!!! ;)
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? :/
just continue marching if you encounter a transparent surface.
Yes, march through the surface.
\o/ Another member of the "ball intersecting cube" club, welcome :D
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...
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
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.
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.
Balls intersecting cubes are the new chrome spheres on checkerboards...
Welcome to the club.
New challenge: Create an octopus.
Welcome to the club.
New challenge: Create an octopus.
Moar checkerboards.
las: zoom out a bit more. Moire checkerboards.
nice las. does it really displace the outer silhouette? that's hard to see on that lil screenie.
yumeji: Yes.
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 :)
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 :)