Guys,
Sorry if I offend anyone but I thought this should be obvious. Looks like only
J-S got it ;-) So I now shout to make it clear:
If you don't like Vertex shader I use you can easily turn it off and switch to
Fragment shader only version. You can easily adopt approach where you have only
one Fragment shader as older osgShadow::ShadowMap did. I have added Vertex
Shader only for one reason: to make sure ambient color is not wiped.
But if you want fixed vertex pipeline - simply call:
lispmObject->setMainVertexShader( NULL );
lispmObject->setShadowVertexShader( NULL );
and voila you got rid of VertexShaders.
Of course you will also have to substitute Fragment shaders with yours, because
my Fragment shaders expect that ambient term colorAmbientEmissive would be
passed from VertexShaders you turned off.
But further replacing fragmentShaders with something similar to
osgShadow::ShadowMap shaders is really straight forward. Just set
setMainFragmentShader with your Shader. And call setShadowFragmentShader with
NULL argument and then you will land with configuration similar to
osgShadow::ShadowMap. Which means you will lose ambient ;-).
Roger, You dont need to override ViewData if you only want to replace shaders.
Simply change the shaders in your DerivedShadowMap constructor. I thought you
want to do something more complicated when you presented me your class.
Wojtek
PS. Actually there are a ways to compute ambient component in fragment shader
if one is desperate, but it would require other sacirfices. I wrote a post on
this topic few weeks ago.
----- Original Message -----
From: Roger James
To: OpenSceneGraph Users
Sent: Thursday, January 22, 2009 6:27 PM
Subject: Re: [osg-users] Bug : LightSpacePerspectiveShadowMapDB and cow.ive
Alexandre Amalric wrote:
Hi osg-users,
has anyone tried to launch osgShadow example with --lispsm and cow.ive
model, apparently LightSpacePerspectiveShadowMapDB do not handle multi-textured
model.
Is there any specific configuration to make it work ?
I'm using osg svn.
Kind regards,
--
Alexandre AMALRIC Ingénieur R&D
Alexandre,
It is not a bug, and you cannot configure round it. The fragment shaders in
osgShadow::StandardShadowMap which are used by all the lispsm variants do not
support multi-texturing or the use of texgens. The only way round it is to
write your own shadow technique which derives from lispsm and overrides the
shaders with ones that do what you want. Here is a very useful code snippet
provided by Wojtek that shows how it is done.
class CComplexShadowTechnique : public
osgShadow::LightSpacePerspectiveShadowMapVB
{
public:
/** Convenient typedef used in definition of ViewData struct and methods
*/
typedef CComplexShadowTechnique ThisClass;
/** Convenient typedef used in definition of ViewData struct and methods
*/
typedef osgShadow::LightSpacePerspectiveShadowMapVB BaseClass;
CComplexShadowTechnique()
{
// Override shaders here
}
struct ViewData: public BaseClass::ViewData
{
virtual void init( ThisClass * st, osgUtil::CullVisitor * cv )
{
BaseClass::ViewData::init( st, cv );
// Add additional uniforms here
}
};
// This macro is required if you override ViewData and ViewData::init
// It generates virtual stub function in trhe Base class which
// calls associated ViewData::init.
// Probably this was the reason your ViewData::init was not called.
// Its just a case where virtualization does not help because I actually
// want to virtualize ThisClass subclass and its method.
META_ViewDependentShadowTechniqueData( ThisClass, ThisClass::ViewData )
};
Roger
------------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org