Hi martin, what kind of 3d database do you like to visualize with shadow? and what kind of light are you using. if your scene is a terrain like database, you can have a look at parallel split shadow map. if you have a small scene, than you can visualise with static shadow. but it the scene is too big for high quality shadow, it would be better to use a PSSM or frustum base shadow map, otherwise it's not sure that you don't have enough resolution.
regards adrian 2008/6/19 "Martin Großer" <[EMAIL PROTECTED]>: > Hello, > > first, I have a general question. If you want to use shadows in you scene, > would you use the shadow volumes or the shadow maps? > I use the shadow maps from the osgShadow nodekit. But the normal ShadowMap > is unaesthetic and when I use the softShadowMap, my application runs very > slowly. And my idea is a static ShadowMap, which create once at the > beginning and save this as ImageFile. > > Here is my source code, but it doesn't work. > > // ShadowTexture erstellt (leer) > _texture = new osg::Texture2D; > _texture->setTextureSize(TEXTURE_SIZE_X, TEXTURE_SIZE_Y); > _texture->setInternalFormat(GL_DEPTH_COMPONENT); > _texture->setShadowComparison(true); > _texture->setShadowTextureMode(osg::Texture2D::LUMINANCE); > _texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); > _texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); > > _texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER); > > _texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER); > _texture->setBorderColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); > > // Kamera für das PreRendering einstellen > { > // Kamera erstellen > osg::ref_ptr<osg::Camera> _camera = new osg::Camera; > > // Kamera konfigurieren > > _camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF_INHERIT_VIEWPOINT); > //_camera->setCullCallback(new CameraCullCallback(this)); > _camera->setClearMask(GL_DEPTH_BUFFER_BIT); > _camera->setClearColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); > > _camera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); > > // Viewport in Texturegröße erstellen > _camera->setViewport(0,0,TEXTURE_SIZE_X,TEXTURE_SIZE_Y); > > // PreRendering einstellen > _camera->setRenderOrder(osg::Camera::PRE_RENDER); > > // Kamera soll OpenGL Frame Buffer Object nutzen > > _camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); > > // hänge die Texture als Buffer an die Kamera > _camera->attach(osg::Camera::DEPTH_BUFFER, _texture.get()); > > _camera->addChild(_scene.get()); > > > osgDB::writeImageFile(*(_texture->getImage()),"test.bmp"); > } > > > What is my mistake? Or have anyone a idea, whether I can create a static > shadow with the osgShadow nodekit? > > Cheers, > > Martin > -- > Psssst! Schon vom neuen GMX MultiMessenger gehört? > Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- ******************************************** Adrian Egli
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org