How to draw 3d billboard fixed independent distance size?

Started by
2 comments, last by Mihumihu 8 years, 5 months ago

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))
Advertisement

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

So

float dist = dot(billboardpos-cameraPosition, cameraFwd)

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.

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

Thanks, biggrin.png AliasBinman biggrin.png , it works perfectly now!

This topic is closed to new replies.

Advertisement