[osg-users] osgShadow and multitexturing

2012-03-19 Thread Daniel Schmid
Hi y'all

I'm trying to implement shadow in my scene. My scene makes use of up to 4 
texture levels in its models. I read in some comments that the lipsm and other 
shader based shadow techniques are not really made for multi texturing. Ist 
here anybody out there that made a custom shader that implements multitexturing 
and aswell fog functionality?

Regards
Daniel

***
Daniel Schmid
Swiss SIMTEC AG
Frutigenstrasse 4
CH-3600 Thun

Tel:+41 33 533 02 10
Fax:   +41 33 533 02 01

Mail:  daniel.sch...@swiss-simtec.ch
URL:  http://www.swiss-simtec.ch
***

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


Re: [osg-users] osgShadow and multitexturing

2012-03-19 Thread Robert Osfield
Hi Daniel,

All the osgShadow techniques can work with multi-texturing and it's
certainly how I'd expect most users to use it.  However, the built in
shaders they provide can't handle all the types of effects you might
want to use so you'll need to replace these with your own custom
shaders.

Robert.

On 19 March 2012 14:40, Daniel Schmid  wrote:
> Hi y’all
>
>
>
> I’m trying to implement shadow in my scene. My scene makes use of up to 4
> texture levels in its models. I read in some comments that the lipsm and
> other shader based shadow techniques are not really made for multi
> texturing. Ist here anybody out there that made a custom shader that
> implements multitexturing and aswell fog functionality?
>
>
>
> Regards
>
> Daniel
>
>
>
> ***
>
> Daniel Schmid
>
> Swiss SIMTEC AG
>
> Frutigenstrasse 4
>
> CH-3600 Thun
>
>
>
> Tel:    +41 33 533 02 10
>
> Fax:   +41 33 533 02 01
>
>
>
> Mail:  daniel.sch...@swiss-simtec.ch
>
> URL:  http://www.swiss-simtec.ch
>
> ***
>
>
>
>
> ___
> 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 and multitexturing

2012-06-12 Thread Sedov Dmitry
Hi, all

How i can apply shadow texture for object's native state? I don't want modify 
osg's sources (native shaders). I implement  shader for multitexture terrain + 
grass and other objects, and i want get shadow map and bind it to my shaders. 
Now i implement like this:

Code:

class TestDrawCallback: public osg::Drawable::DrawCallback
{
public:
TestDrawCallback()
{
isFirst = true;
}
virtual void drawImplementation(osg::RenderInfo& renderInfo,const 
osg::Drawable* drawable) const
{
osg::State* state = renderInfo.getState();
const osg::StateSet* stateset = 
state->getStateSetStack().back();
osg::StateSet* ownStateSet = 
const_cast(drawable->getStateSet());
osg::Texture2D* tex = 
const_cast(dynamic_cast(stateset->getTextureAttribute(1, 
osg::StateAttribute::TEXTURE)));
if(tex)
{
if(isFirst)
{
ownStateSet->setTextureAttributeAndModes(2, 
tex, osg::StateAttribute::ON);
isFirst = false;
}
state->pushStateSet(ownStateSet);
state->applyTextureAttribute(2, tex);
drawable->drawImplementation(renderInfo);
state->popStateSet();

}else
{
drawable->drawImplementation(renderInfo);
}

}
private:
mutable bool isFirst;
};



I tested this texture map as base texture. The object which I rendered was 
white, that is, texture is not passed on or something like that.
I 
Thank you!
e
Cheers,
Sedov[/code]

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





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