Jump to content

Blender exporter: Why Using “flat shading” increase the vertex count a lot?


heyzxz
 Share

Recommended Posts

Hi there,

I’m using Blender exporter v4.4.2 to export a blender model to my BJS game. By default , the exported model is using Smoothing shading, and the vertex count is 760. Then, I tried checking the ‘Using Flat Shading’ (under the 'Babylon.js 4.4.2' in ‘Data’ tab of the ‘Properties’ in Blender)  and export it again, this time I found the vertex count is 1776…

So my questions are:

1. Is it normal? Why the ‘Flat Shading’ increase the vertex count a lot??

2. About the performance, if the vertex counts are equal, can we say the Flat shading has better performance then the Smoothing shading?

3. If the answer for the #2 is yes, consider the vertex count increase (if it is a normal behavior that Flat shading increase the vertex count ), can we still say yes??

Thank you!

Screen-Shot-2016-05-21-at-12.17.45-AM.jpg

760.jpg

1776.jpg

Link to comment
Share on other sites

Flat shading means the normal is calculated as a "face" normal of the triangle.  The vertices of the triangle are all assigned this same value for normal.  This causes the edges of each triangle to be very different from adjacent triangles, giving a flat look.

The normal based on each vertex means every vertex of the triangle has a unique normal.  This causes the value of normal to be interpolated across all texels of triangle in the GPU.  AKA smooth shading.

The reason your vertex count increases is when a vertex shares all of the same values (position, normal, uv1,uv2,color,matriceweight,matriceindex) in Different triangles, they only need to be recorded once.  Flat shading very often means the otherwise shared vertices of different triangles will have a different value for normal.  Sharing then impossible.

Not sure I understand the performance questions.  Either you need flat shading or you do not.  In the case where the mesh looks the same either way, do not flat shade that mesh.  There is also a Flat shade Entire Scene switch on Scene tab.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...