[osg-users] FBO-RTT doubt

Rômulo Cerqueira romulogcerqueira at gmail.com
Mon Apr 30 15:22:50 PDT 2018


Hi Folks!

I have developed a GPU-based underwater imaging sonar simulator for real-time applications (for further details please refer to my last paper (http://https://www.sciencedirect.com/science/article/pii/S0097849317301371)) using OSG + GLSL. The missing part is the reverberation effect, that can be represented by a ray-triangle intersection algorithm. This work uses precomputed information (normal and depth) during rasterization pipeline using shaders in order to calculate the simulated sonar data, however this way is restricted to primary reflections. To address the secondary reflections, I need to build a hybrid pipeline (rasterization and ray-triangle intersection), where the data computed in first shader (rasterization) will be used in second one (ray-triangle intersection) to produce the final precomputed information (normal and depth from both reflections). Once the data computed on fragment shader is not pixel level yet (they are ¨fragments¨), it is necessary to use the 
 FBO-RTT to allow two shader passes:

FIRST PASS
-> output: primary reflections (as RTT texture)
SECOND PASS
-> output: RTT texture + secondary reflections (as fragment out vec4 data)

My main C++ classes are: NormaDepthMap, responsible by OSG node and shaders; and ImageViewCaptureTool, where the camera with GraphicsContext is configured (e.g. resolution and field-of-view) and the scene/shader image is grabbed from NormalDepthMap. I investigated a lot the related OSG examples (osgdeferred, osgmultiplerendertargets, osgprerender and stereomatch) and I`m aware how the FBO-RTT works, where each RTT texture needs one PRE_RENDER camera. My question is: how can I set the FBO-RTT setup for my scenario, once I have the main camera defined at ImageViewCaptureTool and the shaders at NormalDepthMap?

I already have the source codes to implement the RTT (from osgCookbook):
https://github.com/openscenegraph/OpenSceneGraph/blob/master/examples/osgdeferred/osgdeferred.cpp#L161

Source codes:
- NormalDepthMap.hpp:           https://github.com/Brazilian-Institute-of-Robotics/simulation-normal_depth_map/blob/master/src/NormalDepthMap.hpp
- NormalDepthMap.cpp:           https://github.com/Brazilian-Institute-of-Robotics/simulation-normal_depth_map/blob/master/src/NormalDepthMap.cpp
- ImageViewerCaptureTool.hpp:   https://github.com/Brazilian-Institute-of-Robotics/simulation-normal_depth_map/blob/master/src/ImageViewerCaptureTool.hpp
- ImageViewerCaptureTool.cpp:   https://github.com/Brazilian-Institute-of-Robotics/simulation-normal_depth_map/blob/master/src/ImageViewerCaptureTool.cpp

Thanks in advance,

Rômulo Cerqueira[/url]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73530#73530







More information about the osg-users mailing list