Discussion:
[Opensg-users] OpenSG 2 - COLLADA animation support - shadows and clustering
Victor Haefner
2014-06-02 17:47:06 UTC
Permalink
Hi Carsten,


Thanks a lot for the reply, knowing where to find the animation data helps
a lot.

I tried to debug the shadows on cluster applications and I am somewhat
stuck.

Using gDEBugger I can confirm that the shadow map is like scrambled..
I am not sure how to eliminate bad bounding volumes, I tried

Vec3f min,max;
root->getNode()->updateVolume();
root->getNode()->getVolume().getBounds( min, max );

for each frame, but this did not help.
Is it possible to have wrong bounding volumes for the cluster application
but not for the local application? (everything looks perfect on the local
application)
Any hint on how to better debug?

Thanks again for the help!


Best regards,
Victor
Carsten Neumann
2014-06-03 09:37:52 UTC
Permalink
Hello Victor,
Post by Victor Haefner
I tried to debug the shadows on cluster applications and I am somewhat
stuck.
Using gDEBugger I can confirm that the shadow map is like scrambled..
I am not sure how to eliminate bad bounding volumes, I tried
Vec3f min,max;
root->getNode()->updateVolume();
root->getNode()->getVolume().getBounds( min, max );
for each frame, but this did not help.
Is it possible to have wrong bounding volumes for the cluster
application but not for the local application? (everything looks perfect
on the local application)
well, they shouldn't, but since something appears to go wrong... ;)
Perhaps as a quick way to confirm if this is actually the cause, you
could print the bounding boxes on the server machines and compare to
local ones?
Post by Victor Haefner
Any hint on how to better debug?
My approach for this sort of thing is often to insert some output at
strategic places in OpenSG to get a better idea which steps are being
performed, e.g. in the *ShadowTreeHandler class for the mode of the
ShadowStage that you use, check if the all steps of the algorithm run,
and if they use sane settings. Comparing the projections used when
running in the cluster vs. locally could give another hint if the
bounding boxes are off.
I would suggest trying to find out first if the shadow map is broken
because it is rendered at very low resolution (i.e. with a giant frustum
for the projection) or if the generation step is perhaps not run at all
(or at the wrong time).

Cheers,
Carsten
Victor Haefner
2014-06-04 16:19:47 UTC
Permalink
Hi Carsten,

I got the bounding volume from the scene on the cluster server, it looks
perfect
here how I did it, hope its fine:
Vec3f min,max;
window->getPort(0)->getRoot()->getVolume().getBounds(min, max);
cout << max-min;

Then I tried to find where the shadow code is happening..
I put a breakpoint in every function in OSGShadowTreeHandler.cpp without
success.
I also tried each render function from all the other files in the same
folder without success.

Where should the magic happen? I tried to follow the render action step by
step.. but soon gave up :/ ..perhapst knowing at what point in time the
shadows are done might help, I mean if it is after the render action goes
through all the nodes once? or when entering the light node? etc..

Best regards,
Victor
Carsten Neumann
2014-06-05 07:35:03 UTC
Permalink
Hello Victor,
Post by Victor Haefner
I got the bounding volume from the scene on the cluster server, it looks
perfect
Vec3f min,max;
window->getPort(0)->getRoot()->getVolume().getBounds(min, max);
cout << max-min;
ok, that would rule out a problem with the bounding volumes and hence
the ShadowStage choosing poor projections for building the shadow maps.
Victor Haefner
2014-06-05 09:43:21 UTC
Permalink
Hello Carsten,

ShadowStage::renderEnter is not called, but are you sure it should get
called?
As I have written in my first post, I am using the SimpleShadowMapEngine.
I set a breakpoint in SimpleShadowMapEngine::runOnEnter and there it is,
this gets called :)

There the bvMask is allways 0, I don't know if it is important.

I will try to further dig into the code, its nice to learn something about
the inner workings of OpenSG :)

Best regards,
Victor
Victor Haefner
2014-06-05 14:01:25 UTC
Permalink
Found it! ..but I may need help to fix it correctly :)

I the function SimpleShadowMapEngine::doLightPass
I compared the values of pArea->getLeft (), pArea->getBottom(),
pArea->getRight (), pArea->getTop ()

pArea left, right, bottom and top are the normalized coordinates for the
master application and the pixel coordinates in the cluster server

Setting the values to 0,0,1,1 for pPart->calcViewportDimension showed the
correct shadows.
Any idea where the (wrong?) Viewport dimensions are coming from?


Best regards,
Victor
Victor Haefner
2014-06-05 14:52:46 UTC
Permalink
Hi,

Here a fix that works for me:

