Hi,
Can anyone point me to techniques for drawing lines, with the mouse, on 3D objects in WebGL or OpenGL?
Can't seem to find anything so far.
Here's the effect I'm looking for, a cool demo by SpaceGoo on WebGL: http://www.spacegoo.com/cadillac/
I can imagine the general idea - projecting a ray onto the surface, then perhaps using normals and UVs, transform the intersections into UV-space and drawing the line on a texture, which gets mapped onto the object.
Would love to find some literature, tutorials or education code on it though.
cheers
Lindsay
--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
It is all WebGL without a framework.
There is an octree for the cadillacs, it is used to compute the
intersection between the mouse ray and the cadillac. Cadillac are mapped
with texture without overlapping (I used blender and a custom python
script to export the mesh).
When I have the point of intersection between the ray and the cadillac, I
also have the triangle face intersected and its summit ABC. And I have the
UV coordinates of A,B,C.
I use barycentric coordinates
(http://en.wikipedia.org/wiki/Barycentric_coordinate_system) to compute
the UV coordinates of the point. Then I use gl.texSubImage2D to draw the
brush on the texture (mipmap level 0), and I recompute mipmaps.
Every X seconds, I send with AJAX the modification to the server. The
server do the same thing using image magick, and you should also use a
filelock to avoid that the texture will be modified at the same time.
Check this out.
http://www.cartelle.nl/deathpaint/study/