PDA

View Full Version : Extrude shape on a bitmap



04-09-2003, 06:41 AM
I have an arbitary shape on a bitmap that I want to extrude. For simplicity let's say the shape is the letter 'a' but it could be any shape. Some of the shapes will be so complicated it would not be possible to use a series of line segments to outline the shape first and then convert to 3D. The bitmap is in RGBA format and all four channels have the letter 'a'. Assume shape has already been corrected with lighting and specular.

Let's say I want to extrude from the xy (z=0) plane to another parallel plane at z=30. The planes are guaranteed to be parallel but they could be rotated in any direction. Once the extrusion is done it should look like Playdoh forced out of a cookie cutter type plate.

Anyone have any idea how to do this? I know I can test the alpha channel with glAlphaFunc to determine what to draw but I don't know how to fill in the space between z=0 and z=30. I suppose I could render the quad several times in between z=0 and z=30 to get the shape but the sides would not be solid.

thanks in advance

Gavin
04-10-2003, 04:20 AM
You have to decide if you want to describe the outline of the shape just using vectors, ie. straight lines, or try to use higer order differentials (curves). For straight lines you can just pick random edge pixels and and then try and grow the straight line along the neighbouring edge pixels, keep accepting pixels for that line until the exceed some constraint. Maybe want to try a hough transform. There should be plenty of code out there for fitting lines to your edges. This is image processing/comp vision rather than opengl.
If you want a really simple bodge though...... for every pair of edge pixels draw a quad that extends in your z as well.... obviously this can get a bit sluggish....

Gavin
04-10-2003, 04:29 AM
by pair of edge pixels I meant adjoining