Jump to content
  • Advertisement
Sign in to follow this  
Niklaus

Small Angle Problem in Billboarding & Impostor Rendering on GPU

This topic is 3630 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

Dear GameDev community, I need to use Billboarding for rendering lots of people in Crowd Simulation. I have accomplished the part of creating quads rotated to the camera, without any problem. However, the code that selects suitable image from the impostor texture has problems on large areas. In other words, something goes wrong due to small angles. The code that I am using for that is very simple: float aoc = degrees(atan(c.y-o.y, length(c.xz-o.xz))); float boa = degrees(atan(c.z-o.z, c.x-o.x)) + 180; float angle = round( (boa/360.0) * 15.0); vec2 texCoord = gl_TexCoord[0].xy / 16.0; if (aoc<0.0) aoc = 0.0; float TV = round( (aoc/90.0) * 3.0) * 0.0625; texCoord = texCoord + vec2(angle * 0.0625,TV); In the code above, "o" is the position of object and "c" is the position of the camera. I am trying to calculate which image to select from the texture. I heard that Quaternions are used for handling such small angles. However, I do not have strong math background and do not know how to use it. Please help me, any support is strongly appreciated! Also, I will be really happy If you give example code with your explanations. Regards, Niklaus

Share this post


Link to post
Share on other sites
Advertisement
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!