Re: [osg-users] Scene prerender for selecting parameters needed for cull and final screen render

2008-01-26 Thread Robert Osfield
Hi Wojciech,

I understand where you are coming from, unfortunately its a pretty
complex topic and one that really needs you to submerge yourself in it
to be able to really understand the issues - it really isn't a topic
that you can dip you toe in and out of.  Right now I have another
large task that it is pretty well consuming almost all my time and
intellectual capacity, I'm afraid there is little left for diving into
other meaty topics.

The best I can do is point you in the direction of work I've done in
the past that comes closest to view dependant render texture work -
and that's in the form of the OverlayNode's
VIEW_DEPENDENT_PERSPECTIVE_OVERLAY.  The code in
src/osgSim/OverlayNode.cpp does do some scene traversal to compute a
right bound between the view frustum and the scene.  The code isn't
yet producing great results all the time though so it looks like their
or corner cases I haven't accounted for yet, or just some bugs lurking
that I have found.

As I'm so short on time I can't really dive any deeper than this, good luck,

Robert.

On Jan 26, 2008 12:37 PM, Wojciech Lewandowski [EMAIL PROTECTED] wrote:
 Hi Robert,

 I am struggling with building decent ShadowMapping approach for flight sim
 application. Due to performance requirements I am hesistant to use multipass
 PSSM and I am trying to implement (one extra pass only) some kind of
 perspective shadow mapping derived algorithm. I went through Trapezoidal,
 Smallest Bounds, LisPSM. Effective computation of minimal shadow scene
 bounds  + LisPSM gave me fairly good results. But this apprach fails when I
 have badly conditioned database. Few huge drawables that are spread over
 whole terrain kill effectivness of minimal bounds computation. They have
 such big bounds that minimal bound computaion simply does not help at all,
 and I end up using camera frustum as shadow bounds.

 So now I am contemplating addition of one prerender pass (ie second extra
 pass ;-( ). This pass would be used for computation of minimal bounds of
 visible scene portion based on an depths rendered to texture. Problem is I
 would like to make this depth analysis pass before actual ShadowMap, Scene
 camera and TexGen setups are done during cull phase. In other words I would
 like to have the chance to do scene prerender culling and rendering before
 final scene culling and rendering. Is this possible ? Any suggestion for OSG
 examples to browse ?

 Currently my ShadowMap algorithm looks like this (its exactly the same
 control flow as in osgShadow::ShadowMap)

 My Shadow Map technique Cull
 Cull Scene Receiving Shadows for final Screen output render 
 stage
 Find Light source casting shadows
 Compute Bounds of Scene Receiving Shadow visible portion
 Setup Shadow Map camera View and Perspective matrices
 ( based on Scene Bounds and Light source )

 Cull Scene Casting Shadows for Shadow Map prerender stage
 Add shadow coordinates TexGen to final Screen output render 
 stage
 End My Shadow Map technique Cull

 Rendering of RenderStages is executed in following order
 Shadow Map prerender stage
 Final Screen render stage


 What I would like to achieve looks like this

 My next Shadow Map technique Cull
 Cull Scene Receiving Shadows for final Screen output
 Find Light source casting shadows

 Depth Analysis prerender pass
 Cull  Render scene producing Depth texture
 ( view and projection are the same as in Scene 
 Receiving Shadow pass,
 target texture resolution 8x-4x smaller than screen)

 Compute Bounds of Scene Receiving Shadows based on image 
 produced in Depth
 Analysis pass
 Setup Shadow Map camera View and Perspective matrices
 Cull Scene Casting Shadows for Shadow Map prerender
 Setup shadow coordinates TexGen for final Screen output
 End My next Shadow Map technique Cull

 Rendering of RenderStages is executed in following order
 Shadow Map prerender stage
 Final Screen render stage


 Cheers,
 Wojtek

 P.S. When I sort all the issues I could contribute some of this work
 (Minimal Bounds Shadow map, LisPSM) to osgShadow portfolio if you are
 interested.




 ___
 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] Scene prerender for selecting parameters needed for cull and final screen render

2008-01-26 Thread Wojciech Lewandowski

Hi Robert,

