Thanks for the reply. To put it simply what I wanted to do is similar to the glare shader in osgOcean. Whereas glare is decided by the luminance aux buffer that has the value of over or equal to osgOcean_GlareThreshold, my shader would be decided by the alpha channel of a 3D model's texture that equals to 0.05.
BTW, about the culling traversal, I'm rather confused because there's the cull from: http://code.google.com/p/osgocean/source/browse/trunk/src/osgOcean/OceanScene.cpp#767 and then there's http://code.google.com/p/osgocean/source/browse/trunk/src/osgOcean/OceanScene.cpp#1008. kcbale wrote: > Hi Bawenang, > > I'm not 100% sure what you're trying to do, but I would say that the error is > due to the floating point comparison, try testing for a small range rather > than an explicit value. > > > On a side note osgOcean uses a custom cull traversal > (http://code.google.com/p/osgocean/source/browse/trunk/src/osgOcean/OceanScene.cpp#767 > > (http://code.google.com/p/osgocean/source/browse/trunk/src/osgOcean/OceanScene.cpp#767)) > so I'm not sure how that would react to having prerender cameras added as > children of ocean scene - It might work, but I haven't tested it. > > > Regards, > > > Kim. > > > > > On 3 August 2011 08:50, Bawenang Rukmoko < ()> wrote: > > > Hi, > > > > I'm trying to get this shader to work: > > > > > > Code: > > > > #vertex > > void main( void ) > > { > > gl_TexCoord[0] = gl_MultiTexCoord0; > > gl_Position = ftransform(); > > } > > > > #fragment > > #extension GL_ARB_texture_rectangle : enable > > > > uniform sampler2DRect colorTexture; > > const float alphaValue = 0.05; //The alpha value that indicates the part > > that will be visible. else gl_FragColor = vec4(0.0) > > > > void main( void ) > > { > > vec4 color = texture2DRect(colorTexture, gl_TexCoord[0].st); > > > > if(color.a == alphaValue) > > { > > gl_FragColor = vec4(1.0,0.0,0.0,1.0); > > } > > else > > gl_FragColor = vec4(0.0); > > } > > > > > > > > This shader is just the first pass (RTT camera pass) of what I intend to > > do. I am trying to implement a certain kind of shader into the scene. I am > > trying to isolate the part that the shader will work on by getting the > > alpha channel. If alpha channel = 0.05 then it will be rendered to a > > texture, if not then it will just be black. I've got lots of .ive models > > with the textures of 1.0 alpha and 0.05 alpha. However what I'm getting is > > just a blank black screen. I was thinking that maybe one of osgOcean's > > shader screwed up the alpha values or so. Can anybody help me with this > > please? Thanks a lot in advance. > > > > Thank you! > > > > Cheers, > > Bawenang > > > > ------------------------ > > "There's no place like 127.0.0.1" > > > > ------------------ > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=41811#41811 > > (http://forum.openscenegraph.org/viewtopic.php?p=41811#41811) > > > > > > > > > > > > _______________________________________________ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > ------------------ > Post generated by Mail2Forum ------------------------ "There's no place like 127.0.0.1" ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41817#41817 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org