Horde3D

Next-Generation Graphics Engine
It is currently 20.04.2025, 22:11

All times are UTC + 1 hour




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: camera node
PostPosted: 31.12.2008, 00:09 
Offline

Joined: 16.10.2008, 01:02
Posts: 18
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 31.12.2008, 00:50 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
Have you tried attaching it to something inside the model node, like a joint or the actual mesh?


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 31.12.2008, 10:36 
Offline

Joined: 16.10.2008, 01:02
Posts: 18
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


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 01.01.2009, 21:54 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 02.01.2009, 13:02 
Offline

Joined: 16.10.2008, 01:02
Posts: 18
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 04.01.2009, 14:29 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 04.01.2009, 17:19 
Offline

Joined: 16.10.2008, 01:02
Posts: 18
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 04.01.2009, 21:46 
Offline

Joined: 16.10.2008, 01:02
Posts: 18
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 04.01.2009, 23:31 
Offline

Joined: 19.03.2008, 01:22
Posts: 79
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 04.01.2009, 23:43 
Offline

Joined: 16.10.2008, 01:02
Posts: 18
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 05.01.2009, 22:42 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: camera node
PostPosted: 06.01.2009, 02:57 
Offline

Joined: 16.10.2008, 01:02
Posts: 18
Thanks for fixing it so quick. ;) That will spare me a great deal of headache as I don't have to update the camera manually to follow my model.

By the way, I think the support here is great, especially as there are only a few people working on/with the engine. (yet...)


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 31 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:  
Powered by phpBB® Forum Software © phpBB Group