[osg-users] Which File Formats / Plugins support multi-texture?

David Spilling david.spilling at gmail.com
Tue Sep 16 13:36:54 PDT 2008

Dear All,

Current observations:

1) The OSG 2.6 .obj loader loads two textures : a diffuse map, into texture
unit 0, and an "opacity map" into texture unit 1. The OBJ format supports a
variety of other texture maps (e.g "bump", "map_Ks", etc.). This
map-to-texture-unit correspondence is _hardcoded_ in the loader.

2) The 3DS loader has a bunch of potential map loads commented out
(ReaderWriter3DS.cpp, lines 828-842).

General question:

How should OSG cope with map-to-texture unit correspondence? For example, I
can modify the OBJ loader to support map_Ks, bump, etc. but the texture
units will still be hardcoded, and since I don't use an opacity map, the
original author's (Bob Kuehne) map_opacity change will break. A similar
question applied to the 3DS format; I can get it to load up other maps
(specular, opacity, bump etc.) but equally, end up hardcoding against
texture units.

Altenatively, the loader could increment texture units as it finds them in
the input file - this will work for OBJ; I'm not so familiar with 3DS for
this. Then it would be up to the shader to sort things out.

Even more alternatively, one could pass options into the loader that
dictated the correspondence.

Is there a general OSG wide recommended approach for this, or do people just
end up with their own personal customised loaders?

Advice appreciated,


(PS : shouldn't "map_opacity" be "map_d" in the obj loader?)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080916/98bf7af5/attachment-0003.htm>

More information about the osg-users mailing list