I want to compute the vertextNormals of this model to properly using MeshNormalMaterial on it.
I get good result by using BufferGeometry.computeVertexNormals
.
The only problem is that it averaging face normals on the bottom cube, what I want is like the upper cube(sharp edge), so I try to use Geometry.computeFlatVertexNormals (which does not exist in BufferGeometry).
But after I use Geometry.fromBufferGeometry()
, all the morphTargets informations lost.
Is there any proper way to achieve this requirement?
I realized that set flatShading=true
for MeshNormalMaterial can make the bottom cube correct.
But beause I use this MeshNormalMaterial as scene.overrideMaterial
, so I don’t want to change the material but the geometry.
The conversion from BufferGeometry
to Geometry
was not further enhanced on purpose. There were existing PRs and issues but the request can be considered as a Won't fix
(see https://github.com/mrdoob/three.js/pull/14493#issuecomment-405866263).
You can try to call toNonIndexed()
on your BufferGeometry
so that no vertices are shared anymore. If you then call computeVertexNormals()
, the normals won’t be weighted across multiple faces anymore.
1 Like
toNonIndexed()
works! Thank you!