Hi
Hope it's OK posting here as I'm not sure my problem can be considered 'advanced 3D' but here goes...
Basically, I've written a function to do tri sub-division by placing a new vertex at the centre of each side of a tri. The problem I'm having is calculating the normals of the new vertices. The calculation I'm using at the moment to do this is as follows:
norm_x_of_centre_vert# = norm_x_of_vert_0 + ((norm_x_of_vert_1-norm_x_of_vert_0)/2)
norm_y_of_centre_vert# = norm_y_of_vert_0 + ((norm_y_of_vert_1-norm_y_of_vert_0)/2)
norm_z_of_centre_vert# = norm_z_of_vert_0 + ((norm_z_of_vert_1-norm_z_of_vert_0)/2)
I think this gives the new normals the right direction but it also 'crops' them so that they don't have a length of 1. I'm pretty new to 3D concepts so don't really understand why normals have to have a unit length.
Any help sorting this problem out would be much appreciated!
Thanks in advance.
Hope it's OK posting here as I'm not sure my problem can be considered 'advanced 3D' but here goes...
Basically, I've written a function to do tri sub-division by placing a new vertex at the centre of each side of a tri. The problem I'm having is calculating the normals of the new vertices. The calculation I'm using at the moment to do this is as follows:
norm_x_of_centre_vert# = norm_x_of_vert_0 + ((norm_x_of_vert_1-norm_x_of_vert_0)/2)
norm_y_of_centre_vert# = norm_y_of_vert_0 + ((norm_y_of_vert_1-norm_y_of_vert_0)/2)
norm_z_of_centre_vert# = norm_z_of_vert_0 + ((norm_z_of_vert_1-norm_z_of_vert_0)/2)
I think this gives the new normals the right direction but it also 'crops' them so that they don't have a length of 1. I'm pretty new to 3D concepts so don't really understand why normals have to have a unit length.
Any help sorting this problem out would be much appreciated!
Thanks in advance.