Sun washes away vertex colors

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Auria
Competition winner
Posts: 120
Joined: Wed Feb 18, 2009 1:11 am
Contact:

Sun washes away vertex colors

Post by Auria »

Hi,

this is a complex bug I hope someone will be able to shed light now. Right from the start, I can't provider any reproducible test case beyond supertuxkart - the irrlicht mesh view demo, for instance, uses no lighting and can't reproduce that.

First, here is what the object looks like in blender :

Image

the red color is done using vertex painting. Okay a few vertices are not fully painted in blender but I fail to see how this could result in what we see in-game!

In game, however, here is what we see :

Image

What we have found out about this :
1) it only happens when the silo is exported as one with the rest of the track, in a large model. If we export it as a separate scene node, the shading becomes correct again.
2) it occurs on the faces facing the sun. If the model is rotated, the new faces facing the sun get this.
3) If I reduce the power of the sun, it stops occurring.
4) tried disabling specular lighting, didn't help. fully disabling lighting makes this go away.
5) Note that the normals of the model are smoothed so even if the sun somehow managed to make vertex colors go away I think it should still look smoother than that
6) repainting the object differently tends to make the issue go away, like only specific colors were affected??

So I think that under some circumstances, unfortunately I don't know which, the sun overrides the vertex color on SOME vertices of some faces.

Anyone has a clue how to further debug this??
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Sun washes away vertex colors

Post by hybrid »

Actually, the upper image also shows these white streaks, just a little less obvious. Also normals of the silo are not smoothed, otherwise the silo would be perfectly round. This could be the root of the problem, though, as a wongly calculated normal might introduce such problems. How's the silo bottom connected to other meshes below the terrain?
Auria
Competition winner
Posts: 120
Joined: Wed Feb 18, 2009 1:11 am
Contact:

Re: Sun washes away vertex colors

Post by Auria »

hybrid wrote:Actually, the upper image also shows these white streaks, just a little less obvious. Also normals of the silo are not smoothed, otherwise the silo would be perfectly round. This could be the root of the problem, though, as a wongly calculated normal might introduce such problems. How's the silo bottom connected to other meshes below the terrain?
I am aware that it's not fully painted in blender, though the vertices at the bottom in the model are not white, they are just slightly less red - the game renders them fully white. So I agree they aren't as red as the others but still irrlicht renders the wrong color it seems to me

As to how the mesh is connected to everything else, it's very simple, it's not connected at all. The silo is not joined to the ground in any way. It doesn't have a bottom, if that matters
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Sun washes away vertex colors

Post by hybrid »

Is the mesh somewhere in your SVN?
Auria
Competition winner
Posts: 120
Joined: Wed Feb 18, 2009 1:11 am
Contact:

Re: Sun washes away vertex colors

Post by Auria »

The mesh can be found here : http://www.mediafire.com/?hilqs292x58c3h4
(if you get it from our latest SVN you will get one where we managed to make the problem go away without quite knowing how we did it)

in case you want the textures, they are at http://supertuxkart.svn.sourceforge.net ... acks/farm/ and http://supertuxkart.svn.sourceforge.net ... /textures/

And for the blender file, go to http://supertuxkart.svn.sourceforge.net ... acks/farm/
"farm.blend" is the one with the issue, "farm2.blend" is the one where the issue mysteriously went away (I think in fram2.blend the vertices are better painted)

Unfortunately I have not been able myself to reliably reproduce this in a small testcase so if you're trying to reproduce it maybe you won't see anything, that's what makes this bug tricky :?
Post Reply