• Create Account

### #ActualGrumple

Posted 14 May 2012 - 11:44 AM

Hi,

I'm working on a project where I need to draw 2D icons in a 3D perspective projection. The idea is to position the icons correctly in the 3D scene, but to draw them with consistent pixel size regardless of distance from the camera. If you picture 'points of interest' in google maps, you will see what I'm after. Regardless of the map zoom level or camera 'distance from map', the points of interest icons maintain constant pixel size.

The icons themselves will just be standard textured billboards, always oriented to face the camera directly.

As far as I can tell, there are two basic approaches....one being to draw them as part of the perspective scene render, but calculate their height/width to cancel out distance from camera (ie make them bigger the farther from the camera they are using a reversal of the perspective projection), or to do a second render pass in an actual Ortho projection, where the widths and heights can be consistent. However, if my head is wrapped around the problem correctly, I wouldn't really save effort with an ortho projection as I would then have to do math to position things in a perspective projection manner within the viewport.

Would I be correct to say the logical method is to render the icons in perspective mode with the rest of the scene, but adjust the width/height of the billboards in a 'reverse perspective' calculation to compensate for distance from camera? Is there any other simple way to do this?

Thanks!

Edit: In hindsight this probably should have gone in the "Graphics Programming and Theory" forum instead of OpenGL..

### #1Grumple

Posted 14 May 2012 - 11:33 AM

Hi,

I'm working on a project where I need to draw 2D icons in a 3D perspective projection. The idea is to position the icons correctly in the 3D scene, but to draw them with consistent pixel size regardless of distance from the camera. If you picture 'points of interest' in google maps, you will see what I'm after. Regardless of the map zoom level or camera 'distance from map', the points of interest icons maintain constant pixel size.

The icons themselves will just be standard textured billboards, always oriented to face the camera directly.

As far as I can tell, there are two basic approaches....one being to draw them as part of the perspective scene render, but calculate their height/width to cancel out distance from camera (ie make them bigger the farther from the camera they are using a reversal of the perspective projection), or to do a second render pass in an actual Ortho projection, where the widths and heights can be consistent. However, if my head is wrapped around the problem correctly, I wouldn't really save effort with an ortho projection as I would then have to do math to position things in a perspective projection manner within the viewport.

Would I be correct to say the logical method is to render the icons in perspective mode with the rest of the scene, but adjust the width/height of the billboards in a 'reverse perspective' calculation to compensate for distance from camera? Is there any other simple way to do this?

Thanks!

PARTNERS