So a while ago, I was working on a 3D voxel terrain engine (as seen in Commanche and Armored Fist), all done using pixel shaders.
The terrain stuff all works fine, but I never figured out how to properly position sprites within the 3D environment, and so I abandoned it (at least for now).
Like I said, this is unfinished, so some stuff won't work properly (mostly the stuff related to sprites) and there's no documentation or anything - you can do what you like with it, but you're basically on your own. Enjoy
Oh, and if anyone should happen to figure out how to position sprites properly, please let me know
Ooh, man! This is all kinds of awesome!
Even without being able to place sprites, this would make for some great stage backgrounds!
I see you've got the Active Object being occluded by the ground in your images there. Are you rendering the Active Object into your terrain object in the same shader to get that to happen? Or have you got a separate shader for the Active Object that uses the same terrain data?
Terrain occlusion was one of the things that bugged me about using the old Mode 7 Object. There was no easy way to do it, and my crummy workarounds always fell short of "acceptable".
But man, what you've put together here is really impressive!
The occlusion works using "depth buffering" in the shaders. It's an experimental feature that Clickteam added in a recent update, but never actually told anyone about!
Normally, shaders just output a color and alpha value for each pixel, but with depth buffering, they can be made to also output a depth value for each pixel, which determines how individual pixels (not just whole objects) are layered. Since the voxel terrain shader uses raycasting, it's very easy to calculate this depth value.
The active is just a normal active, but with a simple shader to enable depth buffering, and set the depth value (for the video, I just picked some arbitrary value).
The problem with all this, and I guess the reason Clickteam never went public with it, is that depth buffering overrides normal object ordering, and even layers - and every object in the game needs to have a shader to set its depth value.
Schrodinger (on the clickteam forums) and I, have been picking each other's brains a bit, so expect a big announcement from him sometime soon, related to all this...
Yeah, they're very impressive!
Schrodinger's displacement maps work in exactly the same way as the terrain examples above. They don't offer quite the same performance or level of detail, as there's a lot of extra overhead in making them fit with the rest of the 3D engine, but because they do fit with the rest of the engine, that gives you a lot more versatility.