Jump to content
  • Advertisement
Sign in to follow this  
Mihumihu

How to draw 3d billboard fixed independent distance size?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement

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

So

 

float dist = dot(billboardpos-cameraPosition, cameraFwd)

Share this post


Link to post
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 this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!