Well maybe I wrote too lengthy explanation for what I am after. I guess it
was bit confusing.
Maybe question should be: is this possible to nest both CULL/DRAW stages for
some prerender camera into my Shadow Map CULL method ? Thats basically what
I would like to do. I know I can insert some aditional CULL traversal of
some subgraph. The question is if I can also DRAW it ? I just want to
prerender a scene to a depth texture/image and analyze it before further
culling (and rendering) the rest of the shadow casting scene ? I am afraid
that OSG does not allow to perform draw stages untill all cameras cull
stages complete. Or does it ?

Cheers,
Wojtek

PS: I learned some tricks looking at OverlayNode and even use your
CustomPolytope. But I did not notice nested DRAW stage there. I think I did
good job on computing minimal bounds based on scene traversal and visible
drawable bounding boxes. I am actually scanning render bins after cull
traversal and build bounds around generated render leaves. Then I find
intersection with camera frustum and light frustum. CustomPolytope is good
for that. This method produces small shadow scene bounds when render leaves
(drawables) are much smaller than frustum volume. Unfortuantely my drawables
are quite huge, although also quite sparse. I could try to split them into
smaller chunks, but I don't  expect I would be able to shatter every
database I get. So I am looking for some worakround for the worst case.
Prerendering and analyzing scene depths is such workaround. I am also trying
to do this because many Shadow Maping papers suggest such aproach for
minimal shadow bounds computation. So out of curiostiy  I just want to do
this to get some comparison with scene traversal methods.

-Original Message-
From: Robert Osfield [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 26, 2008 9:06 PM
To: [EMAIL PROTECTED]; OpenSceneGraph Users
Subject: Re: [osg-users] Scene prerender for selecting parameters needed for
cull and final screen render


Hi Wojciech,

I understand where you are coming from, unfortunately its a pretty
complex topic and one that really needs you to submerge yourself in it
to be able to really understand the issues - it really isn't a topic
that you can dip you toe in and out of.  Right now I have another
large task that it is pretty well consuming almost all my time and
intellectual capacity, I'm afraid there is little left for diving into
other meaty topics.

The best I can do is point you in the direction of work I've done in
the past that comes closest to view dependant render texture work -
and that's in the form of the OverlayNode's
VIEW_DEPENDENT_PERSPECTIVE_OVERLAY.  The code in
src/osgSim/OverlayNode.cpp does do some scene traversal to compute a
right bound between the view frustum and the scene.  The code isn't
yet producing great results all the time though so it looks like their
or corner cases I haven't accounted for yet, or just some bugs lurking
that I have found.

As I'm so short on time I can't really dive any deeper than this, good luck,

Robert.

On Jan 26, 2008 12:37 PM, Wojciech Lewandowski [EMAIL PROTECTED]
wrote:
 Hi Robert,

 I am struggling with building decent ShadowMapping approach for flight sim
 application. Due to performance requirements I am hesistant to use
multipass
 PSSM and I am trying to implement (one extra pass only) some kind of
 perspective shadow mapping derived algorithm. I went through Trapezoidal,
 Smallest Bounds, LisPSM. Effective computation of minimal shadow scene
 bounds  + LisPSM gave me fairly good results. But this apprach fails when
I
 have badly conditioned database. Few huge drawables that are spread over
 whole terrain kill effectivness of minimal bounds computation. They have
 such big bounds that minimal bound computaion simply does not help at all,
 and I end up using camera frustum as shadow bounds.

 So now I am contemplating addition of one prerender pass (ie second extra
 pass ;-( ). This pass would be used for computation of minimal bounds of
 visible scene portion based on an depths rendered to texture. Problem is I
 would like to make this depth analysis pass before actual ShadowMap, Scene
 camera and TexGen setups are done during cull phase. In other words I
would
 like to have the chance to do scene prerender culling and rendering before
 final scene culling and rendering. Is this possible ? Any suggestion for
OSG
 examples to browse ?

 Currently my ShadowMap algorithm looks like this (its exactly the same
 control flow as in osgShadow::ShadowMap)

 My Shadow Map technique Cull
 Cull Scene Receiving Shadows for final Screen output
render stage
 Find Light source casting shadows
 Compute Bounds of Scene Receiving Shadow visible portion
 Setup Shadow Map camera View and Perspective matrices
 ( based on Scene Bounds and Light source )

 Cull Scene Casting Shadows for