Jump to content
  • Advertisement
Sign in to follow this  
Mihumihu

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.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!