Author Topic: shading types  (Read 3862 times)

Mr. Hanson

  • Guest
shading types
« on: March 10, 2003, 08:46:54 pm »
It sure would be nice if there was an easy way to switch an object between flat shading and smooth shading. Since you have to calculate the normals anyway, shouldn't this be pretty easy to implement?  How does the Object3D.build() calculate normals?  Does it average the normals of the polygons that share verticies or does it average the normals of the polygons whoes verticies are close to one another.  If I wanted my object to appear flat shaded, do I just have to make sure that the polygons on my object do no share verticies?  Sorry for being ignorant.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
shading types
« Reply #1 on: March 11, 2003, 05:52:47 pm »
build() averages the normals of polygons whose vertices are (very very) close to another. I've never added flat-shading, because i considered it to be useless nowadays. It should be possible to "hack" it into the normal-calculation by taking the surface normal as a vertex normal for all the vertices of a polygon. If you really need it, i'll think about that. What i won't do is to implement a flat-shaded-only renderer, i.e. there won't be a performance gain when using flat-shading done in this way.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
shading types
« Reply #2 on: March 11, 2003, 07:48:13 pm »
The next release (0.85) will most likely contain the feature you requested. As mentioned, flat shading will be emulated by feeding face normals into the gouraud shader instead of vertex normals, so it won't be any faster than gouraud.
In addition, it disables the usage of triangle strips, so it's even slower when using OpenGL support (not noticeable on nVidia hardware, quite noticeable on ATI cards).

Anonymous

  • Guest
shading types
« Reply #3 on: March 12, 2003, 05:43:16 am »
Thanks for the reply.  I was hoping to be able to use both flat and smooth shaded objects in the same world.  There are some simple models that I have created that just look more realistic flat shaded, ie the side of a building, the metalic surface of my ship or tank.  Then there are those models that look great smooth shaded.