Discussion:
[osg-users] Stuck with applying an offset to projection matrix
Werner Modenbach
2018-06-25 10:10:46 UTC
Permalink
Hi all,

I'm experimenting with slave cameras for a while now and now I'm totally
stuck.
I'm doing a tiled display of a scene and for the main scene graph it
works fine with projection offset matrix on the slave cameras
and all cameras having a RELATIVE reference frame.
But my scene also has cameras with ABSOLUTE reference frame (i.e. a
background image).
The background is - of course - fully mapped on each tile.

In order to solve this I modified my vertex shader like that:

   
gl_Position=osg_ModelViewProjectionMatrix*projectionOffsetMatrix*osg_Vertex;


and I populate the projection offset matrix via uniform (same as slave
offset matrix). Unfortunately without the expected success.

For creation of osg_ModelViewPrtojectionMatrix I found this code:

    osg::Matrixd modelViewProjectionMatrix = modelMatrix * viewMatrix *
_camera->getProjectionMatrix();
    uniform->set(modelViewProjectionMatrix);

And in the updateSlaveImplementatiuon I see:

    _camera->setProjectionMatrix(view.getCamera()->getProjectionMatrix()
* _projectionOffset);

So where is my mistake? It should be obvious but it seems I'm blind here.

Many thanks

- Werner -
Robert Osfield
2018-06-25 11:38:38 UTC
Permalink
HI Werner,

It sounds like you are trying to resolve a problem at the low level
which you have created by setting things up incorrectly and the top
level.

So.. what you need to do is change how you are configuring things at
the top level. You don't clearly explain what task you are trying to
solve and what the main elements are in your scene graph. It kinda
sounds like a power wall configuration with a single background image
that you want to have applied.

Once you explain more clearly what you are trying to achieve - display
configuration, hardware configuration, what it's in the scene graph
that you want to appear, then we an have a bash at recommend how to
configuration the viewer and what you are doing within the scene
graph.

Robert.
Werner Modenbach
2018-06-25 11:52:38 UTC
Permalink
Hi Robert,

thanks for the quick reply.
What I actually need is a very high resolution screenshot from a
standard scene with
some objects displayed like bacxkground, HUD etc.
You are right in viewing at it like a powerwall with those objects being
spread over all screens.

I can easily get the correct result by temporary multiplying the
projection matices of the main
and all ABSOLUTE cameras with an offset matrix (like slave camera).
Doing a .frame(), reading the screenshot
and then doing the next tile.
As a result the screen flickers during this procedure.
My idea was using a slave camera bound to a pixelbuffer, applying an
offset matrix to that camera and at the
same time setting this offset matrix to a uniform with OVERRIDE. All
vertex shaders of ABSOLUTE cameras can
use this uniform to translate vertex positions.
So only the render pass of the slave camera will have those offsets.
Or do you know any better method for, let's say, rendering a screen quad
over many tiles?
I think my problem is the wrong usage of the offset matrix in the vertex
shader.

- Werner -
Post by Robert Osfield
HI Werner,
It sounds like you are trying to resolve a problem at the low level
which you have created by setting things up incorrectly and the top
level.
So.. what you need to do is change how you are configuring things at
the top level. You don't clearly explain what task you are trying to
solve and what the main elements are in your scene graph. It kinda
sounds like a power wall configuration with a single background image
that you want to have applied.
Once you explain more clearly what you are trying to achieve - display
configuration, hardware configuration, what it's in the scene graph
that you want to appear, then we an have a bash at recommend how to
configuration the viewer and what you are doing within the scene
graph.
Robert.
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Robert Osfield
2018-06-25 12:59:59 UTC
Permalink
Hi Werner,

What are you using the ABSOLUTE_RF Camera's for? My guess this is the
source of the problems, perhaps the approach you've take with this
works fine for a single viewport but breaks any form of
multi-viewport/window composition of the view.

Could you explain what the ABSOLUTE_RF Cameras are for?

Robert
Werner Modenbach
2018-06-25 15:33:04 UTC
Permalink
Hi Robert,

from your question I guess, I have a fundamental misunderstanding.
But from all the examples and from the OGS book I learned as follows:

If I want to show a hud I have to do it with a hud camera which has
reference frame ABSOLUTE_RF.
The same if I want to have a wallpaper in the background. I have to
create a textured screen quad and show it with camera with ABSOLUTE_RF.
ABSOLUTE_RF seems to be necessary if the object should not be
manipulated by the camera manipulator. Right?

I will be glad to learn if there is some other and more recommended way
to do it.

Many thanks for your never ending patience.

- Werner -
Post by Robert Osfield
Hi Werner,
What are you using the ABSOLUTE_RF Camera's for? My guess this is the
source of the problems, perhaps the approach you've take with this
works fine for a single viewport but breaks any form of
multi-viewport/window composition of the view.
Could you explain what the ABSOLUTE_RF Cameras are for?
Robert
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
*TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen*
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: ***@texion.eu
Robert Osfield
2018-06-25 15:48:56 UTC
Permalink
Hi Werner,

Using a ABSOLUTE_RF for a backgrouind image is a simply way of
implementing this type of feature but has it's limitations - it means
it won't work with anything other than a single window.

If you plan to have a view that can be composed of multiple
viewport/windows then the ABSOLUTE_RF technique is no longer
appropriate.

So the question now is how you should implement the background image.
One technique would be to place the geometry under a RELATIVE_RF
transform rather than a ABSOLUTE_RF Camera that resets the projection
and view matrices.

Robert.
On Mon, 25 Jun 2018 at 16:33, Werner Modenbach
Post by Werner Modenbach
Hi Robert,
from your question I guess, I have a fundamental misunderstanding.
If I want to show a hud I have to do it with a hud camera which has reference frame ABSOLUTE_RF.
The same if I want to have a wallpaper in the background. I have to create a textured screen quad and show it with camera with ABSOLUTE_RF.
ABSOLUTE_RF seems to be necessary if the object should not be manipulated by the camera manipulator. Right?
I will be glad to learn if there is some other and more recommended way to do it.
Many thanks for your never ending patience.
- Werner -
Hi Werner,
What are you using the ABSOLUTE_RF Camera's for? My guess this is the
source of the problems, perhaps the approach you've take with this
works fine for a single viewport but breaks any form of
multi-viewport/window composition of the view.
Could you explain what the ABSOLUTE_RF Cameras are for?
Robert
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Loading...