Skip to content

Flat Shading #396

Answered by asny
Sheol27 asked this question in Q&A
Sep 21, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi.

Flat shading is not supported explicitly in three-d, so I guess that's a feature request (I saw you made the issue #397 as well). You can still enable flat shading though, it's just a bit cumbersome. You need to split your mesh where there's an edge and make duplicate vertices and then compute the normals again. So if you want every triangle to be flat shaded, you can't use an index buffer but have to have three vertices for each triangle and the normal for all three vertices must be the normal of the triangle. The default cube mesh is constructed like that if you need an example. That's why the cube have a hard edge in the shapes example.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Sheol27
Comment options

@asny
Comment options

Answer selected by Sheol27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants