Menu

#11 Patch for correct normal calculation in FTExtrudeGlyph

open
nobody
None
5
2010-06-04
2010-06-04
No

I noticed that the generated normals are not right for all characters.

o they point the wrong direction
o because a single quad strip is used the normal on sharp edges are interpolated in OpenGL.

Vertexes in quad strips can only really only be shared if they are the same. If they have different normal they are not the same.

This is a 1st attempt to patch the issue. Smooth parts are still rendered with a single quad strip (for example as in '8' 'O' or '0', or parts of '3' 'B', etc).
When a sharp edges (for example in the letter 'H') are detected a new quad strip is started. The smooth angle is currently hardcode to 20 degrees.

A sharp edge is currently defined as "The normal differs by more than 20 degrees". Maybe that should be configurable.

The patch is a bit hacky, but it works for me. I'm happy to provide a better version with suggested changes.

Discussion

  • Lars Hofhansl

    Lars Hofhansl - 2010-06-04

    patch

     
  • Lars Hofhansl

    Lars Hofhansl - 2010-06-04
    • summary: Patch for correct normal calculated in FTExtrudeGlyph --> Patch for correct normal calculation in FTExtrudeGlyph
     
  • Lars Hofhansl

    Lars Hofhansl - 2010-06-05

    much cleaner/smaller patch