[osg-users] Float textures seem to be clamped in GLSL

Thrall, Bryan bryan.thrall at flightsafety.com
Thu Mar 5 07:27:42 PST 2009


Brian R Hill wrote on Wednesday, March 04, 2009 5:41 PM:
> // disable clamping
> osg::ClampColor* clamp = new osg::ClampColor();
> clamp->setClampVertexColor(GL_FALSE);
> clamp->setClampFragmentColor(GL_FALSE);
> clamp->setClampReadColor(GL_FALSE);
> scene->getOrCreateStateSet()->setAttribute(clamp,
osg::StateAttribute::ON |
> osg::StateAttribute::OVERRIDE);

I am sad to report that that doesn't work either :(

> -----osg-users-bounces at lists.openscenegraph.org wrote: -----
> 
> To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
> From: "Thrall, Bryan" <bryan.thrall at flightsafety.com>
> Sent by: osg-users-bounces at lists.openscenegraph.org
> Date: 03/04/2009 05:05PM
> Subject: [osg-users] Float textures seem to be clamped in GLSL
> 
> 
> I'm rather new to using float textures and GLSL, so maybe I'm missing
> something. I'm trying to use a float texture as a lookup table in my
> fragment shader. I create the texture using osg::TransferFunction1D
(see
> attached modified osgviewer.cpp), and use the following in my input
> file:
> 
> ---8<---
> 50
> 0 0 0
> 0 0 50
> ---8<---
> 
> For example: osgviewer --pos implicit.pos implicit_surface.osg
> (the shaders need to be in a shaders/ subdirectory under
> implicit_surface.osg's directory)
> 
> My shader takes these positions and renders implicit spheres around
> them, with the first line of the position file being the radius.
> 
> However, the positions seem to be clamped to [0,1], since the
resulting
> spheres overlap except for a little bit at the edge (changing the
radius
> to 1 shows their centers are 1 unit apart). My understanding is that
> float textures should be passed through to the shader without
clamping.
> 
> Is there something I'm doing wrong with osg::TransferFunction1D, or is
> my understanding wrong?
> 
> Thanks,



-- 
Bryan Thrall
FlightSafety International
bryan.thrall at flightsafety.com



More information about the osg-users mailing list