[osg-users] Creating working omnidirectional shadow

2014-05-07 Thread Mickael Fleurus
Hi,
  I'm currently working with osgShadow, and it's driving me crazy! I'm really 
not an expert with shader and so on, but I try to make an omnidirectionnal 
shadow on my scenes, and I really don't know how to proceed. Every already 
implement way of making shadow in OSG aren't producing good shadows while using 
point light, except ShadowVolume, but it produce not only shadow, but also 3D 
geometry, and it's not what I'm looking for! I only want a realistic shadow, 
that work on large scene wherever the light is, and I don't find how to do it.

I tried to build my own omnidirectional shadow map, using a cube map, but, 
obviously, I don't have the skills to do it on my own. 

Do OSG have a build-in solution that I may have missed? Is it even possible to 
do it easily? Am I really bad at OSG or is it really difficult? Please, help 
me, even a little, I'm stuck for too long and I don't like this.

Thank you!

PS: sorry for my english, I'm not completly at ease with it.

Mickael

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





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


Re: [osg-users] Creating working omnidirectional shadow

2014-05-07 Thread Jan Ciger
Hi,

On Wed, May 7, 2014 at 5:07 PM, Mickael Fleurus wrote:

> Hi,
>   I'm currently working with osgShadow, and it's driving me crazy! I'm
> really not an expert with shader and so on, but I try to make an
> omnidirectionnal shadow on my scenes, and I really don't know how to
> proceed. Every already implement way of making shadow in OSG aren't
> producing good shadows while using point light, except ShadowVolume, but it
> produce not only shadow, but also 3D geometry, and it's not what I'm
> looking for! I only want a realistic shadow, that work on large scene
> wherever the light is, and I don't find how to do it.
>
> I tried to build my own omnidirectional shadow map, using a cube map, but,
> obviously, I don't have the skills to do it on my own.
>
> Do OSG have a build-in solution that I may have missed? Is it even
> possible to do it easily? Am I really bad at OSG or is it really difficult?
> Please, help me, even a little, I'm stuck for too long and I don't like
> this.
>


I am using the view-dependent shadow map technique for large scenes, that
one worked best for me so far. However, that one allows only a single light
- light 0 is used for shadow casting. See the osgShadow example.

I am not sure what you mean by "omnidirectional shadows", though. Do you
want to have a shadows cast by multiple lights at the same time? The
techniques in OSG usually support only a single light (with a few
exceptions like the basic shadow map - but that one is not good for large
scenes). It would be very expensive to use something like view-dependent
shadow map with multiple lights, as each light needs its own shadow map and
a rendering pass too. These techniques are mostly used for things like
rendering shadows cast by the Sun and as there is only a single Sun, the
one light limitation is not really a big problem.

What exactly are you trying to achieve? There isn't a single shadow
rendering technique that works for every scenario, unfortunately.

Regards,

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


Re: [osg-users] Creating working omnidirectional shadow

2014-05-07 Thread Trajce Nikolov NICK
Hi Mickael,

this is not that that simple as you already found out, but it is achievable
with proper use of some of the shadowmaps available. I am using
osgShadow::LightSpacePerspectiveShadowMapDB for large paged scenes (this
one worked best for me) and it is also based on one light 0 as Jan
described to you.

Ping me on my email, I can send you some sample code I can share

Nick


On Wed, May 7, 2014 at 6:11 PM, Jan Ciger  wrote:

