Hi Kenneth,
I was curious about this question too, and I did a bit of digging, the
results:
the following code does the same thing as just creating the texture, so
you can see it's a float format
osg::Image* image = new osg::Image;
image->allocateImage(tex_width,tex_height,1,GL_DEPTH_COMPONENT,
GL_FLOAT);
osg::Texture2D* texture = new osg::Texture2D;
texture->setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT);
//texture->setTextureSize(tex_width, tex_height);
//texture->setInternalFormat(GL_DEPTH_COMPONENT);
texture->setImage(image);
texture->setShadowComparison(true);
texture->setShadowTextureMode(Texture::LUMINANCE);
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
The hex number for the format is 0x1902, after a bit of digging found it
defined in "gl.h"as
#define GL_DEPTH_COMPONENT 0x1902
So the short story is that yes, it is a float 32-bit pixel format.
And it's not quite a newbie question :)
BTW. in the svn version, use the osgShadow nodekit, it gives you the
same features with ShadowMap as the osgshadow example, and it also has
ShadowVolume implementation ( more importantly is in active development,
so it will get better ).
For large-scene shadow mapping, optimizations need to go beyond larger
maps, here's a small list of the top of my head :
1. use the main camera frustum to clip the scene for the shadow pass (
will clip a lot of the terrain some cases, in others it's less efficient)
2. Skew the shadow pass projection to give more importance to texels
mapped close to the main camera position ( ref. Light-Space Perspective
Shadow Map [Wimmer05] in Shader X4)
3. Use multiple shadow maps, arranged by partitioning the main camera
frustum along z-axis (ref. PSSM in the list)
I hope this helped a bit
Mihai
Sewell, Kenneth R CTR USAF AFRL/SNZW wrote:
I used osgdepthshadow as a guide for implementing shadows in my own
program. I got the shadows working but I have a question about the
shadow map. By default what depth is the shadow map?(8-bit, 16-bit,
...) I'm casting my shadow over a large area and I'm seeing some
banding and other artifacts. I looked through the OSG code and noticed
GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24 and GL_DEPTH_COMPONENT32. I
did not see any usage of them in the examples though, are they used in
the texture's setInternalFormat() call? OpenGL gives me an 'invalid
operation' error when I tried them. Am I on the right track? Is there
more to it? I've never tried shadows in OSG (or OpenGL) before so I
apologize for the newbie question.
Ken.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/