How to create a solid object out of a quad rendered with an RGBA texture?


a texture with some shape defined in the alpha channel is rendered using a quad. Now, with enabled alphatesting just the pixels passing the alphatest are being rendered.
Now, I’m trying to build a solid object out of this. With solid I mean to render two quads in xy with different z and then “connect” the borders (alphatested!) of these two.
One solution would be first to find the contour(s) of the geometry “analytically” in the texture and then extrude these contour(s) to create the geometry. This is costly in computational time when the alpha values change interactively!
Is there any other (OpenGL-) way to get this solid object?
Any idea is appreciated!


Perhaps you can use 3D textures. I’ve never used them but check out this which has a tutorial and some sample code.


Thanks for your suggestion!
And what geometry should be rendered using a 3dtex? I still need the geometry to render the object! Using a 3dtex it could be done by doing some kind of volume rendering (e.g. rendering axis aligned slices). But when rotating you have to check the viewing direction and choose the correct rendering order (and even more things).
I’m actually looking for something “simple”.


Couldn’t you just render a cube (or a box) and use a 3D texture with transparent voxels? Essentially the same as in 2D.

No, rendering a cube will only generate pixels at the cube’s sides! So, you’ll only see the six sides of the 3dtexture at the corresponding sides of the cube!

Sorry I led you on a wild goose chase. I wonder if drawing the texture several times on top of eachother with a small offset in the “extrusion” direction will give you a good enough approximation of the effect you’re looking for. As long as your viewing direction isn’t too parallel to the texture-plane it might do the trick. It may even look cooler than expected :wink: . Otherwise, it looks like you are going to have to render the “sides” of the extruded shape.

How about some kind of vertex shader with texture lookup and a subdivided cube… don’t know exactly where to go with this, but it’s an idea…