> Hi,
>
> On Wed, May 7, 2014 at 5:07 PM, Mickael Fleurus 
> wrote:
>
>> Hi,
>>   I'm currently working with osgShadow, and it's driving me crazy! I'm
>> really not an expert with shader and so on, but I try to make an
>> omnidirectionnal shadow on my scenes, and I really don't know how to
>> proceed. Every already implement way of making shadow in OSG aren't
>> producing good shadows while using point light, except ShadowVolume, but it
>> produce not only shadow, but also 3D geometry, and it's not what I'm
>> looking for! I only want a realistic shadow, that work on large scene
>> wherever the light is, and I don't find how to do it.
>>
>> I tried to build my own omnidirectional shadow map, using a cube map,
>> but, obviously, I don't have the skills to do it on my own.
>>
>> Do OSG have a build-in solution that I may have missed? Is it even
>> possible to do it easily? Am I really bad at OSG or is it really difficult?
>> Please, help me, even a little, I'm stuck for too long and I don't like
>> this.
>>
>
>
> I am using the view-dependent shadow map technique for large scenes, that
> one worked best for me so far. However, that one allows only a single light
> - light 0 is used for shadow casting. See the osgShadow example.
>
> I am not sure what you mean by "omnidirectional shadows", though. Do you
> want to have a shadows cast by multiple lights at the same time? The
> techniques in OSG usually support only a single light (with a few
> exceptions like the basic shadow map - but that one is not good for large
> scenes). It would be very expensive to use something like view-dependent
> shadow map with multiple lights, as each light needs its own shadow map and
> a rendering pass too. These techniques are mostly used for things like
> rendering shadows cast by the Sun and as there is only a single Sun, the
> one light limitation is not really a big problem.
>
> What exactly are you trying to achieve? There isn't a single shadow
> rendering technique that works for every scenario, unfortunately.
>
> Regards,
>
> Jan
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


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


Re: [osg-users] Creating working omnidirectional shadow

2014-05-09 Thread Mickael Fleurus
Hi,
 yeah sorry I messed up with what I meant to say. It's more shadow with 
omnidirectionnal light, or point light as I think it's named in osg. 

ViewDependentShadowMap is producing a weird result. Depending on how distant my 
camera is from the scene, I have strange artefacts that make the scene 
unwatchable( img VDSM1). And if the light is too distant, shadows are cut of a 
part of the scene.(img VDSM2)

LightSpacePerspectiveShadowMapDB is also producing weird results. Depending on 
where my camera is, shadows are produced (img LSPSM1) or not (img LSPSM2). And 
sometimes, there is shadows only on a small part of the scene. (img LSPSM3) 

Are these problems that have been seen frequently, or is this caused by the 
rest of my code?

... 

Thank you!

Cheers,
Mickael

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




Attachments: 
http://forum.openscenegraph.org//files/vdsm2_976.png
http://forum.openscenegraph.org//files/vdsm1_300.png
http://forum.openscenegraph.org//files/lspsm2_126.png
http://forum.openscenegraph.org//files/lspsm1_521.png
http://forum.openscenegraph.org//files/lspsm3_551.png


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


Re: [osg-users] Creating working omnidirectional shadow

2014-05-09 Thread Trajce Nikolov NICK
Hi,

if your shadows are moving with the camera, then you are using the default
viewer lighting mode which moves the light with the camera. Try setting the
viewer with no light ( viewer->setLightingMode(osg::View::NO_LIGHT); ) and
set your own LightSource in the scene that you can position yourself. Here
is snippet from my app that might help:

_viewer->getView(0)->setSceneData(_scene);

_sun = new osg::LightSource;
_sun->getLight()->setLightNum(0);
_sun->setName("SUN");
_sun->setCullingActive(false);
_scene->addChild(_sun.get());

then you position _sun->getLight() with zero (0) for the last argument in
_sun->getLight()->setPosition(osg::Vec3(x,y,z),0)

Nick


On Fri, May 9, 2014 at 10:03 AM, Mickael Fleurus
wrote:

> Hi,
>  yeah sorry I messed up with what I meant to say. It's more shadow with
> omnidirectionnal light, or point light as I think it's named in osg.
>
> ViewDependentShadowMap is producing a weird result. Depending on how
> distant my camera is from the scene, I have strange artefacts that make the
> scene unwatchable( img VDSM1). And if the light is too distant, shadows are
> cut of a part of the scene.(img VDSM2)
>
> LightSpacePerspectiveShadowMapDB is also producing weird results.
> Depending on where my camera is, shadows are produced (img LSPSM1) or not
> (img LSPSM2). And sometimes, there is shadows only on a small part of the
> scene. (img LSPSM3)
>
> Are these problems that have been seen frequently, or is this caused by
> the rest of my code?
>
> ...
>
> Thank you!
>
> Cheers,
> Mickael
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=59329#59329
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/vdsm2_976.png
> http://forum.openscenegraph.org//files/vdsm1_300.png
> http://forum.openscenegraph.org//files/lspsm2_126.png
> http://forum.openscenegraph.org//files/lspsm1_521.png
> http://forum.openscenegraph.org//files/lspsm3_551.png
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



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