[osg-users] Shadow Implement.

Franco Tang osgforum at tevs.eu
Tue Sep 10 04:13:24 PDT 2019


robertosfield wrote:
> Hi Franco,
> 
> 
> On Tue, 10 Sep 2019 at 03:23, Franco Tang < ()> wrote:
> 
> 
> > I guess that some code in osg is out-of-date and it's a bit diffcult to mantain the community. However, I believe they had done pretty good work.
> > 
> 
> 
> It's not so much that the OSG code is out-of-date, more that a range of different approaches to doing shadows, which approach works best is very data/application specific so general purpose shadow code that osgShadow provide can fall short, simply because it doesn't know what going to be best for you scenes.  It's also a bit out-of-date too though :-)
> 
> 
> 
> For some scene types you might well find that one of osgShadow ShadowTechnique implementations does actually work well for your scenes, if so, great go an use it.
> 
> 
> However, I would recommended learning about shadowing can be done in modern hardware and modern extensions.  Then see what approaches might provide the best visual quality/perfornance for your datasets.   Most modern applications will also be writing your own shaders, so shadows is something would fit within this well.   It does require more knowledge but the results have the potential for being better.
> 
> 
> 
> Robert.
> 
>  ------------------
> Post generated by Mail2Forum


Today, it's my first time to debug my application using gDebugger. I am using Intel HUD Graphics 630 card. The origin fragment shader of osgShadow::ShadowMap is below:

Code:

uniform sampler2D osgShadow_baseTexture; 
uniform sampler2DShadow osgShadow_shadowTexture; 
uniform vec2 osgShadow_ambientBias; 
void main(void) 
{ 
    vec4 color = gl_Color * texture2D( osgShadow_baseTexture, gl_TexCoord[0].xy ); 
    gl_FragColor = color * (osgShadow_ambientBias.x + shadow2DProj( osgShadow_shadowTexture, gl_TexCoord[1], 0.005) * osgShadow_ambientBias.y);
}



There is no version directive and I failed to build the shader program cause no support for "gl_Color" in glsl140 or later. Then I set the version glsl130 or below. I failed to validate  shader program. I guess it's card driver stuff especially using Intel Card.
I build osg3.4.1 with default option.

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







More information about the osg-users mailing list