views:

606

answers:

4
+2  A: 

I'm not sure I would bother with a full 3D library for what you have above. Just generate a matrix of 3D points, generate the text with something like PIL, scan over it to find which points on the grid are raised, pick a random camera angle and then project the points into a 2D image and draw them with PIL to the final image.

That being said... you may be able to use VPython if you don't want to do the 3D math yourself.

Branden Hall
How do I "generate a matrix of 3d ponts"?
That would just be a list of tuples - each tuple would have 3 numbers - representing x, y and z.
Branden Hall
RobertW: Without any prior knowledge of 3D graphics at all this calls for quite a bit of readnig before you can try that one, I think.
Joey
yes , I would say you will need to implement whole matrix manipulations or vector rotations
Anurag Uniyal
I dont have knowledge of 3D graphics, but I do have much linear algebra knowledge.
It is true that it would require some basic knowledge of 3D to make this work, but I'm not sure that's a bad thing. These things will need to be generated on the fly, so the simpler the better.I just did a little bit of searching and found pyeuclid, a vector library for python that would do the job nicely.http://code.google.com/p/pyeuclidEssentially you would create a list of Vector3 points, and then create a Matrix4, apply some random rotations to it, and then multiply the vectors by the matrix. Then you handle the projection.
Branden Hall
For the projection bit, the wikipedia article on 3D projection gives you the basic equations you need. After that it's just a matter of applying them and fiddling with the angles of everything to make sure the CAPTCHA is always (human) readable.
Branden Hall
Yeah - If you have knowledge of linear algebra, then this shouldn't be terribly hard for you (and in fact, should be quite fun!). When I first learned linear I immediately started coding up basic 3D stuff. It's very cool to be able to apply more advanced math to problems you WANT to solve!
Branden Hall
+1  A: 

Use python bindings for opengl http://pyopengl.sourceforge.net/

create a 2d image of white color text over a black surface using PIL make a 3d grid from this, increase z of point where color is white, may be set z=color value, so by blurring image you can get real curves in z direction

create opengl triangle from these points, use wireframe mode while rendering

grab the opengl buffer into an image e.g. http://python-opengl-examples.blogspot.com/2009/04/render-to-texture.html

Anurag Uniyal
I would love to do this myself, given sufficient motivation ;)
Anurag Uniyal
+2  A: 

Another binding to consider for rendering with opengl is pyglet. Its best feature is that it is just one download. I think it contains everything you need to implement what Anurag spells out.

I will caution you that what you're trying to do is not exactly a simple first project in 3d graphics. If this is your first exposure to OpenGL, consider a series of tutorials like NeHe Tutorials and other help from the OpenGL website.

goger
+15  A: 
bpowah
+1 for sample code, this looks like a really nice start.
Kiv
+1 Flipping awesome. You nailed it!
Tom Leys
Very very nice. Exactly what I wanted. Thanks a lot! ( I got logged out, so I cant vote you for the answer :( ).
quilby