Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Normals on the Fly

This topic is 5826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok, im programming a 3d editor (low poly, similar to milkshape) and they way i store data is such: AddVert(0,0,0); AddVert(1,0,0); AddVert(0,1,0); then i reference verts to create a triangle AddTriangle(0,1,0); AddTriangle(1,0,1); ... this is so that shared verts get transformed properly & to avoid pushing duplicate data ... now, becuase a vertex can be shared:
     V1 |
N2- - - +---+
        |  / 
        | /
see, it has 2 normals (and potentialy more because of the Z) so, i was wondering if i could calculate the normals per frame this would mean 4 times per frame (4 view ports) seeing its a low poly editor, or should i figure out a way to store all the verts normals properly ? any advice or past experiences that may help .. thanx in advance dan | silvermace [EDIT: mistakes] [edited by - silvermace on December 5, 2002 2:39:25 AM]

Share this post

Link to post
Share on other sites
You get the same issue when it comes to texture coordinates and colours. What packages like 3DS Max tend to do is store each vertex component in a separate array and have separate face index array for each.


POSITION positions[numPositions];
COLOUR colours[numColours];
NORMAL normals[numNormals];
MAPCOORD mapcoords[numMapCoords]
FACE position_faces[num_faces];
FACE colour_faces[num_faces];
FACE normal_faces[num_faces];
FACE mapcoords_faces[num_faces];

typedef struct
u16 vertexA;
u16 vertexB;
u16 vertexC;

typedef struct
float x, y, z;

- Makes it much easier to change attributes such as mapping coordinates AFTER they''ve been applied. i.e. you don''t need to re-index every component of the vertex.

- Each vertex can have as many of each component as it requires.

- The data stored is easy to extract to certain APIs and very suitable for some consoles (e.g. GameCube).

- When exporting from a model creation package it''s always better to have more data than you need rather than not enough.

- It makes it much easier to turn individual components on/off (e.g. "show vertex colours").

- Higher memory usage

- Doesn''t map well to PC APIs so needs conversion and re-indexing - this applies for preview rendering as well as export.

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!