Volume Ray Casting in BGE (blend included)

I have been working on this for a quite a while, mostly trying to find a way to render back/front faces of an object in single pass and to extract volumetric data from 2D texture.
Now it has all been solved and here is the result. Now we can have medical imaging in BGE :slight_smile:

i`ll just paste the text from my blog:
Hey, I got volumetric ray casting to work in Blender Game Engine. The shader is fully done in GLSL, including front&back face calculation in single pass and 2D texture conversion to texture3D, so it should be reeaally easy to implement in every OpenGL supporting engine.

The blend. file is here:
DOWNLOAD (Warning! Crashes on ATI cards. debugging almost done… Thanks Mokazon!)
(note: disable mipmapping in Blender`s System settings, otherwise you will see some weirdness)

volume texture:

glsl fragment shader:

video is coming soon.

screenshots taken in BGE (click on the thumbnails to see them full-sized) :

different opacity values

simple sample dithering

So, anyone of you have done CT (computed tomography) lately? :wink:

Dude, I just had the creepiest Crash my Computer ever had – your Works are definitely nothing for poor owners of weak, old ATI Laptops! ._.’

well, hehe my strong Nvidia could not take my shaders anymore. Now I have an old and cheap graphics card myself.
Sorry for that, I got rid of any warning in the console, but still it has not been tested on other computers. I`ll try to find the cause of that as fast as I can.

Great work, you are really making exalting shaders for the bge!!

Interesting…Q seems to do something, but none of the numpad buttons do anything. Do i need to download the texture, or is the blend ready to go? I’m not getting any kind of X-Ray effect.

Windows XP, Nvidia GE force 7100

Texture is packed already.
numpad keys does change orientation and psoition of the clipping plane, but you have to enable it by pressing “Spacebar”

Sorry 'bout that. Clear as day in the instructions. Very cool effect. I could see this hooked up to a machine in an in game lab, where the player turns knobs etc to change the image. That would be one hell of a piece of eye candy in game. Outstanding

Amazing martinsh, I saw this on your blog couple of days ago, but that dam thing dont let me leave a message!!!
i really dont have any clue about how this works since its a simple texture!!! man this really blowed my mind!


Thanks guys,
I am still struggling to make this not to crash the AMD/ATI drivers. Though my friend has a laptop with AMD card and it runs fine on it. btw he sent me his CT scans of his head an I got it to work with the shader. So if anyone is interested I can make a tutorial how to convert the scans to a texture.

This ll be great, I hav eno words for that, I never saw such a thing!!! Thanks!

Amazing! What else I can say. Astonishing work as always

what the…? crazy! this’d be cool for cyberpunk augmentation stuff

This looks amazing!

Kudos martinsh! I’ve lost count of how often your work has inspired me, inspired me to keep going, especially when I’m just about to give up!

Lol I just noticed it’s been almost 5 years since this was posted. Man time really flies. hmmm…

What a hidden treasure we got here.
Man, you are far ahead of your time, incredible work.

Just was reading this thread and looks awesome. Link to blend is broken however, anybody have a copy?

Try this.

That’s the one! The volume itself is a little different though but thanks :smiley: