Re: [osg-users] osgShadow question

2009-12-08 Thread Robert Osfield
Hi Nick,

On Tue, Dec 8, 2009 at 9:41 AM, Trajce Nikolov  wrote:
> SoftShadowMap

SoftShadowMap isn't view dependent to get good quality results you
have to restrict the size of the shadow casting part of the scene.

Try the view dependent techniques such as LightSpacePerspectiveShadowMap.

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


Re: [osg-users] osgShadow question

2009-12-08 Thread Trajce Nikolov
Hi RObert,


SoftShadowMap

Nick

http://www.linkedin.com/in/tnikolov


On Tue, Dec 8, 2009 at 11:20 AM, Robert Osfield wrote:

> On Tue, Dec 8, 2009 at 9:08 AM, Trajce Nikolov 
> wrote:
> > Hi Community,
> >
> > please appologize for asking again, since there was no feedback on this.
> Any
> > ideas about this?
>
> It's hard to guess at what is up with so little details.  Which
> ShadowTechniques have you tried?
>
> Robert.
>  ___
> 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] osgShadow question

2009-12-08 Thread Robert Osfield
On Tue, Dec 8, 2009 at 9:08 AM, Trajce Nikolov  wrote:
> Hi Community,
>
> please appologize for asking again, since there was no feedback on this. Any
> ideas about this?

It's hard to guess at what is up with so little details.  Which
ShadowTechniques have you tried?

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


Re: [osg-users] osgShadow question

2009-12-08 Thread Trajce Nikolov
Hi Community,

please appologize for asking again, since there was no feedback on this. Any
ideas about this?

Nick

http://www.linkedin.com/in/tnikolov


On Sat, Dec 5, 2009 at 2:30 PM, Trajce Nikolov wrote:

> Hi community.
>
> I am having some issues with shadowed scene. Imagine this scenario:
> - terrain as a shadow receiver
> - 1 moving model as shadow caster (the shadow looks good now)
> - adding additional moving models (now the shadow of the first one still
> looks great, but on all next models it is very blurry almost invisible)
>
> Any ideas, hints?
>
> Thanks a lot!
>
> Nick
>
> http://www.linkedin.com/in/tnikolov
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgShadow question

2009-12-05 Thread Trajce Nikolov
Hi community.

I am having some issues with shadowed scene. Imagine this scenario:
- terrain as a shadow receiver
- 1 moving model as shadow caster (the shadow looks good now)
- adding additional moving models (now the shadow of the first one still
looks great, but on all next models it is very blurry almost invisible)

Any ideas, hints?

Thanks a lot!

Nick

http://www.linkedin.com/in/tnikolov
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgShadow question

2009-11-11 Thread Wojciech Lewandowski

Hi J-S,

I have been bit swamped recently. I have restricted my policy to react only 
to LISPSM while being busy ;-). Besides, you are doing much better support 
than I could dream of. Thank You, btw.


Wojtek

--
From: "Jean-Sébastien Guay" 
Sent: Wednesday, November 11, 2009 9:07 PM
To: "OpenSceneGraph Users" 
Subject: Re: [osg-users] osgShadow question


Hi Wojtek,

I'm surprised the magic word to summon Wojtek ("shadows") took so much 
time this time! We've been discussing this for a few days now :-)


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
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] osgShadow question

2009-11-11 Thread Jean-Sébastien Guay

Hi Wojtek,

I'm surprised the magic word to summon Wojtek ("shadows") took so much 
time this time! We've been discussing this for a few days now :-)


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgShadow question

2009-11-11 Thread Wojciech Lewandowski

Hi

Debug hud shaders are only used by debug hud to display shadow map. These 
shaders should not bother you at all. They don't affect your scene, scene is 
drawn by mainVertex/mainFragment/shadowVertex/shadowFragment shaders. See 
osgshadow example with following options: -4 --lispsm --debugHUD and see 
what they do.


Wojtek

--
From: "Jean-Sébastien Guay" 
Sent: Wednesday, November 11, 2009 8:08 PM
To: "OpenSceneGraph Users" 
Subject: Re: [osg-users] osgShadow question


Hi Wyatt,


Oops... If I use the debug hud, then I need to use the
fragmentShaderSource_debugHUD and fragmentShaderSource_debugHUD_texcoord
shaders?


You're starting to go into the realm of questions you should be able to 
answer yourself, using the source and trying things out. I can't help you 
with every little detail.


In this case, I think those shaders are only used by the debugHUD itself, 
and so you shouldn't need to modify them even if you enable the debugHUD 
since they should not affect your scene. But I'm not sure, check the 
source to see where they're applied.


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
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] osgShadow question

2009-11-11 Thread Jean-Sébastien Guay

Hi Wyatt,


Oops... If I use the debug hud, then I need to use the
fragmentShaderSource_debugHUD and fragmentShaderSource_debugHUD_texcoord
shaders?


You're starting to go into the realm of questions you should be able to 
answer yourself, using the source and trying things out. I can't help 
you with every little detail.


In this case, I think those shaders are only used by the debugHUD 
itself, and so you shouldn't need to modify them even if you enable the 
debugHUD since they should not affect your scene. But I'm not sure, 
check the source to see where they're applied.


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgShadow question

2009-11-11 Thread Wyatt Earp
Oops... If I use the debug hud, then I need to use the
fragmentShaderSource_debugHUD and fragmentShaderSource_debugHUD_texcoord
shaders?
W


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
Jean-Sébastien Guay
Sent: Monday, November 09, 2009 1:20 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] osgShadow question

Hi Wyatt,

> The fragmentShaderSource_debugHUD and
fragmentShaderSource_debugHUD_texcoord
> shaders listed at the top of the cpp with the other two shaders

Ah, no those are only used if you enable the debug HUD.

J-S
-- 
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
http://www.cm-labs.com/
 http://whitestar02.webhop.org/
___
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] osgShadow question

2009-11-09 Thread Jean-Sébastien Guay

Hi Wyatt,


Is this what you are referring to?

if (withBaseTexture)
{
scene->getOrCreateStateSet()->setTextureAttributeAndModes( 0,
new osg::Texture2D(osgDB::readImageFile("Images/lz.rgb")),
osg::StateAttribute::ON);
}


Nope, this:

{
// fake texture for baseTexture, add a fake texture
// we support by default at least one texture layer
// without this fake texture we can not support
// textured and not textured scene

// TODO: at the moment the PSSM supports just one texture 
layer in the GLSL shader, multitexture are

//   not yet supported !

osg::Image* image = new osg::Image;
// allocate the image data, noPixels x 1 x 1 with 4 rgba 
floats - equivilant to a Vec4!

int noPixels = 1;
image->allocateImage(noPixels,1,1,GL_RGBA,GL_FLOAT);
image->setInternalTextureFormat(GL_RGBA);
// fill in the image data.
osg::Vec4* dataPtr = (osg::Vec4*)image->data();
osg::Vec4 color(1,1,1,1);
*dataPtr = color;
// make fake texture
osg::Texture2D* fakeTex = new osg::Texture2D;

fakeTex->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE);

fakeTex->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE);

fakeTex->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);

fakeTex->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
fakeTex->setImage(image);
// add fake texture

_stateset->setTextureAttribute(_baseTextureUnit,fakeTex,osg::StateAttribute::ON);

_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_2D,osg::StateAttribute::ON);

_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_3D,osg::StateAttribute::OFF);
#if !defined(OSG_GLES1_AVAILABLE) && 
!defined(OSG_GLES2_AVAILABLE)


_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_1D,osg::StateAttribute::OFF);
#endif
}

(sorry for the formatting, search for "fakeTex" in your sources and you 
should see it)


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgShadow question

2009-11-09 Thread Wyatt Earp
Is this what you are referring to?

if (withBaseTexture)
{
scene->getOrCreateStateSet()->setTextureAttributeAndModes( 0,
new osg::Texture2D(osgDB::readImageFile("Images/lz.rgb")),
osg::StateAttribute::ON);
}

W

-Original Message-


See the code for osgShadow::ShadowMap for an example of such a texture set
up.

J-S
-- 
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
http://www.cm-labs.com/
 http://whitestar02.webhop.org/
___
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] osgShadow question

2009-11-09 Thread Jean-Sébastien Guay

