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

Brian R Hill bhill22 at csc.com
Wed Mar 4 15:41:13 PST 2009


Bryan,

I've used this:

// 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);

Brian


This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose. •
-----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

_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list