[osg-users] RRT with HDR texture

Art Tevs stud_info2 at yahoo.de
Wed Sep 12 08:34:55 PDT 2007


gl_FragData makes sure that there is really no
clamping of the values.
gl_FragColor might clamp the values. I think if you
call glClampColorARB(GL_CLAMP_FRAGMENT_COLOR_ARB,
GL_FALSE); or something like this, then gl_FragColor
would also write unclamped values out. 

In deed this is a nice way to disable fixed function
pipeline clamping. For example you can then specify
vertex colors greater than 1.0 and they will be passed
to the vertex programm unclamped if you call before
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FALSE); 

Art



--- Benoit bossavit <bnuaster at gmail.com> schrieb:

> Ok, seems work better..
> what is the diferrence between FragData y FragColor?
> 
> thanks you very much Art
> 
> bnua
> 
> 2007/9/12, Art Tevs <stud_info2 at yahoo.de>:
> >
> > No OpenGl do not clamp float textures, even on
> using
> > luminance. No there do not exists any GL_R16F_ARb
> or
> > GL_RED16F_ARB.
> >
> > Try to setup your texture with internal parameter
> > GL_LUMINANCE16F_ARB and source type as GL_RED. And
> > write to the red channel in your shader output.
> >
> > And yes, try to make something like this in your
> > shader:
> >
> > gl_FragData[0].r = your_result;
> >
> > and not
> >
> > gl_FragColor.r = your_result;
> >
> >
> > Art
> >
> >
> > --- Benoit bossavit <bnuaster at gmail.com> schrieb:
> >
> > > I'm using shaders.
> > >
> > > I have overloaded the traverse function of a
> group
> > > and I apply my shaders.
> > >
> > > void Myclass::traverse(osg::NodeVisitor& nv)
> > > {
> > >     if
> > >
> >
>
(nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR)
> > >     {
> > >         // special actions must be taken if the
> node
> > > visitor is actually a
> > > CullVisitor
> > >         osgUtil::CullVisitor *cv =
> > > dynamic_cast<osgUtil::CullVisitor
> > > *>(&nv);
> > >
> > >         cv->pushStateSet(myStateSet);
> > >         osg::Group::traverse(nv); // draws the
> scene
> > >         cv->popStateSet();
> > >    }
> > > }
> > >
> > > ss contains my shaders.
> > >
> > > this class (inherit of group) is the father of
> the
> > > scene, and I attach this
> > > class to my camera.
> > >
> > > But what I don't understand that's work with
> GL_RGBA
> > > and don't work with
> > > GL_LUMINANCE.
> > > It is possible OpenGL uses a filter when
> computes
> > > the luminance value and
> > > clamp it automatically?
> > > In this case their is a mean to retrieve only
> the
> > > red component?
> > > I don't find GL_R16F_ARG :s
> > >
> > > thanks for your attention.
> > >
> > > bnua
> > >
> > > 2007/9/12, Art Tevs <stud_info2 at yahoo.de>:
> > > >
> > > > How do you render data into your texture?
> > > > If you do not use shaders (so using of fixed
> > > function
> > > > pipeline) for rendering output to your
> texture,
> > > then
> > > > the result will be clamped to [0,1].
> > > >
> > > > Art
> > > >
> > > >
> > > > --- Benoit bossavit <bnuaster at gmail.com>
> schrieb:
> > > >
> > > > > thanks for your answer but I have tried and
> this
> > > is
> > > > > don't work :s
> > > > > have you other suggestion? I'm surprise that
> > > don't
> > > > > work !!!
> > > > >
> > > > > thanks you
> > > > >
> > > > > bnua
> > > > >
> > > > > 2007/9/12, Art Tevs <stud_info2 at yahoo.de>:
> > > > > >
> > > > > > Try to use GL_LUMINANCE16F_ARB (and source
> > > format
> > > > > > GL_LUMINANCE) instead of
> GL_INTENSITY16F_ARB.
> > > > > >
> > > > > > Art
> > > > > >
> > > > > > --- Benoit bossavit <bnuaster at gmail.com>
> > > schrieb:
> > > > > >
> > > > > > > Hi all,
> > > > > > >
> > > > > > > I want to do RTT with HDR saving only
> one
> > > > > component
> > > > > > > (GL_LUMINANCE or
> > > > > > > GL_INTENSITY)
> > > > > > > There is my code :
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
myHDRTexture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
myHDRTexture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
myHDRTexture->setInternalFormat(GL_INTENSITY16F_ARB);
> > > > > > >
> myHDRTexture->setSourceFormat(GL_INTENSITY);
> > > > > > > myHDRTexture->setSourceType(GL_FLOAT);
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> >
> >
>
myCameraHDR->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT);
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
myCameraHDR->setRenderOrder(osg::CameraNode::PRE_RENDER);
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
myCameraHDR->attach(osg::CameraNode::COLOR_BUFFER,myRenderHDRTexture);
> > > > > > >
> > > > > > > when I look values on my texture they
> are
> > > > > clamped at
> > > > > > > 1 and if I put :
> > > > > > >
> > > myHDRTexture->setInternalFormat(GL_RGBA16F_ARB);
> > > > > > > myHDRTexture->setSourceFormat(GL_RBA);
> > > > > > >
> > > > > > > my texture contains values upper than 1
> > > > > > >
> > > > > > > Someone have an idea? (I don't need
> saving
> > > three
> > > > > > > component because they are
> > > > > > > the same)
> > > > > > >
> 
=== message truncated ===>
_______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 



      Wissenswertes zum Thema PC, Zubehör oder Programme. BE A BETTER INTERNET-GURU!  www.yahoo.de/clever



More information about the osg-users mailing list