@@ -436,10 +436,11 @@ void
MultiDisplayWindow::serverRender(Window *window,
updateViewport(serverPort, clientPort);

// set viewport size
- serverPort->setSize(Real32(l),Real32(b),Real32(r),Real32(t));
+ //serverPort->setSize(Real32(l),Real32(b),Real32(r),Real32(t));
+
serverPort->setSize(Real32(l)/width,Real32(b)/height,Real32(r+1)/width,Real32(t+1)/height);

// use pixel even if pixel = 1
- if(serverPort->getLeft() == 1.0)
+ /*if(serverPort->getLeft() == 1.0)
serverPort->setLeft(1.0001f);

if(serverPort->getRight() == 1.0)
@@ -449,7 +450,7 @@ void MultiDisplayWindow::serverRender(Window
*window,
serverPort->setTop(1.0001f);

if(serverPort->getBottom() == 1.0)
- serverPort->setBottom(1.0001f);
+ serverPort->setBottom(1.0001f);*/

// calculate tile parameters
deco->setFullWidth ( cright-cleft );

Does it look right? The part I commented made the whole viewport black, I
don't know why..


Best regards,
Victor
Carsten Neumann
2014-06-06 08:41:34 UTC
Permalink
Hello Victor,
Post by Victor Haefner
@@ -436,10 +436,11 @@ void
MultiDisplayWindow::serverRender(Window *window,
updateViewport(serverPort, clientPort);
// set viewport size
- serverPort->setSize(Real32(l),Real32(b),Real32(r),Real32(t));
+ //serverPort->setSize(Real32(l),Real32(b),Real32(r),Real32(t));
+
serverPort->setSize(Real32(l)/width,Real32(b)/height,Real32(r+1)/width,Real32(t+1)/height);
// use pixel even if pixel = 1
- if(serverPort->getLeft() == 1.0)
+ /*if(serverPort->getLeft() == 1.0)
serverPort->setLeft(1.0001f);
if(serverPort->getRight() == 1.0)
@@ -449,7 +450,7 @@ void
MultiDisplayWindow::serverRender(Window *window,
serverPort->setTop(1.0001f);
if(serverPort->getBottom() == 1.0)
- serverPort->setBottom(1.0001f);
+ serverPort->setBottom(1.0001f);*/
// calculate tile parameters
deco->setFullWidth ( cright-cleft );
Does it look right? The part I commented made the whole viewport black,
I don't know why..
sorry about the mixup earlier regarding the use of ShadowStage vs.
ShadowEngine.
Viewports are supposed to allow the user to specify the size either in
pixels or relative coordinates (values > 1 are considered pixels, values
in [0,1] are relative) - that's the reason for the lines you commented,
the code wants to use pixels.
However, by the time the ShadowEngine is reached, the viewport
coordinates should have been normalized, which oddly is not happening in
your case on the render servers. I believe that is the real problem here
and will see if I find where things go wrong. Thanks for tracking things
down to viewport sizes being off!

Cheers,
Carsten
Carsten Neumann
2014-06-06 11:48:04 UTC
Permalink
[following up on myself...]

Hello Victor,
Post by Carsten Neumann
Post by Victor Haefner
Does it look right? The part I commented made the whole viewport black,
I don't know why..
sorry about the mixup earlier regarding the use of ShadowStage vs.
ShadowEngine.
Viewports are supposed to allow the user to specify the size either in
pixels or relative coordinates (values > 1 are considered pixels, values
in [0,1] are relative) - that's the reason for the lines you commented,
the code wants to use pixels.
However, by the time the ShadowEngine is reached, the viewport
coordinates should have been normalized, which oddly is not happening in
your case on the render servers. I believe that is the real problem here
and will see if I find where things go wrong. Thanks for tracking things
down to viewport sizes being off!
so it turns out this is actually much simpler: The SimpleShadowMapEngine
used the viewport settings from the application ([1]) to select the
viewport for rendering the shadow map. Instead it should just render to
all of the shadow map - after all in general the application viewport
size and the shadow map size have no relationship and can be arbitrarily
sized. I've committed the fix that makes the SSME work with
testClusterClient/Server for me.

Cheers,
Carsten
Victor Haefner
2014-06-06 16:59:04 UTC
Permalink
Hello Carsten,
Post by Carsten Neumann
so it turns out this is actually much simpler: The SimpleShadowMapEngine
used the viewport settings from the application ([1]) to select the
viewport for rendering the shadow map. Instead it should just render to
all of the shadow map - after all in general the application viewport
size and the shadow map size have no relationship and can be arbitrarily
sized. I've committed the fix that makes the SSME work with
testClusterClient/Server for me.
Thank you very much, this works for me, I checked if the viewport size has
any effect on
the result and it did not, also with more than one server for the
multiwindow everything looks fine.

Best regards,
Victor
Post by Carsten Neumann
[following up on myself...]
Hello Victor,
Post by Carsten Neumann
Post by Victor Haefner
Does it look right? The part I commented made the whole viewport black,
I don't know why..
sorry about the mixup earlier regarding the use of ShadowStage vs.
ShadowEngine.
Viewports are supposed to allow the user to specify the size either in
pixels or relative coordinates (values > 1 are considered pixels, values
in [0,1] are relative) - that's the reason for the lines you commented,
the code wants to use pixels.
However, by the time the ShadowEngine is reached, the viewport
coordinates should have been normalized, which oddly is not happening in
your case on the render servers. I believe that is the real problem here
and will see if I find where things go wrong. Thanks for tracking things
down to viewport sizes being off!
so it turns out this is actually much simpler: The SimpleShadowMapEngine
used the viewport settings from the application ([1]) to select the
viewport for rendering the shadow map. Instead it should just render to
all of the shadow map - after all in general the application viewport
size and the shadow map size have no relationship and can be arbitrarily
sized. I've committed the fix that makes the SSME work with
testClusterClient/Server for me.
Cheers,
Carsten
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Opensg-users mailing list
https://lists.sourceforge.net/lists/listinfo/opensg-users
Loading...