View Full Version : Scale geometry to fixed size in pixels

02-15-2012, 01:38 AM
I have a CAD like application and I am going to highlight certain areas of the scene by adding special geometries (spheres and others). I want the spheres to be drawn in a fixed size in pixels regardless of the size of the model that is loaded.

I have control over the object space coordinates of the spheres, but I am unsure how to do the transformation in the vertex program so that the geometry always end up in the same size.

I am now using point sprites for this, but it does not look so good when the point sprite partially intersects with the model mesh geometry.

Any hints on good ways of doing this?


02-15-2012, 05:30 AM
have you tried using an orthographic projection instead of the usual perspective one?

02-15-2012, 02:02 PM
No, that's not what I meant.

Let's say I have a triangle mesh of a sphere, centered at (0,0,0) and with radius 1.0 in model space. I want to render this so that it always has the same screen space size, say 24x24 pixels, no matter how far into the scene it is. So it's like a point sprite, I just want to do it with a real triangle mesh.

How can I set up a transformation to achieve this?