Horde3D

Next-Generation Graphics Engine
It is currently 08.05.2024, 00:06

All times are UTC + 1 hour




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: 19.01.2011, 10:42 
Offline

Joined: 29.10.2010, 14:28
Posts: 46
Location: Hungary
Quote:
anchor, what happens if you simply remove the geometry resource and set the node invisible?
Do not remove the Node.
Then when the node becomes visible again, load the geometry resource again.


Then the resource can not freed. (the scene node referenced the resource too)

anchor


Top
 Profile  
Reply with quote  
PostPosted: 19.01.2011, 16:26 
Offline

Joined: 08.11.2010, 10:46
Posts: 35
Having thought about it, this is my best idea.

Firstly, as the mesh is read-only you will need to create a new mesh node every time you use a new geometry.
So when the node becomes invisible only remove the (child) mesh node, but not the (parent) model node. The model node can set the geometry to the static dummy geometry.
Quote:
Then the resource can not freed. (the scene node referenced the resource too)
Hopefully when you remove the mesh node and when you change the model node geometry to the dummy geometry with
Code:
h3dRemoveNode( meshNode );
h3dSetNodeParamI( modelNode, H3DModel::GeoResI, dummyGeometryResource );
it will decrease the reference count to the geometry each time.
If not, try using
Code:
int h3dRemoveResource( H3DRes res );
to decrease the reference count. The function returns the reference count, so you can know how many more times it may need to be called.

After doing the above, unload the geometry resource.
I assume that you are using h3dReleaseUnusedResources regularly to free the resources ?

When the node is becoming visible again you load the geometry and then attach the loaded geometry to the parent model node using h3dSetNodeParamI again.
Then create a new mesh node and attach to the model node.


Top
 Profile  
Reply with quote  
PostPosted: 20.01.2011, 05:02 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
vikingcode wrote:
After doing the above, unload the geometry resource.
I assume that you are using h3dReleaseUnusedResources regularly to free the resources ?

When the node is becoming visible again you load the geometry and then attach the loaded geometry to the parent model node using h3dSetNodeParamI again.
Then create a new mesh node and attach to the model node.
May be I'm getting you wrong, but wouldn't these loading / unloadings hurt the performance ?

Regards, Siavash.


Top
 Profile  
Reply with quote  
PostPosted: 20.01.2011, 07:19 
Offline

Joined: 08.11.2010, 10:46
Posts: 35
Siavash wrote:
May be I'm getting you wrong, but wouldn't these loading / unloadings hurt the performance ?

No you are getting me right. Yes they hurt the performance but it is necessary.
He needs to unload the resources because he needs to unload them from the Video Card memory.
If you read this thread of posts from the start you should see why.


Top
 Profile  
Reply with quote  
PostPosted: 20.01.2011, 08:14 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
vikingcode wrote:
No you are getting me right. Yes they hurt the performance but it is necessary.
He needs to unload the resources because he needs to unload them from the Video Card memory.
If you read this thread of posts from the start you should see why.
Actually performance drops will show themselves when the scene goes more complicated [in future], but a few trees here and there won't hurt too much.

Another improvement is to partition the scene like old games, loading the rest of scene when player reaches a check point then freeing the unused resources.

Regards to the shadow problems, you can increase the shadow map count/size. IIRC there is [or would be?] a switch to tell the engine which objects should cast shadow, it would help to improve the shadow quality. I would suggest to bake the shadows for static objects [like trees and ...]

Regards, Siavash.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 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