Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  


An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Author Topic: Steve,a question about morph normals.  (Read 2918 times)


  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Steve,a question about morph normals.
« on: January 29, 2014, 04:31:49 pm »

Hi Steve

I'm coding an  An8 Opengl Renderer and
I've started working on morph rendering.

It's going well.Interpolation is calculated exactly like it's shown in the graph editor.

The vertices are interpolated in the vertex shader and I was
planning to do the same for the normals as soon as morph normals would be available from the An8 file.

Code: [Select]
vec3 FinalMorphPos = Position;
vec3 FinalMorphNormal = Normal;
for (int i = 0 ; i < gNumMorphs ; i++) { 
FinalMorphPos += gMorphInterp[i] * MorphPosOffset[i];
FinalMorphNormal += gMorphInterp[i] * MorphNormalOffset[i];
FinalMorphNormal = normalize(FinalMorphNormal);

But,I then realized that moving vertices like morphing does, might change the smoothing state of some faces screwing the
interpolation calculation.Even would add or
substract normals.

So in Anim8or,do you use a special interpolation method or as I suspect,do you simply recalculate the normals for each frame ?




  • Administrator
  • Hero Member
  • *****
  • Posts: 1858
    • View Profile
Re: Steve,a question about morph normals.
« Reply #1 on: February 22, 2014, 06:43:21 pm »

Anim8or recalculates all normals whenever the geometry changes, including changing the value of a morph target. That's the only way to guarantee correct results, though I'm pretty sure with some though you could get *very* close with some kind of interpolation scheme for morph targets. (But don't forget to normalize them if you do interpretation or the brightness could go whacky :)


  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Steve,a question about morph normals.
« Reply #2 on: March 13, 2014, 03:08:40 pm »

Nice to know that all normals are also recalculated when
geometry is changed by skeleton animation.

For morphs,I'll use the interpolation as shown in the code
posted.I'll calculate the NormalOffset keeping the same smoothing state as the original mesh.
Not perfect,but good enough for most mesh (specially for organic models) and fast.

But,I would like eventually to try recalculating normals each render on the gpu using a compute shader.We'll see.

Thanks for your time.