Hi Carsten,
I need a little help with understanding the material overriding process.
My scene graph looks like the following sketch:
root
|
MyStage
|
MaterialChunk-
OverrideGroup
|
Scene
|
Material
|
Geometry
At first, if the MyStage node is not present in the scene the idea of the
MaterialChunkOverride group is to provide a ShaderProgramChunk that is used for
all the geometry found below of the scene. Now, the stage MyStage should render
its child tree with a special shader (or without any shader) into some FBOs.
For instance shadows. Then, the shader of the MaterialChunkOverrideGroup should
take credit from the information provided by the stage.
Now, I have the impression, that I always have the MaterialChunkOverrideGroup
shader in the way when rendering into the FBOs. I.e. I am unable to force the
usage of my special stage material alone.
How, should I setup things correctly?
My stage goes as follows:
MyStage::renderEnter
{
...
//ract->disableDefaultPartition();
this->beginPartitionGroup(ract);
{
this->pushPartition(ract, RenderPartition::CopyAll);
{
this->pushPartition(ract);
{
RenderPartition* pPart = ract->getActivePartition();
pPart->setRenderTarget(data.pFBO);
...
// _lightPassMaterial is MaterialChunk with or without shader
chunk
pPart->overrideMaterial(_lightPassMaterial,
ract->getActNode()); // (*)
recurseFromThis(a);
ract->useNodeList(false);
pPart->overrideMaterial(NULL, ract->getActNode());
}
this->popPartition(a);
ract->pushState();
ract->addOverride(_myTexObj->getClassId() + iUnit, _myTexObj);
ract->addOverride(ShaderProgramChunk::getStaticClassId(),
_injectProgChunk);
this->recurseFromThis(ract); // (**)
ract->useNodeList(false);
ract->popState();
}
this->popPartition(ract);
}
this->endPartitionGroup(ract);
return Action::Skip;
}
Is this a sensible approach for what I have in mind?
Is my handling of the partition groups correct?
I still have not fully grasped, when I have to use the disableDefaultPartition
call and what is its intention.
Are all useNodeList(false) calls are necessary?
The code line (*) should completely setup my material for the special stage
rendering. How to force that?
Is the chunk overriding process generally problematic in the context of stages
and shaders?
Can I replace the material incl. shaders at line (*) somehow?
Is it correct for rendering the final scene to use the recurseFromThis call at
(**) or is it appropriate to leave the renderEnter function with a return
Continue?
Can you help me a little with this? Actually, I have come a long way and hope
to get around this to get my stage running.
Best,
Johannes
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users