I'd like to post some details about PtiNounours bug seen
earlier in this thread.
I looked at the
Wall_test.dae.obj file defined in
test_wall.sh3d contained in the
file he posted, and found why this imported part caused a problem. This OBJ file contains 2 shapes:
- the exterior of the wall object with normals pointing towards the exterior of the object and with a wall texture,
- the interior of the wall object with normals pointing towards the interior of the object; this second part is white.
It's a similar bug to
this one where SunFlow didn't handle correctly the double sided triangles of one shape, but this time the bug is at a higher level. Instead of having twice the same triangle (one oriented in a clockwise order, the other one oriented in a counter clockwise order) in
one shape, you have
two shapes with the same triangles oriented differently; one of the shape uses a texture and the other one is white.
OpenGL handles these two shapes nicely because it ignores the faces with a normal that doesn't point towards the observer. At the opposite, SunFlow renders all the faces without taking into account whether its normal points towards the observer or not. So sometimes it chooses the textured face, sometimes the white face. Fixing this isn't easy because it's two separated shapes and not twice the same triangles within a shape.
But you can also avoid the problem by following
PtiNounours' suggestion.
This
thread created by Hans is about the same bug.