# How to draw 3d billboard fixed independent distance size?

This topic is 1148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How to draw 3d billboard fixed independent distance size?

I'm using this:

float viewAngle = 35.0 * 3.14/180.0 * 0.5;
float dist = length(billboardPosition - cameraPosition);
float ratio = screenWidth/screenHeight;
float size = dist * 2.0 * tan(viewAngle)/(screenWidth/ratio);
float scaleX = billboardWidth * size;
float scaleY = billboardHeight * size;

This works, but fixed billboard size little enlarges near the horizontal screen edges.

How to make it real constant size?

Could you plese describe it more clear, thanks))

##### Share on other sites

Its probably worth calculating the distance usianf a projection onto the view space forward vector

So

float dist = dot(billboardpos-cameraPosition, cameraFwd)

##### Share on other sites

Why not simply transform the 3d point into view space and create the quad directly in view space coordinates on this position with constant width and height.

Edited by Migi0027 (????)

##### Share on other sites

Thanks,  AliasBinman  , it works perfectly now!

1. 1
2. 2
Rutin
20
3. 3
khawk
16
4. 4
A4L
14
5. 5

• 11
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633755
• Total Posts
3013706
×