geometry.computeVextexNormals() no effects

Hello,

I’m working on morph with Needle, but I have a problem:
I use a morph from a flat O (original torus) to a sphere. However, when the geometry takes the form of a sphere, the reflections of the material are not realistic, they still react as if it were a flat surface.

So, to fix the problem I called this.gameObject.geometry.computeVertexNormals() in update() so that it recalculates the geometry-related material behaviour.
But this does not change anything.

Any idea of the problem ?


image.png
image.png

Original Post on Discord

by user 224464722878005248

(First photo the result, second the correct behaviour wished, third the scene on unity)

by user 224464722878005248

When it’s morph targets I believe you should update the normals of those morph targets, and then three takes care of the blending
Aka: your morph targets should specify normals

Ok I will take a look to that

by user 224464722878005248

by user 224464722878005248

I see this from my attributes, and this from my morphAttributes :

by user 224464722878005248

image.png

by user 224464722878005248

Problem, computevertexNormal is only on the geometry which own the different attributes.
image.png

by user 224464722878005248

So how could I update the normal of my morph if it’s not a geometry ?

by user 224464722878005248

I tried this :

this.gameObject.geometry.setAttribute( "normal" , new THREE.Float32BufferAttribute(this.gameObject.geometry.morphAttributes.normal.array, 3));

Problem : it’s binary, I use only normals from the morph, it’s not progressive when I animate it

by user 224464722878005248

and it’s create material mistakes

by user 224464722878005248

by user 224464722878005248

I’m not sure what you try - usually when you want to animate morphs you

  • create the targets with their respective geometry attributes; all vertex counts and attributes should match (so all should have normals or none)
  • set the blend weights - no need to calculate new normals, the blending will blend between the morph target’s respective normals
  • done

I created my morph on blender with keyshape
So, with it’s own vertex, as you say
Export it as fbx
I add my material and I animate it with Gsap in a custom script

It’s all
But my normals doesn’t react normally

by user 224464722878005248

I have a lot of problem with my material
And I don’t know why…
Very strange because it’s only a basic mesh

by user 224464722878005248

Is it possible to send my fbx or a basic scene to share the problem ?

by user 224464722878005248

To be accurate:
When I change my morph weight 0 to 1
So O letter to a sphere
The surface reflect light as a flat surface (like with the O letter shape)

by user 224464722878005248

Sure send me the FBX

Main reason for what you describe would be that the normals are not actually in the blendshapes

I’ll send you the fbx and the Blender file (to know if I missed something)
I do it immediately when I come back to my home
Thanks again you’re really great

by user 224464722878005248