How to change type of shading?

I am generating a mesh procedurally, but I am facing the following problem with shading: When I split a flat parallelogram (highlighted in the figure 3) into triangles, the light reflection doesn’t look realistically (figure 1). Is there any way how to change shading from gouraud (if I am right and this is currently set) to flat or phong? Or is the problem somewhere else?


The shading just interpolates from one vertex to the other. When an imported model has hard edges, what that really means is it has two sets of overlapping vertices in the same place on that edge- one set that goes with one side of the edge, and another set that goes with the other side.

I think the only thing that is going to fix this to your satisfaction is creating a bevel. So instead of a single edge, you have two edges close together. That way the entire light-to-dark gradation will be confined to the small area between the two edges and not “leak” across the entire front face.

I don’t envy you having to figure out a procedural edge-beveling algorithm but if you’re already procedurally generating architecture, I’m sure you can do it and if this were my project, that’s what I’d get started working on now.