Nicolas Baillard | 27 Mar 15:42 2015
Picon

Stencil buffer to texture

Hello everyone.

I'm trying to use an RTT camera to write both the color buffer and the stencil buffer into textures. I tried this:

Code:
// Create texture the color buffer will be written to
osg::Texture2D* buffer = new osg::Texture2D();
buffer->setTextureSize(_w, _h);
buffer->setInternalFormat(GL_RGB);

// Create texture the stencil buffer will be written to
osg::Texture2D* stencil = new osg::Texture2D();
stencil->setTextureSize(_w, _h);
stencil->setInternalFormat(GL_DEPTH_STENCIL_EXT);

// Attach both textures to camera
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera->attach(osg::Camera::COLOR_BUFFER, buffer, 0, 0, false, 0, 0);
camera->attach(osg::Camera::PACKED_DEPTH_STENCIL_BUFFER, stencil, 0, 0, false, 0, 0);

It produces an error "RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd6".

I took a look at the osgpackeddepthstencil example. It does this:

Code:
camera->attach(osg::Camera::PACKED_DEPTH_STENCIL_BUFFER, GL_DEPTH_STENCIL_EXT);

instead of this:

Code:
(Continue reading)

Xia Baobao | 27 Mar 04:13 2015
Picon

Re: How to make the change of a dynamic node in another thread

Thank you. I didn't expect such detailed answer.
( It has been 2 months since the post. Sorry about replying such late. I have to do some other things for a
while. )
I have tried getBound(), but it doesn't work for me.
From your description, it seems getBound() is what I am looking for. I will paste my code in the following
reply, maybe you can help me find where my mistake is.
I have read osgterrain, but I don't see things about multi-thread.
Reading osgDB::DatabasePager is hard for me.
I am not very familiar with OSG, so sometimes I may not truly understand your meaning. I will try to learn
more. And I need more help here ^_^. 

robertosfield wrote:
> Hi Xia,
> 
> It's a bit late in the evening for me to go into the topic deeply.  
> 
> 
> It's not possible for us to know what is specifically going amiss in your case as the details are too scant,
the best we can do is provide some general pointers:
> 
> 
> For datasets with a large number of nodes and vertices the cost of computing the bounding volumes of the
geometries and nodes can be expensive enough to take up time in the update traversal if you just add the new
subgraph into the main scene graph without computing the bounding volumes in the separate thread. 
Calling subgraph->getBound() in your compute thread prior to move the node into the merge queue is one way
to avoid this issue.  This is what the osgDB::DatabasePager does, so have a look at
src/osgDB/DatabasePager.cpp if you want to see how a full blown mutli-threaded database works (it's
probably overkill for your specific needs though).
> 
> 
(Continue reading)

Leonardo Rocha | 25 Mar 21:57 2015
Picon

Negative Parallax

Hi,

I am working in a research project where the scene is rendered in two TVs with a 120 degree angle between them.
The objective is to emulate an hologram using 3d stereo vision and the fishtank formed by the TVs. I am
setting each view with different view and projection matrices, similar as described in Generalized
Perspective Projection by Robert Kooima,
using slave cameras. My questions are regarding the following: 

1) Is there any way to set a negative parallax to the entire scene while keeping fixed in the origin? This is
necessary to keep the scene fixed, and the only view transforms are the rotation of the view frustums in
order to align them with the TVs, as in the paper linked above.  I've already tried billboarding,  vextex
shader program, and setting the fusionDistance. Any good results so far.

2) Is there any way to set  the slave projection matrix (using the math described in the link), with
non-perpendicular offsets (of the projection pyramid) so I keep the main projection transform in the
main camera´s projection matrix (and use the standard slaveCallback, maybe)?

Thank you!

Cheers,
Leonardo

Ps. The image attached is old but shows the idea of the setup.

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

Attachments: 
http://forum.openscenegraph.org//files/stereo_frustum_165.png
(Continue reading)

Shayne Tueller | 25 Mar 21:12 2015
Picon

embed osgViewer into FLTK window...

All,

I'm trying to embed an osgViewer that has a transparent background into an FLTK main window. The embedded
osgViewer needs to have a transparent background so that I can see the parent window behind it.

Is this even possible?

What I'm trying to do is use the osgViewer as an overlay to render symbology on top of the main parent FLTK
window. I've looked at the osgViewerFLTK example and the osgHUD example but nothing has worked so far.

Any suggestions or help would be appreciated...

Shayne

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

Trajce Nikolov NICK | 25 Mar 17:04 2015
Picon

flash the DatabasePager on demmand

Hi community,

is there a way to flush (discard) the currently pending PagedLODs with a call? I read the class and didn;t found anything

Thanks a bunch as always!

Nick

--
trajce nikolov nick
<div><div dir="ltr">
<div>
<div>
<div>Hi community,<br><br>
</div>is there a way to flush (discard) the currently pending PagedLODs with a call? I read the class and didn;t found anything<br><br>
</div>Thanks a bunch as always!<br><br>
</div>Nick<br clear="all"><div><div><div><div>
<br>-- <br><div class="gmail_signature">trajce nikolov nick<br>
</div>
</div></div></div></div>
</div></div>
Lv Qing | 25 Mar 16:08 2015
Picon

