Hello,
referring to an earlier question of mine on how to implement multi-pass
rendering for Depth-Peeling i followed your advice and created a custom
stage core similar to the HDR stage.
I looked at the source and tried to come up with an implementation but i
did not succeed in getting it to work.
Basically it looks like this:
DepthPeelingStage::renderEnter(Action* action)
{
beginPartitionGroup
pushPartition
//init similar to HDR implementation
setRenderTarget(myFBO)
renderPartition->setBackground(background);
background->clear()
//initialize depth buffer: draw Scene
this->recurseFromThis()
for (number of passes)
{
setRenderTarget(myOtherFBO)
setBackground(...)
background->setAlpha(...)
background->clear()
renderPartition->pushState()
//set new state for pass i: add blend, texture and depth chunks
renderPartition->addOverride(...)
this->recurseFromThis()
renderPartition->popState()
//Post process: draw quad textured with contents of this pass
//similar to HDR stage implementation
pushPartition()
//setup projection
RenderPartition::SimpleDrawCallback f;
f = boost::bind(&DepthPeelingStage::postProcess,
this, _1);
popPartition()
}
popPartition
endPartitionGroup
}
DepthPeelingStage::postProcess(DrawEnv*)
{
//get data
//activate FBO if not final
//activate material state
//draw quad with glBegin()/glEnd()
//deactivate material state
//deactivate FBO
}
With this setup the scene gets rendered to a texture which is displayed by
the quad but i do not see effects of other passes.
Therefore, i have several questions, hopefully you could help me
understand the internals of OpenSG better:
- Does this sound like a valid setup with the main work done in
renderEnter()?
- Why is the SimpleCallback required? Could postProcess not be called
directly within renderEnter()? When is the callback executed in regards to
the for-loop?
- What does a RenderPartition do? When do you have to call
beginPartitionGroup() and pushPartition()? Does each render pass have to
be wrapped in such a pair or does it suffice to call these at the begin
and end of renderEnter()
- How could i have a texture that is set up within this stage available in
the shader code of the user? I tried:
pRenderPartition->addOverride(pTextureObjChunk->getClassId(),
pTextureObjChunk);
followed by the call to recurseFromThis() but this showed no effect. I
replaced pTextureObjChunk->getClassId() with 0 or 1 since i assumed this
would set the texture unit but that did not work either.
- The HDR stage and others use direct OpenGL calls. Can any FC
implementation call arbitrary OpenGL functions that work in a distributed
environment?
I look forward to any answer. My concern is to have a way to correctly
display transparent geometry within OpenSG.
As a last note, what is required to integrate new OpenGL functions into
OpenSG? More specifically if the functionality of glBindImageTexture() was
available in OpenSG, the A-Buffer algorithm (see Cyril Crassin's approach:
http://blog.icare3d.org/2010/06/fast-and-accurate-single-pass-buffer.html)
could be used and multiple render passes would not be required any longer
for correct transparency.
Thanks.
Kind regards,
Alexander Lang
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users