2021年3月18日星期四

How to implement flat shading in LWJGL

I'm working on a small project in LWJGL. Currently I'm storing vertices, normals, and vertex colors from an obj/mtl file.

I'm trying to prevent vertex shading. That is, I want each polygon to have it's defined color. I've done some reading online and I've seen using the flat modifier on shaders, and gldisable(GL_BLEND). So far the only thing that has given me the desired result is creating 6 separate planes and shading them accordingly in Blender.

The sperate planes seems like a total hack, and I don't see how that would scale well.

The cube on the left is simply a cube exported from blender with 6 different materials. The one on the right, what I'm trying to achieve, it 6 planes modeled to look like a cube, then exported.

enter image description here

What is the proper way to achieve my goal of independently colored faces?

https://stackoverflow.com/questions/66701247/how-to-implement-flat-shading-in-lwjgl March 19, 2021 at 09:07AM

没有评论:

发表评论