Raymarching Beginners' Thread
category: code [glöplog]
I think we are going into a renaissance... the field of RT graphics fell fresh again.
Untill we get another post from a Guru with more eye candy, I enjoyed
what chrome can show me in real time.
http://fractal.io/
(If you have a 8800 or better, its ok to set rendering to normal VS preview.)
Untill we get another post from a Guru with more eye candy, I enjoyed
what chrome can show me in real time.
http://fractal.io/
(If you have a 8800 or better, its ok to set rendering to normal VS preview.)
las: I have some ideas for fresh ways of building a scene. So, screenshots soon.. if it works. And if I find time :)
T21: You're probably right. We're just starting to explore this stuff. And that fractal viewer is cool as fuck :D
T21: You're probably right. We're just starting to explore this stuff. And that fractal viewer is cool as fuck :D
It's also buggy as fuck :)
How does simple raymarching work with SDL?
I've setup a SDL window with OpenGL in C++, but where do I start from here?
I've setup a SDL window with OpenGL in C++, but where do I start from here?
Make a single screen-sized quad, and a single shader program. Put your raymarching algo in the shader (you'll find examples in this thread and the raymarching toolbox thread). Render the quad using the program.
4. PROFIT!!!!!
Damn! I always forget the profit!
This is what I have right now.
Is this okay? And what do I have to do from here?
Is this okay? And what do I have to do from here?
Learn about shaders
Code:
if (init_GL() == false)
pinda : are you awayre that you're testing a boolean value against a boolean value, which will return a boolean value ? Maybe you could go beyond that by defining two more functions, IsTrue() and IsFalse(), so that you could test it like this :
Code:
if(IsTrue(init_GL() == false) == true)
;)
1. Search this thread for a link to IQs framework.
2. Download
3. Take a look the the code
4. PROFIT!!!
alternatively:
1. glGetProcAddress shader functions or use GLEW
2. copy trivial vertex and less trivial fragment shader code from thread
3. compile, link, use shader before drawing a screeen-sized quad
4. PROFIT!!!!!
2. Download
3. Take a look the the code
4. PROFIT!!!
alternatively:
1. glGetProcAddress shader functions or use GLEW
2. copy trivial vertex and less trivial fragment shader code from thread
3. compile, link, use shader before drawing a screeen-sized quad
4. PROFIT!!!!!
@flure: which doesn't matter to the compiler, i.e. same piece of code at the end (unless the compiler sucks ass)
He's using SDL, so he might want to give GLEW a go.
flure, check the GLSL tutorial on lighthouse3d.com that might be a good starting point.
I finally managed to get my stuff work in FX Composer.
RenderMonkey crashes due to the fact that it can't parse error messages like:
Caused by this snippet:
Any tipps to reduce the temp register usage thing?
And how can I get rid of this nice vertex shader?
Is there something like gl_FragCoord in DX?
+ I guess I'll have to stick to d3d9 - that means no ps_4_0 :(
And the documentation for the FX file crap is something like the worst thing I've ever seen.
The only good property of the FX files is that you can generate textures directly there.
flure, check the GLSL tutorial on lighthouse3d.com that might be a good starting point.
I finally managed to get my stuff work in FX Composer.
RenderMonkey crashes due to the fact that it can't parse error messages like:
Quote:
Error Error: error X4505: maximum temp register index exceeded ...\projects\testproject\TestEffect.fx 66
Caused by this snippet:
Code:
float tn(float3 p) {
float4 t={p,0};
float3 v = float3(tex3Dlod(tex,t/9).x, tex3Dlod(tex,t).xy);
v=v*float3(acos(-1)*2,2,2)-float3(0,1,1);
sincos(v.x,t.y,t.x);
return dot(t.xy,v.yz)
}
float ftn(float3 p) {
return tn(p*.06125)*.5
+ tn(p*.125)*.25
+ tn(p*.25)*.125;
}
Any tipps to reduce the temp register usage thing?
And how can I get rid of this nice vertex shader?
Code:
void n(inout float4 p:position,out float3 v:texcoord){
v=p=sign(p);
}
Is there something like gl_FragCoord in DX?
+ I guess I'll have to stick to d3d9 - that means no ps_4_0 :(
And the documentation for the FX file crap is something like the worst thing I've ever seen.
The only good property of the FX files is that you can generate textures directly there.
@toxie : yeah of course I know, I was just joking. Though if I see such a thing at work in one of my colleagues' sourcecode, I will certainly have a discussion with him, because it implies that there is definitely something he didn't understand... I mean this thing may be anecdotic but could also reveal some bigger problems in understanding of how things work in a program...
flure:
is better readable for java-pussy-coders.
Code:
if (init_GL() == false)
is better readable for java-pussy-coders.
@las : I think you totally got to the point. java-pussy coders...
then i must be a java-pussy, too.. oh noes.. ;)
Is there anything better/newer than FX Composer?
if (init_GL() == false)
is a lot more readable if you regularly use an exclamation mark at the start of your method names too.
is a lot more readable if you regularly use an exclamation mark at the start of your method names too.
@psonice : yeah, and what you describe is quite common in C language ;)
las: probably not. I guess working on single shaders is no longer enough for a commercial project, and as such there is no further development on shader editors by part of companies. Putting together a shader editor useful enough for "real projects" (as in not a single pass shader effect) would take a lot of effort and it probably wouldn't still give the desired return. Just guessing.
You're probably better using some GUI API inside your own app that reloads a shader every time it's file is changed.
and what's wrong with ifn't?
if(!nt)
You're probably better using some GUI API inside your own app that reloads a shader every time it's file is changed.
and what's wrong with ifn't?
if(!nt)
@xernobyl : I was just making fun of testing a boolean against a boolean in a boolean construct... well, I was largely out of topic. back to topic now ? ;)
It depends on the type/return type.
Wtf is nt? When you write
at least you know it is a pointer, besides not abusing fact that in C "true" means " != 0" and a simple bit-wise NOT operation can get you there...
But this is demo coding so... ;)
Code:
if (!nt)
Wtf is nt? When you write
Code:
if (NULL != nt)
at least you know it is a pointer, besides not abusing fact that in C "true" means " != 0" and a simple bit-wise NOT operation can get you there...
But this is demo coding so... ;)
@rär : well when you deal with pointers I totally agree with you. But when it's boolean expressions, it's just dumb to compare them to true or false...
It's a matter of style and does not belong here - use whatever you want.
:(
That's a very handy thing...
Quote:
Texture = <texture_variable>;
Direct3D 9 only. A texture variable. The Texture keyword is required on the left-hand side; the variable name belongs on the right-hand side of the expression within the angle brackets.
:(
That's a very handy thing...