Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 13:16

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Billboards
PostPosted: 03.11.2010, 17:02 
Offline

Joined: 09.05.2007, 23:57
Posts: 6
Location: Philadelphia, PA
Edit: got this working. Here's code to project world coords to normalize screen coords [-1, 1] so you can then feed them into h3dShowOverlay to get billboards.

Code:
void h3dutProject(H3DNode cameraNode, Vec3f world, float *x, float *y) {
   Matrix4f projMat;
   h3dGetCameraProjMat(cameraNode, projMat.x);

   const float *camTrans;
   h3dGetNodeTransMats( cameraNode, 0x0, &camTrans );      
   Matrix4f viewMat( camTrans );
   viewMat = viewMat.inverted();

   Matrix4f viewProjMat = projMat * viewMat;
   Vec3f screen = viewProjMat * world;
   if (x) {
      *x = screen.x / screen.z;
   }
   if (y) {
      *y = screen.y / screen.z;
   }
}


Top
 Profile  
Reply with quote  
 Post subject: Re: Billboards
PostPosted: 03.11.2010, 23:05 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Thanks for sharing your code snippet. Some similar code can be found in the wiki.


Top
 Profile  
Reply with quote  
 Post subject: Re: Billboards
PostPosted: 02.02.2011, 22:43 
Offline

Joined: 02.02.2011, 19:14
Posts: 5
While this works, the billboards only exist on the UI layer. It is not possible for a 3D Object to step in front of a billboard this way.

What would be the best way to implement actual billboards? A vector of 2D Quads that get their rotation recalculated relative to the camera with every drawcall?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group