How to eliminate phong normal intepolation?

Started by
1 comment, last by santa01 11 years, 11 months ago
So I'm learning Phong illumination technique. I have an ambient + diffuse lighted cube with light directed orthogonally to one of the faces (see attachement). Neighbour faces are partially lighted which is technically correct due to normals interpolation but looks unnatural so I'm looking forward on how to eliminate such effect.
My thoughts on how to `eliminate' normals interpolation in partial cases are:
- duplicate mesh verticies and give them proper orthogonal normals (complicates asset creation/export steps and makes mesh larger);
- make mesh edges rounded (complicates geometry);
- add a `correction' normal map;
- add another vertex attribute to indicate if we should use existing normal or calculate a new orthogonal one (also makes mesh larger);
- write another shader to perform flat-shading (will affect all the mesh);
My goal is to correctly shade shapes like cylinder where top and bottom faces should be flat shaded and all other surface smooth shaded.
Advertisement
First option. Asset creation shouldn't be much of a problem, there are many options to split the mesh in an editor (you can for example select faces by smoothing group and detach the selected portion of the mesh). Or the mesh can be split by the loading function in your program, that's a bit complicated to solve, but not that advanced.
Note, that you don't have to duplicate/triplicate/quadruplicate all of the vertices, only the ones that share faces with different smooth IDs (so they don't belong to the same smooth surfaces), so in most cases that doesn't mean too much extra mesh data.
Note 2: it's the same story with different texture coordinates at the same vertex: you have to split the vertex.


The other options are big no-no.

First option. Asset creation shouldn't be much of a problem, there are many options to split the mesh in an editor (you can for example select faces by smoothing group and detach the selected portion of the mesh). Or the mesh can be split by the loading function in your program, that's a bit complicated to solve, but not that advanced.
Note, that you don't have to duplicate/triplicate/quadruplicate all of the vertices, only the ones that share faces with different smooth IDs (so they don't belong to the same smooth surfaces), so in most cases that doesn't mean too much extra mesh data.
Note 2: it's the same story with different texture coordinates at the same vertex: you have to split the vertex.


The other options are big no-no.


Sounds resonable, thx.

This topic is closed to new replies.

Advertisement