Horde3D
http://www.horde3d.org/forums/

Multiple scenes?
http://www.horde3d.org/forums/viewtopic.php?f=1&t=478
Page 1 of 1

Author:  phoenix64 [ 26.08.2008, 20:08 ]
Post subject:  Multiple scenes?

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.

Author:  marciano [ 27.08.2008, 18:50 ]
Post subject:  Re: Multiple scenes?

You can attatch several group nodes to the root that contain your scenes and can activate/deactivate them as required.

Author:  phoenix64 [ 28.08.2008, 16:03 ]
Post subject:  Re: Multiple scenes?

Doesn't this make any occlusion culling impossible?

Author:  swiftcoder [ 28.08.2008, 16:16 ]
Post subject:  Re: Multiple scenes?

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 ;)

Author:  lzdude69 [ 28.08.2008, 18:46 ]
Post subject:  Re: Multiple scenes?

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?

Author:  swiftcoder [ 28.08.2008, 20:43 ]
Post subject:  Re: Multiple scenes?

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()

Author:  attila [ 25.08.2010, 20:25 ]
Post subject:  Re: Multiple scenes?

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

Author:  DarkAngel [ 26.08.2010, 02:21 ]
Post subject:  Re: Multiple scenes?

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:

Author:  marciano [ 26.08.2010, 20:11 ]
Post subject:  Re: Multiple scenes?

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.

Author:  attila [ 27.08.2010, 18:16 ]
Post subject:  Re: Multiple scenes?

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

Author:  marciano [ 28.08.2010, 12:03 ]
Post subject:  Re: Multiple scenes?

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.

Author:  Rauy [ 17.09.2010, 13:34 ]
Post subject:  Re: Multiple scenes?

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.

Author:  marciano [ 20.09.2010, 20:18 ]
Post subject:  Re: Multiple scenes?

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.

Author:  Rauy [ 21.09.2010, 13:08 ]
Post subject:  Re: Multiple scenes?

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.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/