Re: [osg-users] Multipass RTT and near far plane computation

2011-12-30 Thread Sebastian Messerschmidt

Hi Again,

FYI: I was able to solve the problem partially.
If I set the second RTT pass to ABSOLUTE_RF and set the modelview matrix 
for the RTT2 in the main-camera initialDrawCallback and the projection 
in the clampProjectionCallback I get the correct depths. Unfortunately 
the transparent pass sort of lags 1 frame behind the RTT1.




Hello,

I've encountered a problem which I#m not able to solve easily.
In my current setup I have to separate the opaque geometry from the 
transparent ones. For this I set up two RTT-cameras that render to 
different texture targets and combine them afterwards.

This setup works really fine with near/far plane computation turned off.
Unfortunally this doesn't play well with bigger databases and 
openflight based terrains (as they use subfaces etc.)


If I setup the first RTT camera to render using near/far plane 
calculation set to other the DO_NOT_COMPUTE_NEAR_FAR I get wrong 
results in the transparent pass (or better the combination of 
transparent and opaque elements doesn't match in depth).
My idea why this is going wrong is, that the clampProjectionMatrix is 
applied at the first render stage only, so I tried to set the 
projection matrix for the second pass on my own by intercepting the 
drawCallback. Here it seems I get the unclamped projection matrix.
So my second try was to use the  ClampProjectionMatrixCallback of the 
first RTT stage to set the projection. This unfortunately didn't work 
either.

So I'm a bit lost. Below if tried to give a little overview of the setup.


MainCam
|
___RTT1 (RELATIVE_RF, opaque geometry)
|
___RTT2(RELATIVE_RF, transparent geometry)
|
__OutCamera(ABSOULTE_RF, Rendertarget = framebuffer, combines the 
textures written in RTT1 and RTT2)


As far I understand, the RELATIVE_RF will set the same viewpoint and 
projection as in the main-cam.
But what about the near/far computation? I have set it to the main-cam 
and tried the RTT1 cam aswell, but the projection for the RTT2 pass is 
just wrong when turning auto near/far computation on


Hope someone can help here.

cheers
Sebastian
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] simple window manager to reopen a window

2011-12-30 Thread Stephan Huber
Hi,

Am 30.12.11 10:48, schrieb Andrey Ibe:
> i was looking for some kind of window "onClose" callback function to allow me 
> to store the current window state (graphics contexts' traits) with position 
> and size, but i couldn't find any.

have you tried a custom event handler which handles
osgGA::GUIEventAdapter::CLOSE_WINDOW ?

Can't help with the other stuff.

cheers,
Stephan
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Multipass RTT and near far plane computation

2011-12-30 Thread Sebastian Messerschmidt

Hello,

I've encountered a problem which I#m not able to solve easily.
In my current setup I have to separate the opaque geometry from the 
transparent ones. For this I set up two RTT-cameras that render to 
different texture targets and combine them afterwards.

This setup works really fine with near/far plane computation turned off.
Unfortunally this doesn't play well with bigger databases and openflight 
based terrains (as they use subfaces etc.)


If I setup the first RTT camera to render using near/far plane 
calculation set to other the DO_NOT_COMPUTE_NEAR_FAR I get wrong results 
in the transparent pass (or better the combination of transparent and 
opaque elements doesn't match in depth).
My idea why this is going wrong is, that the clampProjectionMatrix is 
applied at the first render stage only, so I tried to set the projection 
matrix for the second pass on my own by intercepting the drawCallback. 
Here it seems I get the unclamped projection matrix.
So my second try was to use the  ClampProjectionMatrixCallback of the 
first RTT stage to set the projection. This unfortunately didn't work 
either.

So I'm a bit lost. Below if tried to give a little overview of the setup.


MainCam
|
___RTT1 (RELATIVE_RF, opaque geometry)
|
___RTT2(RELATIVE_RF, transparent geometry)
|
__OutCamera(ABSOULTE_RF, Rendertarget = framebuffer, combines the 
textures written in RTT1 and RTT2)


As far I understand, the RELATIVE_RF will set the same viewpoint and 
projection as in the main-cam.
But what about the near/far computation? I have set it to the main-cam 
and tried the RTT1 cam aswell, but the projection for the RTT2 pass is 
just wrong when turning auto near/far computation on


Hope someone can help here.

cheers
Sebastian
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] simple window manager to reopen a window

2011-12-30 Thread Andrey Ibe
Hi,

i'm trying to create some kind of window manager, which would allow me to open 
a certain pop-up window with RTT camera on request and later reopen it if it 
has been closed.

i was looking for some kind of window "onClose" callback function to allow me 
to store the current window state (graphics contexts' traits) with position and 
size, but i couldn't find any.

my RTT camera is stored in the window manager along with whole scene graph. i 
create the pop-up window at startup, as usual, then i test if it has been 
closed, which i can do using rttCamera->getGraphicsContext()->valid() method. i 
conditionally create a new context for the camera when the old one is invalid. 
then i call viewer->realize() and i get the window i wanted. but i am getting 
this error:

Code:

invalid contextStandardManipulator::handleFrame(): Event error - Time going back
ward!
   Current event time: 0.0671157 previous event time: 6.60098



i need to get rid of this error. if i do not call the ->realize() method, i get 
tons of openGL errors and no window pops' up. btw, i am using a composite 
viewer instance with a main view of the scene and a secondary pop-up window 
with rtt camera.

so my two questions - how do i get rid of the error and is there a way of 
storing information that would allow me to reopen a closed window in it's 
previous state? 

thank you guys very much in advance!
Andrey

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Shader that can calculate pixel depth in meters

2011-12-30 Thread Ethan Fahy
I need to write a GLSL shader that will be able to calculate the distance 
between the camera and the object being rendered by each pixel.  The catch is 
that I need those distances to be linear and they need to be in meters, 
reflecting the real geometry of my scene.  There are a number of guides out 
there describing the GLSL gl_FragCoord.z as giving the pixel depth in some 
non-linear coordinate eye-space, but as I am not a graphics programmer by trade 
I'm finding these guides very confusing.  This one looks like my best bet:
http://olivers.posterous.com/linear-depth-in-glsl-for-real
but I'm still not sure what the author means by "real" depth.  Any advice on 
this problem?  Thanks!

-Ethan

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Test ping

2011-12-30 Thread Chris 'Xenon' Hanson
  One Ping, Only, Vasilly.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
"There is no Truth. There is only Perception. To Perceive is to Exist." - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org