Upgrading to ^r157 gives error "Cannot read properties of undefined (reading 'normal')"


I’ve been revisiting drawing edges geometry from this thread by @prisoner849 i’ve noticed that the following forked codepen example breaks at r157 and above with the error “Cannot read properties of undefined (reading ‘normal’)” ( it’s currently set to the working r156 version but you can replicate the error by changing the import maps to import r157 and above )

there doesn’t seem to be anything relative in the Migration-Guide outlining any apparent changes to the geometry class only this…

The GLSL struct GeometricContext has been removed from the GLSL code base

which i’m assuming is only shader based and shouldn’t have had an effect on the geometry class resulting in this error…

would anyone know if this is something that has intentionally been changed / updated in three or if this is either a bug or if there’s something that needs updating in the examples code to make work with 157^

EDIT: just realized this isn’t a problem with core three as this only breaks when updating the addons/ directory to r157, the only thing relevant being imported / used from addons (jsm) in this scenario is BufferGeometryUtils.mergeVertices… was there an update to the mergeVertices method such as the calculation of the tolerance parameter or something?

EDIT2: there is an update to the mergeVertices method from 156 → 157 here…



would anyone know (or know of documentation on) how we can have the previous and current mergeVertices method behave consistently between versions? is it a case of multiplying / dividing the tolerance by a factor or something?

1 Like

I think mergeVertices encorporates the normal as part of the key to compare vertices to merge… and maybe you’re passing in a geometry without normals?

can you try geometry.computeVertexNormals() before passing it in to mergeVertices?