PDA

View Full Version : rotating faces to face the camera?



bsabiston
01-26-2013, 09:06 AM
Hello,

I want to draw an antialised wireframe cube, with lines of a certain width (greater than 1). In OpenglES 2, on my devices at least, this isn't supported.

I've had some success drawing 2D antialiased lines, by using the trick of drawing an extra rim of polygons along the edge, with the outermost vertices transparent.

But if I were to do that in 3D, the polygons comprising a line would form a flat ruler shape, and it would change depending on the angle I looked at it. I was thinking I might be able to get it to work by rotating the polygons to face the camera. Has anyone done that? Will it work to achieve what I want?

I think I would start with the 8 cube vertices. Then for each segment in the cube, I would create two more vertices at each endpoint, extending perpendicular to the segment on the plane facing the camera. Does that make sense? Anyone know how to compute those?

Thanks
Bob

bsabiston
01-30-2013, 09:09 AM
Nobody? What do most people do if they want to draw antialiased lines in 3D space?

tonyo_au
01-30-2013, 04:23 PM
Use multisampling and let the hardware do it for you.

bsabiston
02-06-2013, 11:56 AM
But if the 'lines' are in 3D, you still have the problem of them becoming invisible when seen edge-on.

tonyo_au
02-06-2013, 05:29 PM
Ah - you want wide lines - I have not used this but I think it is what you want
http://sebastien.hillaire.free.fr/demos/simplevolumeline/ (http://sebastien.hillaire.free.fr/demos/simplevolumeline/)

(http://sebastien.hillaire.free.fr/index.php?option=com_content&view=article&id=48&Itemid=30)

EDIT
better link

http://sebastien.hillaire.free.fr/index.php?option=com_content&view=article&id=48&Itemid=30

bsabiston
02-07-2013, 11:24 AM
Yes I think that is what I want! Unfortunately OpenGLES2 doesn't do geometry shaders, but that article mentions an earlier technique that does not need them.

Thanks,
Bob