pouët.net

Go to bottom

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.)
added on the 2011-05-23 05:20:51 by T21 T21
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
added on the 2011-05-23 10:57:44 by psonice psonice
It's also buggy as fuck :)
added on the 2011-05-23 11:32:57 by las las
How does simple raymarching work with SDL?
I've setup a SDL window with OpenGL in C++, but where do I start from here?
added on the 2011-05-24 13:36:09 by pinda pinda
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.
added on the 2011-05-24 13:58:02 by psonice psonice
4. PROFIT!!!!!
added on the 2011-05-24 13:59:51 by raer raer
Damn! I always forget the profit!
added on the 2011-05-24 14:07:51 by psonice psonice
This is what I have right now.
Is this okay? And what do I have to do from here?
added on the 2011-05-24 15:37:42 by pinda pinda
Learn about shaders
added on the 2011-05-24 15:40:05 by ferris ferris
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)


;)
added on the 2011-05-24 15:54:01 by flure flure
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!!!!!
added on the 2011-05-24 16:09:27 by raer raer
@flure: which doesn't matter to the compiler, i.e. same piece of code at the end (unless the compiler sucks ass)
added on the 2011-05-24 16:20:25 by toxie toxie
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:
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.
added on the 2011-05-24 16:23:07 by las las
@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...
added on the 2011-05-24 16:28:28 by flure flure
flure:
Code: if (init_GL() == false)

is better readable for java-pussy-coders.
added on the 2011-05-24 16:47:47 by las las
@las : I think you totally got to the point. java-pussy coders...
added on the 2011-05-24 16:50:54 by flure flure
then i must be a java-pussy, too.. oh noes.. ;)
added on the 2011-05-24 16:56:02 by toxie toxie
Is there anything better/newer than FX Composer?
added on the 2011-05-24 17:06:04 by las las
if (init_GL() == false)

is a lot more readable if you regularly use an exclamation mark at the start of your method names too.
added on the 2011-05-24 17:09:35 by psonice psonice
@psonice : yeah, and what you describe is quite common in C language ;)
added on the 2011-05-24 17:11:43 by flure flure
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)
added on the 2011-05-24 17:27:12 by xernobyl xernobyl
@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 ? ;)
added on the 2011-05-24 17:33:45 by flure flure
It depends on the type/return type.

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... ;)
added on the 2011-05-24 18:01:36 by raer raer
@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...
added on the 2011-05-24 18:11:08 by flure flure
It's a matter of style and does not belong here - use whatever you want.

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...
added on the 2011-05-24 18:48:16 by las las

login

Go to top