Hi Wyatt,


The fragmentShaderSource_debugHUD and fragmentShaderSource_debugHUD_texcoord
shaders listed at the top of the cpp with the other two shaders


Ah, no those are only used if you enable the debug HUD.

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgShadow question

2009-11-09 Thread Wyatt Earp
"What do HUDs have to do with this?"

The fragmentShaderSource_debugHUD and fragmentShaderSource_debugHUD_texcoord
shaders listed at the top of the cpp with the other two shaders


W


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
Jean-Sébastien Guay
Sent: Monday, November 09, 2009 12:47 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] osgShadow question

Hi Wyatt,

> Which shader is the basic shader, fragmentShaderSource_noBaseTexture or 
> fragmentShaderSource_withBaseTexture? 

Depends on whether your object has a texture or not. Although now, since 
texture lookups are so cheap these days, I would suggest you save 
yourself some aggravation and just apply a white 1x1 texture to the top 
of your scene graph (which will thus apply to all untextured objects but 
won't change anything in their appearance) and use only one shader, the 
withBaseTexture one.

See the code for osgShadow::ShadowMap for an example of such a texture 
set up.

> I assume it isn’t one for HUD.


Hope this helps,

J-S
-- 
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
http://www.cm-labs.com/
 http://whitestar02.webhop.org/
___
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] osgShadow question

2009-11-09 Thread Jean-Sébastien Guay

Hi Wyatt,

Which shader is the basic shader, fragmentShaderSource_noBaseTexture or 
fragmentShaderSource_withBaseTexture? 


