Horde3D http://www.horde3d.org/forums/ |
|
Billboards http://www.horde3d.org/forums/viewtopic.php?f=2&t=1297 |
Page 1 of 1 |
Author: | CadetUmfer [ 03.11.2010, 17:02 ] |
Post subject: | Billboards |
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; } } |
Author: | marciano [ 03.11.2010, 23:05 ] |
Post subject: | Re: Billboards |
Thanks for sharing your code snippet. Some similar code can be found in the wiki. |
Author: | fredster1 [ 02.02.2011, 22:43 ] |
Post subject: | Re: Billboards |
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? |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |