Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

Normals

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Normals

    In most of the beginners' code that I've worked with, I not done much with lighting. But reading about normals (used primarily with lighting, it seems) made me wonder about this statement I found in an online tutorial ...

    With OpenGL, you can specify a normal for each polygon or for each vertex ... ... you define normal vectors for an object at the same time you define the object's geometry.
    What caught my attention what that OpenGL doesn't calculate the normals for you. I can see that having them pre-defined with the model will possibly improve performance, but I'd have expected OpenGL to at least give you the choice of having normals calculated automatically - allowing the user to decide whether the performance hit was big enough to warrant pre-assignment of normals.

    I did see one other reference, where the assignment of a normal might not always be as expected, in order to create lighting effects. That suggests cases where automatic normal calculation would not be desired.

  • #2
    Originally posted by Gary Beene View Post

    What caught my attention what that OpenGL doesn't calculate the normals for you. I can see that having them pre-defined with the model will possibly improve performance, but I'd have expected OpenGL to at least give you the choice of having normals calculated automatically - allowing the user to decide whether the performance hit was big enough to warrant pre-assignment of normals.
    I dabbled with lighting/materials, but haven't graduated yet, but ..

    glEnable(%GL_AUTO_NORMAL) ?

    I did see one other reference, where the assignment of a normal might not always be as expected, in order to create lighting effects. That suggests cases where automatic normal calculation would not be desired.
    It depends on how the vertices are ordered for a given object.
    http://www.lighthouse3d.com/opengl/t...ex.php?normals
    "Show me a young Conservative and I'll show you someone with no heart. Show me an old Liberal and I'll show you someone with no brains." ― Winston Churchill
    "Socialism is the philosophy of failure, the creed of ignorance and the gospel of envy." ― Winston Churchill

    Comment


    • #3
      Hi Doug,
      Thanks for the reference. Reading further ...

      If either of the vertex evaluators is enabled (GL_MAP2_VERTEX_3 or GL_MAP2_VERTEX_4), then the normal to the surface is computed analytically.
      So there are cases where we can have the normals generated by OpenGL. That makes more sense, as does the option to provide normals for performance reasons.

      The tutorial I read just didn't forward reference the option, so I wondered why the feature wasn't available.

      Comment


      • #4
        Gary:

        GL_ENABLE(GL_NORMALIZE)
        GL_ENABLE(GL_RESCALE_NORMAL)
        Walt Decker

        Comment


        • #5
          Wasn't aware of the normal calculation OpenGl provides and did it myself in the code hereby a while ago .
          http://www.powerbasic.com/support/pb...ad.php?t=59207

          Comment

          Working...
          X