is there any way to rotate a billboard?
is there any way to rotate a billboard?
The subject pretty much says it all.
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
I just spent 3 weeks on this topic. i wanted to rotate a billboard along its z axis, yet still have it face the user. so a user would see a rectangle, then he would see a diamond after rotation.
I had zero luck.But there has to be a way to do it! I duplicated the Irrlicht billboard class and mucked around with matrix transforms, but no luck. I have a example from the freespace2 open sourcecode, but was never able to reproduce it.
I had zero luck.But there has to be a way to do it! I duplicated the Irrlicht billboard class and mucked around with matrix transforms, but no luck. I have a example from the freespace2 open sourcecode, but was never able to reproduce it.
wikipedia abridgement:
"CBillboardSceneNode.cpp" function "render", then u can see that the node
always rotate to the viewer...
use a userdefined scenenode instead of a billboard. take a look at theIn 3D computer graphics, to billboard is to rotate an object so that it faces the
viewer. A billboarded object is sometimes called an impostor.
"CBillboardSceneNode.cpp" function "render", then u can see that the node
always rotate to the viewer...
I have the code for a "RotatingBillboard". I think i saw the link in this forums, but cant remeber who is the author or where to find it again (couldnt get it by searching). I will post the code tomorrow (have no the code here).
The behaviour in the demo is the image of the sprite md2 (probably you saw it in the irr tutorials) and it changes depending on the angle the camera points the billboard.
I also think this is not a behaviour for a billboard, but its probably what youre looking for, isnt it?
@dhenton9000
sry i didnt see your threads (if there were any). Its easy to implement; just:
calculate the angle on the Y axis from the camera ray respect the Z axis. if angle is between A1 and A2, billboard shows Sprite1, if angle is beetween A2 and A3, billboard shows Sprite2... and so on.
Dont know if this is the implementation that i have, but think this way should work too.
As i said, wait for the code, will post tomorrow.
The behaviour in the demo is the image of the sprite md2 (probably you saw it in the irr tutorials) and it changes depending on the angle the camera points the billboard.
I also think this is not a behaviour for a billboard, but its probably what youre looking for, isnt it?
@dhenton9000
sry i didnt see your threads (if there were any). Its easy to implement; just:
calculate the angle on the Y axis from the camera ray respect the Z axis. if angle is between A1 and A2, billboard shows Sprite1, if angle is beetween A2 and A3, billboard shows Sprite2... and so on.
Dont know if this is the implementation that i have, but think this way should work too.
As i said, wait for the code, will post tomorrow.
Dont know if this is the kind of rotation you wanted, but take a look at:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=12251
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=12251
as i get it, luvcraft and dhenton9000 are meaning something else.
like this: standard-billboard-behaviour + rotation along an additional axis.
as an example: the rocking leaf-planes of idvinc's "SpeedTree"s (have a look at http://www.speedtree.com/html/speedtreert.htm )
your approach is like faking a 3d-object by using a billboard as e.g. RPC-technique (planes with animated texture depending on time-frame and/or camera-angle).
i just downloaded and tried your example. looks good. definitely have to look at the source.
luvcraft and dhenton9000, if you make progress in your approach, please let us know. i tried this myself (not in irrlicht though) and also failed...
cheers
like this: standard-billboard-behaviour + rotation along an additional axis.
as an example: the rocking leaf-planes of idvinc's "SpeedTree"s (have a look at http://www.speedtree.com/html/speedtreert.htm )
your approach is like faking a 3d-object by using a billboard as e.g. RPC-technique (planes with animated texture depending on time-frame and/or camera-angle).
i just downloaded and tried your example. looks good. definitely have to look at the source.
luvcraft and dhenton9000, if you make progress in your approach, please let us know. i tried this myself (not in irrlicht though) and also failed...
cheers