Horde3D http://horde3d.org/forums/ |
|
camera node http://horde3d.org/forums/viewtopic.php?f=2&t=589 |
Page 1 of 1 |
Author: | spree [ 31.12.2008, 00:09 ] |
Post subject: | camera node |
Hi, I tried to attach the camera node to a ModelNode, containing an object I want to follow with the cam. Although this works, the Object is flickering all the time. When I detach the camera from the Node and make it follow that Node by applying the same translations to it it works without the flickering. Is there a way to get around the flicker AND have the camer node attached to another node? |
Author: | AcidFaucet [ 31.12.2008, 00:50 ] |
Post subject: | Re: camera node |
Have you tried attaching it to something inside the model node, like a joint or the actual mesh? |
Author: | spree [ 31.12.2008, 10:36 ] |
Post subject: | Re: camera node |
I extracted the MeshNode from the ModelNode and attached the cam to the Mesh, but it has the same flickering effect. update: It seems that this hast something to do with how fast the camera moves and also the framerate. If I reduce movement speed of the node containing the camera (without changing framerate) I get a better result. If I keep the movement speed constant and reduce the framerate, this also seems to make the model more stable. However, both of this solutions are not applicable for my app, as I need to move stuff at the speed of approx. 1 unit / 0.02s |
Author: | Volker [ 01.01.2009, 21:54 ] |
Post subject: | Re: camera node |
Maybe it has something to do with the occlusion culling (OcclusionCulling param of the camera) since this will be done with a delay of one frame. You may try to disable it for the cam and check if that flickering effect still occurs. |
Author: | spree [ 02.01.2009, 13:02 ] |
Post subject: | Re: camera node |
That doesn't seem to be the problem. Also to be more precise, by flickering I don't mean that the model is turned on and off, but it rather seems that the model's position changes randomly around its real position. In debug view you can see that, although it should only move along the z-axis the bounding box also moves by a small amount along the other axes. Because this happens really fast, it seems like it bounces around. |
Author: | marciano [ 04.01.2009, 14:29 ] |
Post subject: | Re: camera node |
Hmm, that problem needs further investigation but without a clear way to reproduce it we can't do much about it. Actually there should not be a problem with cameras attached to other nodes. |
Author: | spree [ 04.01.2009, 17:19 ] |
Post subject: | Re: camera node |
That's what I thought, as it was one of the mentioned features of the engine. ![]() I'll try to make a simple "tutorial-like" application, that reproduces the problem and post it here. |
Author: | spree [ 04.01.2009, 21:46 ] |
Post subject: | Re: camera node |
Ok, to reproduce this attach a model node, containing any model, to the RootNode. (I'm using the sphere from the examples) Then attach a camera node to your model node. Now in the main loop just do something like: static int x = 0; float pos = x++ / 2; setNodeTransform(_model, 0, 0, -pos, 0, 0, 0, 1, 1, 1); If you remove the divison from the code the sphere moves smooth. If you divide x by 2.0 instead of 2 it's also smooth. So I thought the problem would somehow occur because I was translating the node by the same amount in two consecutive frames. However, if I add code that only does a new render if "pos" actually changed the sphere seems to move smoother, but still has the occasional flicker. Any idea? I know, that using increasing int's isn't a very clever way to move things around, but it was the closest and easiest way to reproduce my specific situation. |
Author: | Vurlix [ 04.01.2009, 23:31 ] |
Post subject: | Re: camera node |
The problem has nothing to do with horde. Your variable x has type int, so the result of division is also of type int. So for example, 3 / 2 equals 1. The solution is to declare x as float instead of int or to cast x to float before dividing: (float) (x++) / 2. |
Author: | spree [ 04.01.2009, 23:43 ] |
Post subject: | Re: camera node |
I am aware of that... As I wrote in my post this piece of code is only the easiest example I could think of to simulate my specific case. However I still don't understand why this leads to the described effect. And no, converting x to a float doesn't solve the problem in my case. The main question seems to be why this works perfectly fine as long as the camera isn't attached to the model node. |
Author: | Volker [ 05.01.2009, 22:42 ] |
Post subject: | Re: camera node |
This seems to be a bug indeed! In CameraNode::genFrustum the update method is called only for the camera node, that does not take into account a changed parent transformation. If you replace the update() call with Modules::sceneMan().updateNodes(); it won't flicker anymore. I commit it to the SVN immediately. Thanks for reporting it. |
Author: | spree [ 06.01.2009, 02:57 ] |
Post subject: | Re: camera node |
Thanks for fixing it so quick. ![]() By the way, I think the support here is great, especially as there are only a few people working on/with the engine. (yet...) |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |