Re: [osg-users] [osgOcean] A few question about alpha and osgOcean's shader

2011-08-03 Thread Bawenang Rukmoko
OIC. Yeah that makes sense. I've tried to test the alpha between 0.04 - 0.06 
and it worked. However, it worked when I placed it before the view dependent 
culling. I think the alpha got screwed by the culling's shader because I 
happened to experience an artifact when I was trying to use a billboard plants. 
The billboard plants only consist of a quad with a texture of trees on one side 
and opaque (alpha 0.0) pixels for transparency. However, the transparency seems 
rather weird, if I rotated the camera, it would occasionally be transparent or 
not, depending on the rotation of the camera. Dunno if this is an artifact from 
my application or it is actually from osgOcean, but you might try to test it 
yourself.

Thanks again.


kcbale wrote:
> There are two culls to ensure that the view dependent effects work with the 
> composite viewer. In order to get prerender passes to work with multiple 
> views each view has to have it's own FBOs to render to. The ViewData class 
> stores this view dependent data so that it doesn't get overwritten.  
> 
> It's not quite finished yet, the post render effects don't currently work 
> correctly with multiple views. It's something I've been working on but 
> haven't finished yet.
> 
> I would probably test for an alpha that is <= 0.05.
> 
> 
> K.
> 
> On 3 August 2011 10:23, Bawenang Rukmoko < ()> wrote:
> 
> > 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
> >  
> > (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
> >  
> > (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)
> > >  
> > > (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

Re: [osg-users] [osgOcean] A few question about alpha and osgOcean's shader

2011-08-03 Thread Kim Bale
There are two culls to ensure that the view dependent effects work with the
composite viewer. In order to get prerender passes to work with multiple
views each view has to have it's own FBOs to render to. The ViewData class
stores this view dependent data so that it doesn't get overwritten.

It's not quite finished yet, the post render effects don't currently work
correctly with multiple views. It's something I've been working on but
haven't finished yet.

I would probably test for an alpha that is <= 0.05.

K.

On 3 August 2011 10:23, Bawenang Rukmoko  wrote:

> 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#767and
>  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
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgOcean] A few question about alpha and osgOcean's shader

2011-08-03 Thread Bawenang Rukmoko
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


Re: [osg-users] [osgOcean] A few question about alpha and osgOcean's shader

2011-08-03 Thread Kim Bale
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)
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
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org