How to rotate a osg::Text heading when camera changes?

Hi,

[Image: http://forum.osgearth.org/file/n7587273/无标题.jpg ]
... 
like pictures above,we use some icon to display a plane,this icon is osg::Text which using some special
fonts file.we dynamic set this plane's  heading  to this osg::Text,like the left picture ,if the camera
head to "north",this osg::Text looks like head to the plane's  heading.If we rotate the camera  a bit ,like
right pitcure ,it dosen't work. 
    I know the reason,but not to know how to solve it .is there some way to re-computer the osg::Text heading when
camera angle changes? 

Thank you!

Cheers,
Lv

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

_______________________________________________
osg-users mailing list
osg-users <at> lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Robin Wu | 25 Mar 02:28 2015
Picon

Properties in osg::Camera and values of gl_ModelViewMatrix seem out of sync.

Hi all,

Recently, I discovered a weird issue that the view/Proj matrix in the main camera updated by the default
cameramanipulator of osgViewer does not sync with the one I got in the shader, e.g gl_ModelViewMatrix,
gl_ProjectionMatrix. 

The following two code snippets produce different results. 
The first one is using the built in gl_ModelViewProjectionMatrix uniform passed in during renderingTraversals()

The second one is using the properties from _viewer->getCamera() as uniforms, e.g mainCamera->getViewMatrix().

Code:

void main()
{
 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Code:

uniform mat4 u_modelMatrix;
uniform mat4 u_viewMatrix;
uniform mat4 u_projMatrix;

mat4 getModelToWorldMatrix()
{
 return osg_ViewMatrixInverse * gl_ModelViewMatrix;
}

void main()
{
 gl_Position = u_projMatrix * u_viewMatrix * getModelToWorldMatrix() * gl_Vertex;
}

When overlapping the rendering results of the two shaders into one buffer, the second shader is
approximately one frame slower than the first one, making me doubt that the view/proj matrix managed by
the main camera is not synced with the one managed by the renderingTraversals(). 

This out of sync problem is also pronounced in Wang Rui's effectcompositor. In the ssao.xml demo, if you
turn on the analysis mode, you'll see that in the linearDepth buffer view, the depth is unstable
(flickering) when you zoom in and out quickly. 

The following is the code snippet from Rui's ssao.xml

Code:

void main(void)
{
 vec4 vecInEye = gl_ModelViewMatrix * gl_Vertex;
 depthValue = (-vecInEye.z - nearPlaneValue) / (farPlaneValue - nearPlaneValue);
 gl_Position = ftransform();
}

I suspect that the nearPlaneValue and farPlaneValue form the built-in projection matrix's uniforms are
somehow not synced with the corresponding ones in gl_ProjectionMatrix ( from ftransfrom() ); 

This problem bugs me for a long time. My current workaround is just using the manually supplied uniforms
from the main camera. But the extra computation of the modelviewprojecionmatrix is definitely a waste in
the vertex shader.

Any ideas?

Thank you. 

... 

Robin[/code]

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

Sascha Voth | 24 Mar 15:49 2015
Picon

Render into a QQuickFramebufferObject (osg / osgEarth)

Hi,

I'm trying to render a scene node in a QtQuickItem. For this I used the Qt example "Scene Graph - Rendering
FBOs" as a base template:

qtquick-scenegraph-textureinsgnode-fboinsgrenderer-cpp  <at>  qt.io

Additionally I found a Gists which does nearly the same thing I'm trying to achieve:

gist:9bf4cec0aee18fc6e27b

On construction I create an EmbeddedWindow and a Viewer, and setup my scene. Afterwards the
createFramebufferObject is used to allocate the FBO and resize the EmbeddedViewer and the Viewport.
Rendering is triggered with a frame() call inside the render function and the osg::Viewer is set up to run SingleThreaded.

As long as I use/add a simple osg::Node to the scene, e.g. cow.osg, everything seems to work fine. As soon I
start to change the CameraManipulator to osgEarth::Util::EarthManipulator and use a
osgearth::MapNode instead, the first drawn frame is black, and changes only on re-sizing and recreating
the FBO, but only once. Afterwards, the render function is called, but frame() seems to not render
anything anymore.

I suppose something gets messed up with the OpenGLContext or osgEarth does not work SingleThreaded, but
I'm currently not able to understand the problem as a whole. I even tried to create a new shared context like
rickyviking/qmlosg at github did, but could not get it to render a propre scene.

Any help would be appreciated!

Thank you!

Cheers,
Sascha

p.s.: I've tried different other approaches in advance, where many of them seem to be outdated or lacking
simple re-sizing functionality. My current implementation uses a QQuickItem which has a
re-implemented QSGSimpleTextureNode which shares an FBO with an osg::Camera. But i cannot manage to
resize the fbo texture ...

p.p.s.: Sorry for not posting the links directly, but "You must have 2 posts before you can post
URL's/Links." ...

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

Colin Cochran | 24 Mar 14:34 2015

Android ART

Hi,

Does OSG 3.2.1 support Android ART? Android Lollipop is around the corner and it only supports ART now :( 

Thank you!

Cheers,
Colin

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

John Ivar Haugland | 24 Mar 09:33 2015
Picon

Register object wrapper for osg::Geode

Hi, 

I notice that osg::Geode now inherits osg::Group instead of osg::Node. 

However, in the corresponsing serializer osg::Group is not mentioned in 
REGISTER_OBJECT_WRAPPER( Geode,
                         new osg::Geode,
                         osg::Geode,
                         "osg::Object osg::Node osg::Geode" )


Is this correct ? or should it be changed to 

REGISTER_OBJECT_WRAPPER( Geode,
                         new osg::Geode,
                         osg::Geode,
                         "osg::Object osg::Node osg::Group osg::Geode" )


Kind regards
John Ivar Haugland


<div><div dir="ltr">Hi,&nbsp;<div><br></div>
<div>I notice that osg::Geode now inherits osg::Group instead of osg::Node.&nbsp;</div>
<div><br></div>
<div>However, in the corresponsing serializer osg::Group is not mentioned in&nbsp;</div>
<div>REGISTER_OBJECT_WRAPPER( Geode,<br>
</div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new osg::Geode,</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;osg::Geode,</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"osg::Object osg::Node osg::Geode" )</div>
</div>
<div><br></div>
<div><br></div>
<div>Is this correct ? or should it be changed to&nbsp;</div>
<div>
<div><br></div>
<div>REGISTER_OBJECT_WRAPPER( Geode,<br>
</div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new osg::Geode,</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;osg::Geode,</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"osg::Object osg::Node osg::Group osg::Geode" )</div>
</div>
</div>
<div><br></div>
<div><br></div>
<div>Kind regards</div>
<div>John Ivar Haugland</div>
<div><br></div>
<div><br></div>
</div></div>
John Richardson | 23 Mar 22:18 2015
Picon

The OSG SIGGRAPH BOF train is leaving the station

AND WILL ARRIVE AT SIGGRAPH…

 

Birds of a Feather Session Title: OpenScenegraph BOF

Date: Wednesday August 12

Location: Los Angeles Convention Center

Time: 10:00 - 11:00 am

 

Note: and yes, I still am on the hook for pictures of past BOF’s and materials….

<EXCUSE

   INSERT EXCUSE HERE

/EXCUSE>

 

EXCUSE, the only XML tag you will ever need.

 

Last note:

<TRIP OVER YOURSELF RUSHING TO MAKE OSG BOF PRESENTATIONS

/ TRIP OVER YOURSELF RUSHING TO MAKE OSG BOF PRESENTATIONS >

 

TRIP OVER YOURSELF RUSHING TO MAKE OSG BOF PRESENTATIONS. Not the only necessary and sufficient XML tag, but occasionally useful as a supplemental and vicarious standards based enumeration…

 

John

<div><div class="WordSection1">
<p class="MsoNormal">AND WILL ARRIVE AT SIGGRAPH&hellip;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoPlainText">Birds of a Feather Session Title: OpenScenegraph BOF<p></p></p>
<p class="MsoPlainText">Date: Wednesday August 12<p></p></p>
<p class="MsoPlainText">Location: Los Angeles Convention Center<p></p></p>
<p class="MsoPlainText">Time: 10:00 - 11:00 am<p></p></p>
<p class="MsoPlainText"><p>&nbsp;</p></p>
<p class="MsoPlainText">Note: and yes, I still am on the hook for pictures of past BOF&rsquo;s and materials&hellip;.<p></p></p>
<p class="MsoPlainText">&lt;EXCUSE<p></p></p>
<p class="MsoPlainText">&nbsp;&nbsp; INSERT EXCUSE HERE<p></p></p>
<p class="MsoPlainText">/EXCUSE&gt;<p></p></p>
<p class="MsoPlainText"><p>&nbsp;</p></p>
<p class="MsoPlainText">EXCUSE, the only XML tag you will ever need.<p></p></p>
<p class="MsoPlainText"><p>&nbsp;</p></p>
<p class="MsoPlainText">Last note:<p></p></p>
<p class="MsoPlainText">&lt;TRIP OVER YOURSELF RUSHING TO MAKE OSG BOF PRESENTATIONS<p></p></p>
<p class="MsoPlainText"> / TRIP OVER YOURSELF RUSHING TO MAKE OSG BOF PRESENTATIONS &gt;<p></p></p>
<p class="MsoPlainText"><p>&nbsp;</p></p>
<p class="MsoPlainText">TRIP OVER YOURSELF RUSHING TO MAKE OSG BOF PRESENTATIONS. Not the only necessary and sufficient XML tag, but occasionally useful as a supplemental and vicarious standards based enumeration&hellip;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">John<p></p></p>
</div></div>

Gmane