[osg-users] StandardShadowMap and Fog

2015-02-01 Thread Trajce Nikolov NICK
Hi Community,

I am seeing in the default fragment shader (snippet bellow) that a fog is
used into account but for some reason I can not make it work. Any hints for
the Fog settings?

Thanks a lot

#if FRAGMENT_SHADERS_ONLY
_mainFragmentShader = new osg::Shader( osg::Shader::FRAGMENT,
" // following expressions are auto modified - do not change
them:   \n"
" // gl_TexCoord[0]  0 - can be subsituted with other
index  \n"

"\n"
"float DynamicShadow(
); \n"

"\n"
"uniform sampler2D
baseTexture;  \n"

"\n"
"void
main(void) \n"

"{   \n"
"  vec4 colorAmbientEmissive =
gl_FrontLightModelProduct.sceneColor; \n"
//"  // Add ambient from Light of index =
0\n"
//"  colorAmbientEmissive +=
gl_FrontLightProduct[0].ambient;  \n"
"  vec4 color = texture2D( baseTexture, gl_TexCoord[0].xy
); \n"
"  color *= mix( colorAmbientEmissive, gl_Color, DynamicShadow()
);  \n"
#if DISPLAY_SHADOW_TEXEL_TO_PIXEL_ERROR
"  color.xy = abs( dFdy( gl_TexCoord[1].xy / gl_TexCoord[1].w ) )*
1024.0; \n"
"  color.z = color.y; \n"
"  color.x = color.z; \n"
"  color.y = color.z; \n"
"  color.a = 1.0; \n"
#endif
//  "  float fog = clamp((gl_Fog.end - gl_FogFragCoord)*gl_Fog.scale,
0.,1.);\n"
//  "  color.rgb = mix( gl_Fog.color.rgb, color.rgb, fog
);  \n"
"  gl_FragColor =
color; \n"
"} \n" );

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


Re: [osg-users] StandardShadowMap and Fog

2015-02-01 Thread Trajce Nikolov NICK
never mind .. blind me.. It is commented out .. Please ignore

Nick

On Sun, Feb 1, 2015 at 3:21 PM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Hi Community,
>
> I am seeing in the default fragment shader (snippet bellow) that a fog is
> used into account but for some reason I can not make it work. Any hints for
> the Fog settings?
>
> Thanks a lot
>
> #if FRAGMENT_SHADERS_ONLY
> _mainFragmentShader = new osg::Shader( osg::Shader::FRAGMENT,
> " // following expressions are auto modified - do not change
> them:   \n"
> " // gl_TexCoord[0]  0 - can be subsituted with other
> index  \n"
>
> "\n"
> "float DynamicShadow(
> ); \n"
>
> "\n"
> "uniform sampler2D
> baseTexture;  \n"
>
> "\n"
> "void
> main(void) \n"
>
> "{   \n"
> "  vec4 colorAmbientEmissive =
> gl_FrontLightModelProduct.sceneColor; \n"
> //"  // Add ambient from Light of index =
> 0\n"
> //"  colorAmbientEmissive +=
> gl_FrontLightProduct[0].ambient;  \n"
> "  vec4 color = texture2D( baseTexture, gl_TexCoord[0].xy
> ); \n"
> "  color *= mix( colorAmbientEmissive, gl_Color, DynamicShadow()
> );  \n"
> #if DISPLAY_SHADOW_TEXEL_TO_PIXEL_ERROR
> "  color.xy = abs( dFdy( gl_TexCoord[1].xy / gl_TexCoord[1].w ) )*
> 1024.0; \n"
> "  color.z = color.y; \n"
> "  color.x = color.z; \n"
> "  color.y = color.z; \n"
> "  color.a = 1.0; \n"
> #endif
> //  "  float fog = clamp((gl_Fog.end - gl_FogFragCoord)*gl_Fog.scale,
> 0.,1.);\n"
> //  "  color.rgb = mix( gl_Fog.color.rgb, color.rgb, fog
> );  \n"
> "  gl_FragColor =
> color; \n"
> "} \n" );
>
> --
> trajce nikolov nick
>



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