Hi Robert,

this works well in most cases. The exception are polygons with partially transparent textures, where a rectangular shadow looks plain wrong.

An important subclass of this exception is osgText.

So if you or someone else as an idea how to render the texture in exactly the given material (with the exception of areas with alpha = 0) this would still be very useful.

I already tried to use a texEnv. From reading the OpenGL documentation i thought that the mode REPLACE would allow me to replace the original texture-color, but this didn´t work.


Regards,

Andreas

Robert Osfield schrieb:

Hi Andreas,

I'd recommend just switching off the texturing of the shadower subgraph.

  statset->setTextureMode(0,GL_TEXTURE_2D,
osg::StateAttribute::OVERRIDE | osg::StateAttribute:OFF);

Robert.

On 5/13/06, *Andreas Goebel* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi,

    I have built in shadowtextures into my application.

    The basic functionality works well , but if the shadower itself has a
    texture, this texture shines through in the shadow:

    http://home.arcor.de/goeba/TextureShinesThrough.png

    This is the material used for generating the shadow:

    // make the material black for a shadow.
    osg::Material* material = new osg::Material;
    material->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(
    0.0f,0.0f,0.0f,1.0f));
    
material->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0f,0.0f,0.0f,1.0f));
    material->setEmission(osg::Material::FRONT_AND_BACK,ambientLightColor);
    material->setShininess(osg::Material::FRONT_AND_BACK, 0.0f);
    //material->setAlpha(osg::Material::FRONT_AND_BACK, 0.3);
    stateset->setAttribute(material,osg::StateAttribute::OVERRIDE);

    - if I comment out setEmission, no more textures shine through,
    but then
    the shadow is pitch black, overpainting all textures on the shadowed
    - if I make the shadow transparent, regions where more than one
    part of
    the shadower shadow the shadowed are darker than other regions, which
    looks extremely unrealistic (you can say anything you want about my
    accent, but this is a cool sentence, isn´t it? ;-) )

    So what I need would be:
    - render the shadow pitch black
    - make it transparent when applying the texture

    or:
    - find some setting that makes the renderer use just one color for
    textures and ignore alpha except when it is zero while generating the
    shadow.


    I thought I could do this with a blend function in the stateset of the
    shadowed, but I had no success. I tried what seems to me thousands of
    combinations, but no luck.

    Maybe someone had a problem like this, I don´t get any further here.

    Regards and thanks

    Andreas

    --
    Andreas Goebel

    Visit http://www.raumgeometrie.de to take a look at
    Archimedes Geo3D, a program for dynamic geometry
    in three dimensions!

    _______________________________________________
    osg-users mailing list
    [email protected] <mailto:[email protected]>
    http://openscenegraph.net/mailman/listinfo/osg-users
    http://www.openscenegraph.org/ <http://www.openscenegraph.org/>


------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/



--
Andreas Goebel

Visit http://www.raumgeometrie.de to take a look at Archimedes Geo3D, a program for dynamic geometry in three dimensions!

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to