[osg-users] How to use color a mesh object using gradient colors

Ulrich Hertlein u.hertlein at sandbox.de
Tue Sep 16 18:57:04 PDT 2008

Hello Oren,

oren david wrote:
> I've a mesh onject I've build from a .STL file. how do I get it colored
> using a gradient colors?? and how do I specify which color I want in the
> gradient ( I dont want all the range between blue and red).

The STL loader creates a Geometry with per-primitive (triangles) colours and no texture
coordinates (not available in STL).

You could use a fragment shader to assign colours based on world coordinate.
Or use a 1D gradient texture and (probably object-linear) TexGen to create texture


More information about the osg-users mailing list