Depends on whether your object has a texture or not. Although now, since 
texture lookups are so cheap these days, I would suggest you save 
yourself some aggravation and just apply a white 1x1 texture to the top 
of your scene graph (which will thus apply to all untextured objects but 
won't change anything in their appearance) and use only one shader, the 
withBaseTexture one.


See the code for osgShadow::ShadowMap for an example of such a texture 
set up.



I assume it isn’t one for HUD.


What do HUDs have to do with this?

Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgShadow question

2009-11-09 Thread Wyatt Earp
 

>From the "Common Questions" of the osgShadow node kit. 

 

"What if my objects already have a shader applied to them? 

*   That shader also needs to implement shadow mapping. See the
  top of src/osgShadow/ShadowMap.cpp for the basic
shader, and use that in your shader (keep the same names for the variables
too). "

 

Which shader is the basic shader, fragmentShaderSource_noBaseTexture or
fragmentShaderSource_withBaseTexture?  I assume it isn't one for HUD.

Thanks,
W

 

 

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


Re: [osg-users] osgShadow question

2009-06-25 Thread Serge Lages
Thanks for your advices ! I've tested the uniform one by changing the shadow
technique shader and it works great.

Cheers,

On Thu, Jun 25, 2009 at 4:28 AM, Jean-Sébastien Guay <
jean-sebastien.g...@cm-labs.com> wrote:

> Hi Serge,
>
>  Anyone knows if there is a way to force an object to not receive the
>> shadows ? Even with a "dirty" method (reseting it's tex coords on the
>> drawable or something like that).
>>
>
> Wojtek is right (of course, having implemented some of the ShadowMap
> techniques in OSG, he would know), ReceivesShadowTraversalMask is typically
> not used in ShadowMap techniques, as it would be a bit hard to implement
> generally.
>
> What we do is we have a uniform ShadowEnabled which if disabled skips the
> shadow map lookup in the shadow map shader. For this to work you have to
> replace your shadow technique's shader with one that will use whatever
> uniform you set, and you need to set a uniform to false (and make it default
> to true in your root ShadowedScene) instead of using the
> ReceivesShadowTraversalMask.
>
> So it's a bit inconvenient, you have two different ways of doing things -
> CastsShadowTraversal mask to make something not cast shadows, and a uniform
> to make it not receive shadows. Though it's kind of appropriate if you think
> about it, the former is "do I use this object for shadows", and the latter
> is "do I use the shadows on this object", so intuitively the former is a
> node mask and the latter is a shader parameter for the output.
>
> Hope this helps,
>
> J-S
> --
> __
> Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
>   http://www.cm-labs.com/
>http://whitestar02.webhop.org/
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Serge Lages
http://www.tharsis-software.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgShadow question

2009-06-24 Thread Jean-Sébastien Guay

Hi Serge,

Anyone 
knows if there is a way to force an object to not receive the shadows ? 
Even with a "dirty" method (reseting it's tex coords on the drawable or 
something like that).


Wojtek is right (of course, having implemented some of the ShadowMap 
techniques in OSG, he would know), ReceivesShadowTraversalMask is 
typically not used in ShadowMap techniques, as it would be a bit hard to 
implement generally.


What we do is we have a uniform ShadowEnabled which if disabled skips 
the shadow map lookup in the shadow map shader. For this to work you 
have to replace your shadow technique's shader with one that will use 
whatever uniform you set, and you need to set a uniform to false (and 
make it default to true in your root ShadowedScene) instead of using the 
ReceivesShadowTraversalMask.


So it's a bit inconvenient, you have two different ways of doing things 
- CastsShadowTraversal mask to make something not cast shadows, and a 
uniform to make it not receive shadows. Though it's kind of appropriate 
if you think about it, the former is "do I use this object for shadows", 
and the latter is "do I use the shadows on this object", so intuitively 
the former is a node mask and the latter is a shader parameter for the 
output.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgShadow question

2009-06-24 Thread Wojciech Lewandowski
Serge,

I have no access to the code now. All techniques derived from 
osgShadow::ShadowMap share this limitation. If my memory serves me right they 
all ignore ReceivesShadowTraversalMask. 
But many tricks  or graph rearangments were discussed earlier. For example look 
at this thread:  
http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg16581.html If 
you look carefully you should be able to find more such posts.  Unfortunately I 
cannot offer more help at this time. 

Cheers,
Wojtek Lewandowski 


From: Serge Lages 
Sent: Wednesday, June 24, 2009 6:31 PM
To: OpenSceneGraph Users 
Subject: [osg-users] osgShadow question


Hi all,

I am currently using osgShadow with the MinimalShadowMap technique. It works 
great but I have a question :

- In my ShadowedScene, I set the children's nodemasks accordingly with the 
CastsShadowTraversalMask and ReceivesShadowTraversalMask properties, but it 
seems to not work, everything cast shadows on everything. Anyone knows if there 
is a way to force an object to not receive the shadows ? Even with a "dirty" 
method (reseting it's tex coords on the drawable or something like that).

Thanks !
Best regards,

-- 
Serge Lages
http://www.tharsis-software.com






___
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


[osg-users] osgShadow question

2009-06-24 Thread Serge Lages
Hi all,

I am currently using osgShadow with the MinimalShadowMap technique. It works
great but I have a question :

- In my ShadowedScene, I set the children's nodemasks accordingly with the
CastsShadowTraversalMask and ReceivesShadowTraversalMask properties, but it
seems to not work, everything cast shadows on everything. Anyone knows if
there is a way to force an object to not receive the shadows ? Even with a
"dirty" method (reseting it's tex coords on the drawable or something like
that).

Thanks !
Best regards,

-- 
Serge Lages
http://www.tharsis-software.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgShadow question (ATI related?)

2008-10-30 Thread Rick Middelkoop




Hi Wojtek,

Thanks for helping out. Unfortunately I didn't have much time today 
to further investigate the problem.

  It does not sound like easy one. Are you sure that ATI bug only affects
texture application ? Maybe render to texture is also flipped somehow. I
assume you have modified texgen matrix but not shadow camera projection
matrix (the one involved in computation of texgen matrix) ?  If shadow
camera projection gets modified it could potentially affect rest of the
code.
  

I don't know. I read on the mailing list that there is an issue with
FBO textures on ATI, because
at some point, ATI inverted the 't coordinate' in their drivers.

http://archive.netbsd.se/?ml=openscenegraph-submissions&a=2008-02&m=6605417

  Actually, one idea just came to my mind, MinimalDrawBoundsShadowMap does
rough depth map prerender to compute visible shadowed scene extents. I
suppose reverted vertical texture coordinates may also affect this code. You
may look at MinimaDrawBounds line 203 - its the place where matrix for
prerenderd image scan is computed - and you may need to make the fixes
there. As a alternative approach, you could try
LightSpacePerspectiveShadowMapCB and see if the problem is also present ?
LightSpacePerspectiveShadowMapCB variant computes shadowed volume by
scanning boxes around drawables in render bins and should avoid at least
this potential prerenderd image scanning issue.
  

OK, I quickly tried LightSpacePerspectiveShadowMapCB but the problem
was still present.
Unfortunately I didn't have enough time to take a good look at the
prerendered image scan computation.

  
I will keep looking into tomorrow, starting at the MinimalShadowMap
level as this seems to be
the lowest level at which the problem occurs on my system.

  
  Good luck. And let me know if you come up with some constructive conclusion,
possible fixes or workarounds.
  

Thanks, and I will certainly let you know if I find something!

Cheers, Rick.



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


Re: [osg-users] osgShadow question (ATI related?)

2008-10-29 Thread Wojciech Lewandowski
Hi Rick,

I am afraid you are on your own -  I will not be able to help much. Shadow
mapping issues could be really hard ;-( I would need to grab similar board,
roll up the sleeves and start debuging. But I don't have the time nor access
to such hardware.

> [..]

> When I just use StandardShadowMap (with the ShadowMap adjustment), the
> shadows are correct.
> (However, there is a small gap between the (shadow-casting) objects and
> their shadow, possibly polygon offset-related?)

Probably. I don't have another idea.

> When I just use MinimalShadowMap or MinimalDrawBoundsShadowMap, the
> shadows are correct,
> but only when the bounding box (displayed when using setDebugDraw) of
> the shadow-casting objects
> is completely within view. When the bounding box is partially outside
> the viewing frustum, the shadows
> are correct only from certain viewpoint positions/orientations. If I
> then move/aim the viewpoint,
> the shadows move away from the objects that cast them (and eventually
> disappear in some cases).

> From just looking at the debug HUD, you could say that the shadows get
> 'more correct'
> when the (shadow-casting objects) bounding box is less 'deformed'.

> Any ideas?

It does not sound like easy one. Are you sure that ATI bug only affects
texture application ? Maybe render to texture is also flipped somehow. I
assume you have modified texgen matrix but not shadow camera projection
matrix (the one involved in computation of texgen matrix) ?  If shadow
camera projection gets modified it could potentially affect rest of the
code.

Actually, one idea just came to my mind, MinimalDrawBoundsShadowMap does
rough depth map prerender to compute visible shadowed scene extents. I
suppose reverted vertical texture coordinates may also affect this code. You
may look at MinimaDrawBounds line 203 - its the place where matrix for
prerenderd image scan is computed - and you may need to make the fixes
there. As a alternative approach, you could try
LightSpacePerspectiveShadowMapCB and see if the problem is also present ?
LightSpacePerspectiveShadowMapCB variant computes shadowed volume by
scanning boxes around drawables in render bins and should avoid at least
this potential prerenderd image scanning issue.

> I will keep looking into tomorrow, starting at the MinimalShadowMap
> level as this seems to be
> the lowest level at which the problem occurs on my system.

Good luck. And let me know if you come up with some constructive conclusion,
possible fixes or workarounds.

Cheers,
Wojtek

RE PS:

> EMPTY_BOX:  no shadows are visible, debug HUD shows an empty shadow map
> BOUNDING_SPHERE: shadows visible from certain viewpoint
> positions/orientations, but not
> in the correct place. The debug HUD shows shadow map with projected
> bounding box etc.

Default setting may impact performance but should be safest. I am not 100%
sure that other options are completely bug free so I would suggest not
experimenting with this if you have other problems. Usage of these options
also heavily depends on the light type. Leave it at default if you use spot
or omnidirectional light.



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


Re: [osg-users] osgShadow question (ATI related?)

2008-10-29 Thread Rick Middelkoop
Hi Wojtek,

Thanks for your hints!

I have made the adjustment to StandardShadowMap and
MinimalDrawBoundsShadowMap
like for ShadowMap. With the LightSpacePerspectiveShadowMap I then get
almost-correct
shadows when looking straight down along the Z axis (at a shadow-casting
object), with the
viewpoint coordinate system aligned to the world coordinate system. The
shadows move away
from the objects that cast them when I move/aim the viewpoint.

When I just use StandardShadowMap (with the ShadowMap adjustment), the
shadows are correct.
(However, there is a small gap between the (shadow-casting) objects and
their shadow, possibly
polygon offset-related?)

When I just use MinimalShadowMap or MinimalDrawBoundsShadowMap, the
shadows are correct,
but only when the bounding box (displayed when using setDebugDraw) of
the shadow-casting objects
is completely within view. When the bounding box is partially outside
the viewing frustum, the shadows
are correct only from certain viewpoint positions/orientations. If I
then move/aim the viewpoint,
the shadows move away from the objects that cast them (and eventually
disappear in some cases).

>From just looking at the debug HUD, you could say that the shadows get
'more correct'
when the (shadow-casting objects) bounding box is less 'deformed'.

Any ideas?

I will keep looking into tomorrow, starting at the MinimalShadowMap
level as this seems to be
the lowest level at which the problem occurs on my system.

Cheers,

Rick.

PS: I also experimented with the MinimalDrawBoundsShadowMap, calling
setShadowReceivingCoarseBoundAccuracy with EMPTY_BOX and BOUNDING_SPHERE,
giving the following results:

EMPTY_BOX:  no shadows are visible, debug HUD shows an empty shadow map
BOUNDING_SPHERE: shadows visible from certain viewpoint
positions/orientations, but not
in the correct place. The debug HUD shows shadow map with projected
bounding box etc.


> Hi Again Rick,
>
> Small errata: I forgot to add .cpp suffixes to the files I suggest to
> modify. So fixes should be done in
>
> MinimalDrawBoundShadowMap.cpp line 225
> and
> StandardShadowMap.cpp line 753
>
> Let us know if this helps, if it does, I will be smarter next time when this
> question appears again.
>
> Cheers,
> Wojtek
>
>
> Rick,
>
> I don't know how to help you with your particular problem. But I hope these
> 2 hints could be useful:
>
> I suppose it would be fairly simple to make similar adjustment for LisPSM as
> you did for ShadowMap. Texgen matrix for LispSM is set in
> MinimalDrawBoundShadowMap line 225. For safety you should also adjust
> StandardShadowMap line 753. Second code path is used when you select LispSM
> variant based on MinimalCullBoundsShadowMap or MinimalShadowMap.
>
> Maybe when you activate debug HUD ( call DebugShadowMap::setDebugDraw(
> true ) ) it will be easier to see and fix the problem.
>
> Cheers,
> Wojtek
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Rick
> Middelkoop
> Sent: Tuesday, October 28, 2008 7:13 PM
> To: osg-users@lists.openscenegraph.org
> Subject: [osg-users] osgShadow question (ATI related?)
>
>
> Hello,
>
> I'm trying to add shadows to the application I'm working on, and encountered
> two issues which seems to be ATI card/driver related.
>
> The first issue is, that shadows generated using the ShadowMap technique
> are in the
> wrong location, both in the application I'm working on and the
> 'osgshadow' example.
> Only the ShadowTexture technique gives correct results.
>
> For example, in the 'aircraft above terrain' example scene with the
> ShadowMap
> technique (osgshadow --sm -2), there is a shadow on the ground below the
> aircraft,
> but it is turning in the opposite direction to the aircraft.
> A colleague who is using an Nvidia card is seeing correct shadows in the
> example.
>
> After searching the osg mailing list I found a few clues towards solving
> the problem,
> one was that ATI had inverted a coordinate of the FBO-texture in their
> drivers:
> http://archive.netbsd.se/?ml=openscenegraph-submissions&a=2008-02&m=6605417
>
> The solution was to mirror the shadow map along the Y axis in the
> ShadowMap::cull()
> function:
>
> _texgen->setPlanesFromMatrix( osg::Matrix::scale(1.0, -1.0, 1.0) *
>   _camera->getProjectionMatrix() *
>   osg::Matrix::translate(1.0,1.0,1.0) *
>   osg::Matrix::scale(0.5f,0.5f,0.5f) );
>
> (I am using a Radeon X1800 series card with the Catalyst 8.9 drivers,
> and the osg2.7.3
> developer release. However, the effect also occurs with the osg2.2
> stable release.)
>
> Now for the second, sti

Re: [osg-users] osgShadow question (ATI related?)

2008-10-28 Thread Wojciech Lewandowski
Hi Again Rick,

Small errata: I forgot to add .cpp suffixes to the files I suggest to
modify. So fixes should be done in

MinimalDrawBoundShadowMap.cpp line 225
and
StandardShadowMap.cpp line 753

Let us know if this helps, if it does, I will be smarter next time when this
question appears again.

Cheers,
Wojtek


Rick,

I don't know how to help you with your particular problem. But I hope these
2 hints could be useful:

I suppose it would be fairly simple to make similar adjustment for LisPSM as
you did for ShadowMap. Texgen matrix for LispSM is set in
MinimalDrawBoundShadowMap line 225. For safety you should also adjust
StandardShadowMap line 753. Second code path is used when you select LispSM
variant based on MinimalCullBoundsShadowMap or MinimalShadowMap.

Maybe when you activate debug HUD ( call DebugShadowMap::setDebugDraw(
true ) ) it will be easier to see and fix the problem.

Cheers,
Wojtek

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Rick
Middelkoop
Sent: Tuesday, October 28, 2008 7:13 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] osgShadow question (ATI related?)


Hello,

I'm trying to add shadows to the application I'm working on, and encountered
two issues which seems to be ATI card/driver related.

The first issue is, that shadows generated using the ShadowMap technique
are in the
wrong location, both in the application I'm working on and the
'osgshadow' example.
Only the ShadowTexture technique gives correct results.

For example, in the 'aircraft above terrain' example scene with the
ShadowMap
technique (osgshadow --sm -2), there is a shadow on the ground below the
aircraft,
but it is turning in the opposite direction to the aircraft.
A colleague who is using an Nvidia card is seeing correct shadows in the
example.

After searching the osg mailing list I found a few clues towards solving
the problem,
one was that ATI had inverted a coordinate of the FBO-texture in their
drivers:
http://archive.netbsd.se/?ml=openscenegraph-submissions&a=2008-02&m=6605417

The solution was to mirror the shadow map along the Y axis in the
ShadowMap::cull()
function:

_texgen->setPlanesFromMatrix( osg::Matrix::scale(1.0, -1.0, 1.0) *
  _camera->getProjectionMatrix() *
  osg::Matrix::translate(1.0,1.0,1.0) *
  osg::Matrix::scale(0.5f,0.5f,0.5f) );

(I am using a Radeon X1800 series card with the Catalyst 8.9 drivers,
and the osg2.7.3
developer release. However, the effect also occurs with the osg2.2
stable release.)

Now for the second, still unsolved issue:

At the moment, I am looking at using the LightSpacePerspectiveShadowMap
technique
in the application. However, the problem here is that when changing the
viewpoint position
or orientation,  the shadows also move or rotate! It is very difficult
to see what is going on
from the position or movements of the shadows in this case. However,
when I mirror the
shadow map (like in the code above), the shadows seem to be correct in
one special case.
This is when the viewpoint is looking down along the Z axis, and the
viewpoint viewx/vup
axes are parallel to the world X/Y-axes.

Does anyone have an idea on how this might be solved?

Thanks + Best Regards,

Rick.



___
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

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


Re: [osg-users] osgShadow question (ATI related?)

2008-10-28 Thread Wojciech Lewandowski
Rick,

I don't know how to help you with your particular problem. But I hope these
2 hints could be useful:

I suppose it would be fairly simple to make similar adjustment for LisPSM as
you did for ShadowMap. Texgen matrix for LispSM is set in
MinimalDrawBoundShadowMap line 225. For safety you should also adjust
StandardShadowMap line 753. Second code path is used when you select LispSM
variant based on MinimalCullBoundsShadowMap or MinimalShadowMap.

Maybe when you activate debug HUD ( call DebugShadowMap::setDebugDraw(
true ) ) it will be easier to see and fix the problem.

Cheers,
Wojtek

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Rick
Middelkoop
Sent: Tuesday, October 28, 2008 7:13 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] osgShadow question (ATI related?)


Hello,

I'm trying to add shadows to the application I'm working on, and encountered
two issues which seems to be ATI card/driver related.

The first issue is, that shadows generated using the ShadowMap technique
are in the
wrong location, both in the application I'm working on and the
'osgshadow' example.
Only the ShadowTexture technique gives correct results.

For example, in the 'aircraft above terrain' example scene with the
ShadowMap
technique (osgshadow --sm -2), there is a shadow on the ground below the
aircraft,
but it is turning in the opposite direction to the aircraft.
A colleague who is using an Nvidia card is seeing correct shadows in the
example.

After searching the osg mailing list I found a few clues towards solving
the problem,
one was that ATI had inverted a coordinate of the FBO-texture in their
drivers:
http://archive.netbsd.se/?ml=openscenegraph-submissions&a=2008-02&m=6605417

The solution was to mirror the shadow map along the Y axis in the
ShadowMap::cull()
function:

_texgen->setPlanesFromMatrix( osg::Matrix::scale(1.0, -1.0, 1.0) *
  _camera->getProjectionMatrix() *
  osg::Matrix::translate(1.0,1.0,1.0) *
  osg::Matrix::scale(0.5f,0.5f,0.5f) );

(I am using a Radeon X1800 series card with the Catalyst 8.9 drivers,
and the osg2.7.3
developer release. However, the effect also occurs with the osg2.2
stable release.)

Now for the second, still unsolved issue:

At the moment, I am looking at using the LightSpacePerspectiveShadowMap
technique
in the application. However, the problem here is that when changing the
viewpoint position
or orientation,  the shadows also move or rotate! It is very difficult
to see what is going on
from the position or movements of the shadows in this case. However,
when I mirror the
shadow map (like in the code above), the shadows seem to be correct in
one special case.
This is when the viewpoint is looking down along the Z axis, and the
viewpoint viewx/vup
axes are parallel to the world X/Y-axes.

Does anyone have an idea on how this might be solved?

Thanks + Best Regards,

Rick.



___
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


[osg-users] osgShadow question (ATI related?)

2008-10-28 Thread Rick Middelkoop
Hello,

I'm trying to add shadows to the application I'm working on, and encountered
two issues which seems to be ATI card/driver related.

The first issue is, that shadows generated using the ShadowMap technique
are in the
wrong location, both in the application I'm working on and the
'osgshadow' example.
Only the ShadowTexture technique gives correct results.

For example, in the 'aircraft above terrain' example scene with the
ShadowMap
technique (osgshadow --sm -2), there is a shadow on the ground below the
aircraft,
but it is turning in the opposite direction to the aircraft.
A colleague who is using an Nvidia card is seeing correct shadows in the
example.

After searching the osg mailing list I found a few clues towards solving
the problem,
one was that ATI had inverted a coordinate of the FBO-texture in their
drivers:
http://archive.netbsd.se/?ml=openscenegraph-submissions&a=2008-02&m=6605417

The solution was to mirror the shadow map along the Y axis in the
ShadowMap::cull()
function:

_texgen->setPlanesFromMatrix( osg::Matrix::scale(1.0, -1.0, 1.0) *
  _camera->getProjectionMatrix() *
  osg::Matrix::translate(1.0,1.0,1.0) *
  osg::Matrix::scale(0.5f,0.5f,0.5f) );

(I am using a Radeon X1800 series card with the Catalyst 8.9 drivers,
and the osg2.7.3
developer release. However, the effect also occurs with the osg2.2
stable release.)

Now for the second, still unsolved issue:

At the moment, I am looking at using the LightSpacePerspectiveShadowMap
technique
in the application. However, the problem here is that when changing the
viewpoint position
or orientation,  the shadows also move or rotate! It is very difficult
to see what is going on
from the position or movements of the shadows in this case. However,
when I mirror the
shadow map (like in the code above), the shadows seem to be correct in
one special case.
This is when the viewpoint is looking down along the Z axis, and the
viewpoint viewx/vup
axes are parallel to the world X/Y-axes.

Does anyone have an idea on how this might be solved?

Thanks + Best Regards,

Rick.



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