Jump to content
  • Advertisement
Sign in to follow this  

Small Angle Problem in Billboarding & Impostor Rendering on GPU

This topic is 3710 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
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!