Horde3D

Next-Generation Graphics Engine
It is currently 29.04.2024, 17:10

All times are UTC + 1 hour




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Multiple scenes?
PostPosted: 26.08.2008, 20:08 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
Is there any way to create multiple scenes using Horde3D?

Basically I want to have one main world, and another which gets rendered to a texture and then is displayed in the main world. Doing this by separating them by some distance, but leaving them in one scene would be hacky, and would contain quite some caveats.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 27.08.2008, 18:50 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
You can attatch several group nodes to the root that contain your scenes and can activate/deactivate them as required.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 28.08.2008, 16:03 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
Doesn't this make any occlusion culling impossible?


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 28.08.2008, 16:16 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
phoenix64 wrote:
Doesn't this make any occlusion culling impossible?
In general, it shouldn't make any difference - each render target has to do occlusion culling seperately anyway. Not sure about Horde's implementation.

Occlusion culling is of rather dubious benefit on many types of scene, so you might not miss it anyway ;)

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 28.08.2008, 18:46 
Offline

Joined: 04.04.2008, 16:28
Posts: 13
Quote:
You can attatch several group nodes to the root that contain your scenes and can activate/deactivate them as required.


I think maybe he wants to render both scenes concurrently, so how would that work?


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 28.08.2008, 20:43 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
lzdude69 wrote:
Quote:
You can attatch several group nodes to the root that contain your scenes and can activate/deactivate them as required.


I think maybe he wants to render both scenes concurrently, so how would that work?

In your main render loop:
Code:
root1->activate()
render()
root1->deactivate()

root2->activate()
render()
root2->deactivate()

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 25.08.2010, 20:25 
Offline

Joined: 26.08.2008, 18:48
Posts: 120
I've used the suggested method with earlier version of horde3d and it worked perfectly.

But now I have a problem with hidden nodes(I'm using activate(false) to hide nodes). When I'm activating the root1 node it
activates every children, even the hidden nodes.

Any idea how to workaround this?

Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 26.08.2010, 02:21 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
attila wrote:
now I have a problem with hidden nodes(I'm using activate(false) to hide nodes). When I'm activating the root1 node it
activates every children, even the hidden nodes.
The documentation says that h3dSetNodeActivation only affects the given node, not all the children as well, so I'd file that as a bug :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 26.08.2010, 20:11 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
The behavior that the children are affected as well is actually intended to keep a branch in a consistent state (if a parent is inactive, we don't have to visit the children). The documentation in the header was updated at some point but I guess the HTML file was not regenerated.

To solve your problem, I would suggest to introduce node flags. Something like h3dSetNodeFlags( node, H3DNodeFlags::NoDraw | H3DNodeFlags::NoCastShadow ). These flags would just affect a single node, although we could add an optional function parameter to apply the state recursively to all children.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 27.08.2010, 18:16 
Offline

Joined: 26.08.2008, 18:48
Posts: 120
Quote:
The behavior that the children are affected as well is actually intended to keep a branch in a consistent state (if a parent is inactive, we don't have to visit the children). The documentation in the header was updated at some point but I guess the HTML file was not regenerated.

I have some problem with this. The recursion of the whole subtree seems to be quite costly as I'm calling this per frame for each active camera. While I see that some kind of optimization is in the SetActivation function I think It can be quite confusing.
Code:
void SceneNode::setActivation( bool active )
{
   _active = active;
   
   // Set same activation state for children
   for( size_t i = 0, s = _children.size(); i < s; ++i )
   {
      if( _children[i]->_active != active ) _children[i]->setActivation( active );
   }
}

Root (active=true)
  - Node1  (active=false)
    -- Node1_1 (active=true)
    -- Node1_2 (active=false)
  - Node2  (active=true)

When I call SetActivation(false) for Root, Node1_1 isn't deactivated because Node1 is not active. I'm not sure if this is a problem as I dont know the visibility system works.

Code:
To solve your problem, I would suggest to introduce node flags. Something like h3dSetNodeFlags( node, H3DNodeFlags::NoDraw | H3DNodeFlags::NoCastShadow ). These flags would just affect a single node, although we could add an optional function parameter to apply the state recursively to all children.

I like this alternative. Thanks. This could be extended with NoRayCast too.

Maybe I should write this into another thread, namely "Get rid of scenegraph"
I think that simple scenegraph (probably multiple ones for multiple scenes) that just simply contains a list of nodes would be much easier to use. With current hierarchy of nodes I have a problem that when I remove a node every children is removed also even if I still would like to use them. So In my wrapper I simply disallowed this deep hierarchy. The hieararchy is only Root->Scene->Object.
Marciano: Any info on the state of the work on "Get rid of scenegraph"? Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 28.08.2010, 12:03 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
I agree that an architecture that is less scene graph centric would avoid the mentioned performance overhead and complications. As removing the scene graph is quite a huge refactoring and will require changing the model format, I think we have to release a Beta5 first to keep compatibility with the current editor and to give people a chance to adopt the improved content pipeline.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 17.09.2010, 13:34 
Offline

Joined: 11.09.2010, 20:21
Posts: 44
Location: Germany
I also like the idea of node flags, especially the example with the NoCastShadow flag, as for now you only can prevent shadow casting on a per-light or per-shader basis.

This flag system can also be used to enable/disable backface culling, because at the moment this can only be done on a per-context basis and as you cannot modify contexts by shader flags you have to write a speperate shader for two sided objects, despite the fact that two-sidedness is often model specific and can be handled in a shader quite easily by
Code:
if(!gl_FrontFacing) normal = -normal;
, possibly with a shader flag.

I'm sorry, if this is quite off-topic, but the mentioned flag-system is quite good for implementing this, in my opinion extremely missing, feature.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 20.09.2010, 20:18 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Hi Rauy, although "two-sided" is often most useful for special types of materials/shaders (e.g. vegetation), it can make sense to have it exposed in general as well. However, I would probably not begin mixing flags which are related to very different parts of the engine (culling/renderlists vs. render states). What could work though is if "two-sided" would be a special material flag which can overwrite the shader/FX culling mode.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple scenes?
PostPosted: 21.09.2010, 13:08 
Offline

Joined: 11.09.2010, 20:21
Posts: 44
Location: Germany
Quote:
What could work though is if "two-sided" would be a special material flag which can overwrite the shader/FX culling mode

That's also a good idea, as materials are model-specific anyway.


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

All times are UTC + 1 hour


Who is online

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