Color flickering on meshes when in OPENGL

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
GrigoriosSokratis
Posts: 34
Joined: Wed Apr 25, 2007 3:48 am

Color flickering on meshes when in OPENGL

Post by GrigoriosSokratis »

Hi, I have this 3ds mesh as the terrain of my project (I did it so because the results are much better performance wise as well as in quality).

Now, my problem is that when rendering it under OpenGL it has this annoying color flickering when moving the camera direction, while when rendered under Direct3D it works, quite fine with no flickers at all.

I've attached two screenshots showing how it looks when moving the camera just a little bit to the right. You'll see that the whole mesh darkens significantly.

Image

Image

It also seems that the

nody->setMaterialFlag(video::EMF_LIGHTING, true);

flag doesn't make any difference, since even when there's no light at all the mesh remains completely iluminated as if it was receiving light from an omnidirectional like source.

Any help appreciated,
Thanks.
twilight17
Posts: 362
Joined: Sun Dec 16, 2007 9:25 pm

Post by twilight17 »

(this is a guess) but does it matter if you have a light in the 3ds scene? and if so, did you?
Post this userbar I made on other websites to show your support for Irrlicht!
Image
http://img147.imageshack.us/img147/1261 ... wernq4.png
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Do you scale the mesh after loading? Could be a problem with normals (at least for the lit version).
GrigoriosSokratis
Posts: 34
Joined: Wed Apr 25, 2007 3:48 am

Post by GrigoriosSokratis »

No, there aren't any original lights imported along with the 3ds object.

As for being scaled, as a matter of fact, yes I've scaled it (but this is how it must be done as we are talking about a rendered area of about 40 sq kms).
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You have to renormalize normals after scaling, otherwise lighting will fail. Also, when scaling too large you will notice that the faces will become pretty huge. Due to the per-face shading you can spot pretty bad color changes and seams. You can increase the triangle count in order to overcome this problem (the terrain scene node uses dynamic LOD for this reason, otherwise you will get too many faces in the very far background). Or you use per-pixel shading with phong shaders or similar techniques.
Post Reply