I just completed my dll to export scenes from 3D studio max into my own
format. First impressions make me quite happy, but I have some issues
with texture coordinates and also with texture artifacts.
Here are 2 screen captures of a rendered scene, first with 3D studio max
and the second with my openGL program.
http://img515.imageshack.us/img515/4796/orgtruck.png
http://img515.imageshack.us/img515/1434/restruck.png
As you see, the wheels and trailer texture coordinates are good, but on
the front of the truck, the texture is tilting. And worse, on the side
of the cabin, textures are black and white with color gradients.
I don't ask help for my exporter on comp.graphics.api.opengl, but just
if anyone here already got this kind of artifacts with openGL. Could
anyone give me a hint on what could cause that and how to solve it?
Thanks
Cathy
> I don't ask help for my exporter on comp.graphics.api.opengl, but just
> if anyone here already got this kind of artifacts with openGL. Could
> anyone give me a hint on what could cause that and how to solve it?
Hard to tell. It could be as simple as a messed up texture file, a bug in
the texture loader, a problem in the texture coordinate processin in either
the model file writer or reader.
A few hints for debugging: Use simple textures, which tell you, what's going
on, like a gradient with the red component rising in intensity with the U-
direction and the green component with the V-direction. Choose the most
simple filters possible, i.e. GL_NEAREST for texture minification and
magnification. Render a black and white wireframe, and layer it on top of
the filled rendering, so that you can see, how texturing and geometry
relate.
Wolfgang
I don't think that has anything to do with texture coordinates. For
instance the door is approximately where you expect it, with a slight
offset for each scanline.
That along with the color distortion points to either loading the image
incorrectly (e.g. treating a 24bpp PNG file as 32bit for instance), or
giving the data to glTexImage2D with the wrong pixel format arguments
(i.e. the pixel format you specify doesn't actually agree with what's in
the buffer).
--
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/
Thanks Wolfgang, I try that this morning.
Cathy
I use standard PNG file that I read with pnglib. So I'm gonna debug this
in priority. That's odd, because some of them are well displayed and
they are all 24bpp (no alpha channel).
I just tried to "glBindTexture(GL_TEXTURE_2D,textID+1)" the "+1" to
check if the display problem is texture specific or texture coordinate
specific. As the artifacts have moved with the texture, I can tell that
they are texture specific. Not the offset though, they remain on the
same geometry, so it would appeared to be linked with wrong texture
coordinates.
Thanks for the tip, I'm gonna investigate this way
Cathy