Hi Gazi,

The texture coordinates are zero because the underlying .obj file
doesn't have any texture coordinates.  You can't create something out
of nothing unless you have some well defined mathematical rules for
mapping coordinates or normals to texture coordinates.

I haven't come across any specification in the .obj or .mtl file for
this, perhaps there is some undocumented means, but I'll leave this up
to you to divine - you have all the source code.

Robert.

On 7/3/06, Gazi Alankus <[EMAIL PROTECTED]> wrote:
I have been trying to use textures in Wavefront .obj files and use
them with osg. First I had trouble finding some editor/viewer that
correctly displays obj files with textures. After I found one, I
realized that osg cannot display the textures in models that the other
program can. Therefore I believe texture support in the obj plugin of
osg is broken.

Here is the obj viewer that can show obj files with correct textures:
http://www.xmission.com/~nate/es/statue.zip

After you build it and run the executable in statue directory, it
displays the data/rose+vase.obj with its texture on the vase. You can
use "statue -s file.obj" to see other obj files.

When I import rose+vase.obj in my osg program, the vase looks all
black. To verify that the problem is not my code, I used osgconv to
convert the obj file to an osg file and used osgviewer and the vase
was black again.

I tracked the problem down to this: only the bottom-leftmost pixel of
the texture is used as a texture. Its value is merely multiplied with
the material colors of the texture stateset. I realized that the osg
file created by osgconv doesn't have any TexCoordArray section.
Probably since all texture coordinates are zero, only one pixel on the
corner is used. Therefore I think texture coordinates should be
created in the obj importer code.

By the way, the program here seems to totally ignore the texture in
the obj file:
http://www.sgi.com/products/software/opengl/examples/more_samples/zip/smooth.zip
I wonder if it is because of my video card (Intel 82852/855GM).

It would be great if someone can fix this and add the correct texture
coordinates (or tell me what I'm doing wrong).

Gazihan
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to