GLSL realtime raytracer bauble

I found two weeks ago a good GLSL realtime ray tracing example on this site http://kioku.sys-k.net/4kgfxmon/howto/howto04.htm.
I modified it slightly to get it working in the BGE.
The raytracer calculate phong shading, shadows and reflection in realtime.

The shader overwrite the viewport and don’t visualize Blender objects. Everyting object is gernated in the GPU.


Attachments

Raytrace.blend (90.6 KB)

Wow did not know glsl shaders could create objects.

Impressive !

This looks really good. It would be amazing to implement it into blender. Just press a button…realtime reflections…yay. It seems to run really fast as well. There must be some limitations though.

from the screenshots it looks like a really cool feature :smiley:
its a shame intel graphics cards don’t support such cool things :’(
OFF TO GET A NVIDIA CARD!

I’m just getting a gray screen on OSX 10.8 with a Nvidia GTX 550ti

This is neat. Works on my MPB in windows, I haven’t tried OSX yet.

Quacky: It is just a glsl fragment shader applied as a 2D filter, so no mesh or material data. Still pretty cool, though.

Nvoid82: run blender from terminal (/Applications/blender.app/Contents/MacOS/blender), then preview the game and look at the terminal. Should be some information as to why it won’t compile. Probably just type cast issues. I could debug it in OSX later, if I remember.

So, can this be used for geoemtry, or would it just be useful to just do cool things like the example? (For a game menu for example)

@ Nvoid82. I am sorry about that. I know there are some problems on OSX. But I don’t have an Mac and so can’t test it.

@ martin.hedin. No not really with this shader. The objects are generated with mathematical equation. I is possible to write a code that automatically generate a shader from objects that are based on boolean operations (Blender boolean modifier).

Something like this on the screenshots is possible with boolean operations.




(1920x1080 photon tracing ~10 fps. The program is not from me)

But it is also possible to raytrace triangle geometry. I have a CUDA Ray Tracer that can raytrace triangle geometry (obj files) in realtime. But it is a little bit too slow for the moment (~16 fps) and I think my CUDA knowledge in is not good enough to speed up much more.


(Transparent Suzanne flat shaded)

Nice work. I am interested to see your code! Would you mind sharing it with us?

ERROR: 0:217: Incompatible types (int and float) in assignment (and no available implicit conversion)
ERROR: 0:224: Incompatible types (int and float) in assignment (and no available implicit conversion)
ERROR: 0:264: Incompatible types in initialization (and no available implicit conversion)
ERROR: 0:267: Use of undeclared identifier ‘seed’
ERROR: 0:267: Use of undeclared identifier ‘seed’
ERROR: 0:268: Use of undeclared identifier ‘seed’

These are the errors it displays.

@Jsewill
No. For the moment I don’t want to share the code.

@Nvoid82
I modified the shader and update the first post. Now it should work.
“Use Frame Rate” is off in the file. Turn it on if it run to fast.

HG1, you’re a magician! :wink:

Cool! It is working now, thanks.

I GOTTA TRY THIS!! :smiley:
(just hold on a sec).

Edit: cool beans!

Very neat! This runs perfectly smoothly (about 700-900 fps with vsync off, depending on what is on screen at the moment) on my GeForce 560 (hardly a top-of-the-line card these days). There is a slight flickery edge around the faces of the yellow cube, but it’s not very noticeable and there aren’t any other artifacts that I could see.

the same codes you can find it OPEN GL site…! under realtime raytrace…tutorials…!

Yes I know, there are many realtime raytracer sources out there. As I referenced in my first post, I only modified it slightly to get it working in the BGE. Look at the first post, there you can find a link from where I got the code.

@HG1 : come to IRC #blendercoders please ! now

WOW…I Cant Believe It…

Im Using An Acer ASPIRE 5738Z With Intel Pentium 2GB RAM 22 GHz…
And It Runs In 11 FPS Wow this script is amazing,it stil run fast even without graphic card