Gouraud shading

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
attitude
Posts: 10
Joined: Mon Aug 09, 2010 8:19 am

Gouraud shading

Post by attitude »

I load a 3ds mesh file, add light scene node with gouraud shading, everything works fine. But the scene doesn't look as what I'm expecting. shades are not smooth and looks faceted. I think more advanced shading algorithms could help. But for instance is there a way to overcome this?

Look at the tree front. One triangle is completely dark, tha adjacent is fully luminous.

Image
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

you can smoothen the normal in your 3d modeling software before exporting.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yah, but you have to use a different format than 3ds, because we don't support smoothing groups for 3ds files.
attitude
Posts: 10
Joined: Mon Aug 09, 2010 8:19 am

Post by attitude »

Strange! I used Blender 2.43 to export my 3ds mesh to .obj model. It works when lighting is off, but when I set EMF_LIGHTING flag to be true, All my models change color, greens become orange or gray, oranges become green. except for some leaves on trees which retain their green color, everything change color. Its's not the case with 3ds model. What has gone wrong?

And I think smoothing normals is a good feature to have. I found this in one of game programming websites:
Well, if you find the normal to a triangle, you are finding a "Face Normal".
If you give OpenGL a face normal for lighting, it will make your object look really flat and not very round. If we find the normal for each vertex, it makes the smooth lighting look. This also covers up blocky looking objects and they appear to have more polygons than they do. Basically, what you do is first calculate the face normals, then you take the average of all the normals around each vertex. It's just averaging. That way you get a better approximation for that vertex.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe the obj file has some more elements exported, e.g. the diffuse lighting color value. But don't know for sure, I'd need the .obj and .mtl files.
For smoothing groups: We do have these things implemented for all other file formats. Just 3ds does not have it, because it's a complicated file format which requires lots of work to have such things implemented. And there are far better formats which deserve more work on them. So Irrlicht in general can cope with per vertex normals without problems.
Brainsaw
Posts: 1177
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

The lighting of my project "Stunt Marble Racers" got way better by just exporting the marbles as .obj instead of .3ds, so I guess (as said before) that's the way to go.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
attitude
Posts: 10
Joined: Mon Aug 09, 2010 8:19 am

Post by attitude »

hybrid wrote:Maybe the obj file has some more elements exported, e.g. the diffuse lighting color value. But don't know for sure, I'd need the .obj and .mtl files.

Thanks hybrid

I think the graphic is proprietary; however I took some objects and exported them to “.Obj” as well as “.3ds”. This time I couldn’t reproduce that color mismatch phenomenon. Instead this time everything is dark, even when I set the ambient light. Here I have uploaded all the necessary files needed to run a sample test.
Post Reply