Author Topic: Defining a surface normal given 3 points.  (Read 5491 times)

0 Members and 1 Guest are viewing this topic.

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Defining a surface normal given 3 points.
« on: September 23, 2007 »

I'm making some prodecurally generated models for my game and I need to know how to define a surface normal for each triangular face. All polygons are wound in the same direction, if this helps any. I know that a surface has 2 possible normals so calculation should be tried for both normals. I think the winding of the points defines which side the normal is set on.

So given (x,y,z) and (x1,y1,z1) and (x2,y2,z2) How would I derive the final normal value?
Is the normal affected by the clockwise or counterclockwise processing of the points?
Also please not that I don't quite have vectors down yet.  :-\

So from a series of counter clockwise wound verticies, i need the normals in the form of (normalx,normaly,normalz), all the values must not be greater than 1. This is for an openGl model.

Again I REALLy thank you all for you help so far. This is a wonderfull forum.
« Last Edit: September 23, 2007 by Pixel_Outlaw »
Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Re: Defining a surface normal given 3 points. (Solved)
« Reply #1 on: September 23, 2007 »
I found some code just after posting. Looked for about 2 hours.....

http://www.kev.pulo.com.au/sv3/sv3_1999_assignment2/node22.html  :||
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Defining a surface normal given 3 points.
« Reply #2 on: September 23, 2007 »
Let us know what you done with what you've found!
You need to give us a day to answer, unfortunately (fortunately?) we're spread all over the world and it takes 24hrs for us to see and reply!
I'm impressed that you managed to get a solution though, and it's an interesting part of 3d math.  How much 3d math do you need to do your current project?  I'm pretty sure I can help. ;D

Jim
Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Re: Defining a surface normal given 3 points.
« Reply #3 on: September 23, 2007 »
Let us know what you done with what you've found!
You need to give us a day to answer, unfortunately (fortunately?) we're spread all over the world and it takes 24hrs for us to see and reply!
I'm impressed that you managed to get a solution though, and it's an interesting part of 3d math.  How much 3d math do you need to do your current project?  I'm pretty sure I can help. ;D

Jim


Oh I was in no hurry yesterday. I wasn't expecting an instant answer I just happened to find some usefull scaler routine after posting. If anyone has time to answer my questons (and I do have alot about opengl) I can do IRC or MSN Messenger rather than spamming up a forum. ;) Currently I'm working on Gun Ranger neXt which will be a sequil to Gun Ranger X done in minimalist 3D style. I enjoy seeing all the faces of the meshes and being able to enjoy them visually for the simplicity. The game will use alot of alpha channel work and probably no texture mapping. Think a game that looks like it's an early 80's polygon game only with slightly more complicated shapes and a bit higher resolution. I'm not shooting for "retro" but something visually simplistic.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Defining a surface normal given 3 points.
« Reply #4 on: September 23, 2007 »
If anyone has time to answer my questons (and I do have alot about opengl) I can do IRC or MSN Messenger rather than spamming up a forum. ;)

Actually the reverse is true. Speaking personally I would usually turn down any requests to give 1 to 1 help on instant message programs for anyone.

There are reasons, it helps only one person to do it that way, it's too time consuming to give feedback that way and once the information is given, it is lost and strikes me as being against the grain of the community.. People here share thier stuff.

The way that this forum grows more and more useful is to have questions posted so we welcome them.

Please do post your questions, the forum needs all your programming questions so that it can get more and more useful. Coding questions are not considered as spam.
Shockwave ^ Codigos
Challenge Trophies Won: