Results 1 to 5 of 5

Thread: What is a normal?

  1. #1

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    What is a normal?

    I haven't found many good tutorials on the uses of surrace normals or what they're for. All I can basically figure is that it is a ray that is perpendicular to the surface, but I have no idea how to calculate them or why we need them.

    Could anyone shed some light on the topic?
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  2. #2
    Zaei
    Guest

    Re: What is a normal?

    Originally posted by Sastraxi
    Could anyone shed some light on the topic?
    Funny you put it that way. Face Normals are vectors that point in the direction that a face is pointing. Vertex Normals is the averaged normal of all faces that share that vertex. Normals are usually used for, well, lighting. You can calculate the angle between a ray from a light to a vertex, and that vertex's normal, and use that to calculate the amount of light that hits that vertex, and thus, its intensity.

    There is a tutorial about lighting over on directx4vb (you know the address). There is a function to calculate face normals in that tutorial.

    Z.

  3. #3

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Ah, so that's where I got it from. Thanks for that. Oh, and I don't want to start another thread but how do you do light maps? I don't believe he covered that one at his site.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    One last thing- I need to know actual code for the Vector Subtract and Cross Product and Normalise functions, I don't want to have DirectX as a dependancy for those 3 functions.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5
    Zaei
    Guest
    Lightmaps are simply an extra texture blended (additive) on top of the regular texture to give the appearance of light in an area.

    Vector Subtract is easy:
    Code:
    given vector A and vector B, and result vector r:
    r.x = A.x - B.x
    r.y = A.y - B.y
    r.z = A.z - B.z
    Vector Normalize is also fairly easy:
    Code:
    Given vetor A and result vector r:
    mag = sqrt((A.x)^2 + (A.y)^2 + (A.z)^2)
    r.x = A.x / mag
    r.y = A.y / mag
    r.z = A.z / mag
    Cross Product:
    Code:
    Given vector A, vector B, and result vertor r:
    r.x = A.y * B.z - A.z * B.y
    r.y = A.z * B.x - A.x * B.z
    r.z = A.x * B.y - A.y * B.z
    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width