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

Thrall, Bryan bryan.thrall at flightsafety.com
Wed Mar 4 14:05:25 PST 2009


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
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osgviewer.cpp
Type: application/octet-stream
Size: 7189 bytes
Desc: osgviewer.cpp
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090304/c2389ad6/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implicit_surface.vert
Type: application/octet-stream
Size: 376 bytes
Desc: implicit_surface.vert
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090304/c2389ad6/attachment-0009.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implicit_surface.frag
Type: application/octet-stream
Size: 1110 bytes
Desc: implicit_surface.frag
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090304/c2389ad6/attachment-0010.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implicit_surface.osg
Type: application/octet-stream
Size: 2192 bytes
Desc: implicit_surface.osg
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090304/c2389ad6/attachment-0011.obj>


More information about the osg-users mailing list