Calculating normals for a polygon mesh (3D computer graphics)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












I want to write a program to generate arches, a common architectural form, and export them to a wavefront object format for sharing with various three dimensional graphics editors. To do this, I need to generate normals for inclusion in the wavefront object. I understand that normals represent the orientation of a surface at a vertex. I need to understand how to calculate them, and specifically what the i,j,k coordinates signify.










share|cite|improve this question





















  • You may want to look at en.wikipedia.org/wiki/Cross_product. Although, calculating the normal from your mesh is going to make your shading look not as smooth compared to calculating your normal from the actual equation of the thing you are approximating. This course udacity.com/course/cs291 also has more info.
    – Steven Gubkin
    Dec 9 '13 at 14:19










  • Face normals are easy to compute, per Omnomnomnom's answer. Vertex normals can then be obtained through a weighted average of the face normals; see e.g. Max's paper.
    – J. M. is not a mathematician
    Dec 27 '16 at 5:33














up vote
1
down vote

favorite
1












I want to write a program to generate arches, a common architectural form, and export them to a wavefront object format for sharing with various three dimensional graphics editors. To do this, I need to generate normals for inclusion in the wavefront object. I understand that normals represent the orientation of a surface at a vertex. I need to understand how to calculate them, and specifically what the i,j,k coordinates signify.










share|cite|improve this question





















  • You may want to look at en.wikipedia.org/wiki/Cross_product. Although, calculating the normal from your mesh is going to make your shading look not as smooth compared to calculating your normal from the actual equation of the thing you are approximating. This course udacity.com/course/cs291 also has more info.
    – Steven Gubkin
    Dec 9 '13 at 14:19










  • Face normals are easy to compute, per Omnomnomnom's answer. Vertex normals can then be obtained through a weighted average of the face normals; see e.g. Max's paper.
    – J. M. is not a mathematician
    Dec 27 '16 at 5:33












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I want to write a program to generate arches, a common architectural form, and export them to a wavefront object format for sharing with various three dimensional graphics editors. To do this, I need to generate normals for inclusion in the wavefront object. I understand that normals represent the orientation of a surface at a vertex. I need to understand how to calculate them, and specifically what the i,j,k coordinates signify.










share|cite|improve this question













I want to write a program to generate arches, a common architectural form, and export them to a wavefront object format for sharing with various three dimensional graphics editors. To do this, I need to generate normals for inclusion in the wavefront object. I understand that normals represent the orientation of a surface at a vertex. I need to understand how to calculate them, and specifically what the i,j,k coordinates signify.







computer-science 3d






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Dec 9 '13 at 13:50









John Spragge

62




62











  • You may want to look at en.wikipedia.org/wiki/Cross_product. Although, calculating the normal from your mesh is going to make your shading look not as smooth compared to calculating your normal from the actual equation of the thing you are approximating. This course udacity.com/course/cs291 also has more info.
    – Steven Gubkin
    Dec 9 '13 at 14:19










  • Face normals are easy to compute, per Omnomnomnom's answer. Vertex normals can then be obtained through a weighted average of the face normals; see e.g. Max's paper.
    – J. M. is not a mathematician
    Dec 27 '16 at 5:33
















  • You may want to look at en.wikipedia.org/wiki/Cross_product. Although, calculating the normal from your mesh is going to make your shading look not as smooth compared to calculating your normal from the actual equation of the thing you are approximating. This course udacity.com/course/cs291 also has more info.
    – Steven Gubkin
    Dec 9 '13 at 14:19










  • Face normals are easy to compute, per Omnomnomnom's answer. Vertex normals can then be obtained through a weighted average of the face normals; see e.g. Max's paper.
    – J. M. is not a mathematician
    Dec 27 '16 at 5:33















You may want to look at en.wikipedia.org/wiki/Cross_product. Although, calculating the normal from your mesh is going to make your shading look not as smooth compared to calculating your normal from the actual equation of the thing you are approximating. This course udacity.com/course/cs291 also has more info.
– Steven Gubkin
Dec 9 '13 at 14:19




You may want to look at en.wikipedia.org/wiki/Cross_product. Although, calculating the normal from your mesh is going to make your shading look not as smooth compared to calculating your normal from the actual equation of the thing you are approximating. This course udacity.com/course/cs291 also has more info.
– Steven Gubkin
Dec 9 '13 at 14:19












Face normals are easy to compute, per Omnomnomnom's answer. Vertex normals can then be obtained through a weighted average of the face normals; see e.g. Max's paper.
– J. M. is not a mathematician
Dec 27 '16 at 5:33




Face normals are easy to compute, per Omnomnomnom's answer. Vertex normals can then be obtained through a weighted average of the face normals; see e.g. Max's paper.
– J. M. is not a mathematician
Dec 27 '16 at 5:33










1 Answer
1






active

oldest

votes

















up vote
0
down vote













If you're creating a polygon mesh, presumably you'll want normal vector given a particular triangular face.



First of all, definitions: a normal on some point of a surface is a vector that points perpendicular to that surface at that point. Since each surface (locally) has two sides, you have two valid directions of normal-vectors: one side on which the vector would point towards the surface, and one side on which the vector would point away from the surface.



Now, suppose you have a triangle determined by the three points $a = (a_1,a_2,a_3), b = (b_1,b_2,b_3),$ and $c = (c_1,c_2,c_3)$. Define
$$
v_ab=(b_1-a_1,b_2-a_2,b_3-a_3)\
v_bc=(c_1-b_1,c_2-b_2,c_3-b_3)
$$
In order to find a normal vector, calculate $v_abtimes v_bc$ or, for the opposite orientation, $v_bc times v_ab$, where "$times$" here denotes the cross-product.






share|cite|improve this answer




















  • Let me know if I can explain anything above more thoroughly
    – Omnomnomnom
    Dec 9 '13 at 14:19










  • how would you create (approx) a sphere? considering that the minimum surface unit given is a triangle? in other words, how would you triangular mesh a sphere? (here the sphere is taken as an example for any object)
    – Anonymous
    Jun 25 '17 at 5:11










  • @Anonymous you should post a new question about that.
    – Omnomnomnom
    Jun 25 '17 at 6:05










  • I think I got it, $A_i = r(theta_i, phi_i) ; B_i = r(theta_i, phi_i +Deltaphi) ; C_i = r(theta_i +Deltatheta, phi_i)$ where $vecr=(costhetasinphi,sinthetasinphi,cosphi)$ and then iterate $0 leq theta leq 2pi$ and $0leq phi leq pi$ as $theta_i = theta_i-1+Deltatheta$
    – Anonymous
    Jun 25 '17 at 6:21











  • so in general, parametrize the surface with 2 variables, and to triangular mesh vary each variable.
    – Anonymous
    Jun 25 '17 at 6:22










Your Answer





StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f599803%2fcalculating-normals-for-a-polygon-mesh-3d-computer-graphics%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













If you're creating a polygon mesh, presumably you'll want normal vector given a particular triangular face.



First of all, definitions: a normal on some point of a surface is a vector that points perpendicular to that surface at that point. Since each surface (locally) has two sides, you have two valid directions of normal-vectors: one side on which the vector would point towards the surface, and one side on which the vector would point away from the surface.



Now, suppose you have a triangle determined by the three points $a = (a_1,a_2,a_3), b = (b_1,b_2,b_3),$ and $c = (c_1,c_2,c_3)$. Define
$$
v_ab=(b_1-a_1,b_2-a_2,b_3-a_3)\
v_bc=(c_1-b_1,c_2-b_2,c_3-b_3)
$$
In order to find a normal vector, calculate $v_abtimes v_bc$ or, for the opposite orientation, $v_bc times v_ab$, where "$times$" here denotes the cross-product.






share|cite|improve this answer




















  • Let me know if I can explain anything above more thoroughly
    – Omnomnomnom
    Dec 9 '13 at 14:19










  • how would you create (approx) a sphere? considering that the minimum surface unit given is a triangle? in other words, how would you triangular mesh a sphere? (here the sphere is taken as an example for any object)
    – Anonymous
    Jun 25 '17 at 5:11










  • @Anonymous you should post a new question about that.
    – Omnomnomnom
    Jun 25 '17 at 6:05










  • I think I got it, $A_i = r(theta_i, phi_i) ; B_i = r(theta_i, phi_i +Deltaphi) ; C_i = r(theta_i +Deltatheta, phi_i)$ where $vecr=(costhetasinphi,sinthetasinphi,cosphi)$ and then iterate $0 leq theta leq 2pi$ and $0leq phi leq pi$ as $theta_i = theta_i-1+Deltatheta$
    – Anonymous
    Jun 25 '17 at 6:21











  • so in general, parametrize the surface with 2 variables, and to triangular mesh vary each variable.
    – Anonymous
    Jun 25 '17 at 6:22














up vote
0
down vote













If you're creating a polygon mesh, presumably you'll want normal vector given a particular triangular face.



First of all, definitions: a normal on some point of a surface is a vector that points perpendicular to that surface at that point. Since each surface (locally) has two sides, you have two valid directions of normal-vectors: one side on which the vector would point towards the surface, and one side on which the vector would point away from the surface.



Now, suppose you have a triangle determined by the three points $a = (a_1,a_2,a_3), b = (b_1,b_2,b_3),$ and $c = (c_1,c_2,c_3)$. Define
$$
v_ab=(b_1-a_1,b_2-a_2,b_3-a_3)\
v_bc=(c_1-b_1,c_2-b_2,c_3-b_3)
$$
In order to find a normal vector, calculate $v_abtimes v_bc$ or, for the opposite orientation, $v_bc times v_ab$, where "$times$" here denotes the cross-product.






share|cite|improve this answer




















  • Let me know if I can explain anything above more thoroughly
    – Omnomnomnom
    Dec 9 '13 at 14:19










  • how would you create (approx) a sphere? considering that the minimum surface unit given is a triangle? in other words, how would you triangular mesh a sphere? (here the sphere is taken as an example for any object)
    – Anonymous
    Jun 25 '17 at 5:11










  • @Anonymous you should post a new question about that.
    – Omnomnomnom
    Jun 25 '17 at 6:05










  • I think I got it, $A_i = r(theta_i, phi_i) ; B_i = r(theta_i, phi_i +Deltaphi) ; C_i = r(theta_i +Deltatheta, phi_i)$ where $vecr=(costhetasinphi,sinthetasinphi,cosphi)$ and then iterate $0 leq theta leq 2pi$ and $0leq phi leq pi$ as $theta_i = theta_i-1+Deltatheta$
    – Anonymous
    Jun 25 '17 at 6:21











  • so in general, parametrize the surface with 2 variables, and to triangular mesh vary each variable.
    – Anonymous
    Jun 25 '17 at 6:22












up vote
0
down vote










up vote
0
down vote









If you're creating a polygon mesh, presumably you'll want normal vector given a particular triangular face.



First of all, definitions: a normal on some point of a surface is a vector that points perpendicular to that surface at that point. Since each surface (locally) has two sides, you have two valid directions of normal-vectors: one side on which the vector would point towards the surface, and one side on which the vector would point away from the surface.



Now, suppose you have a triangle determined by the three points $a = (a_1,a_2,a_3), b = (b_1,b_2,b_3),$ and $c = (c_1,c_2,c_3)$. Define
$$
v_ab=(b_1-a_1,b_2-a_2,b_3-a_3)\
v_bc=(c_1-b_1,c_2-b_2,c_3-b_3)
$$
In order to find a normal vector, calculate $v_abtimes v_bc$ or, for the opposite orientation, $v_bc times v_ab$, where "$times$" here denotes the cross-product.






share|cite|improve this answer












If you're creating a polygon mesh, presumably you'll want normal vector given a particular triangular face.



First of all, definitions: a normal on some point of a surface is a vector that points perpendicular to that surface at that point. Since each surface (locally) has two sides, you have two valid directions of normal-vectors: one side on which the vector would point towards the surface, and one side on which the vector would point away from the surface.



Now, suppose you have a triangle determined by the three points $a = (a_1,a_2,a_3), b = (b_1,b_2,b_3),$ and $c = (c_1,c_2,c_3)$. Define
$$
v_ab=(b_1-a_1,b_2-a_2,b_3-a_3)\
v_bc=(c_1-b_1,c_2-b_2,c_3-b_3)
$$
In order to find a normal vector, calculate $v_abtimes v_bc$ or, for the opposite orientation, $v_bc times v_ab$, where "$times$" here denotes the cross-product.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Dec 9 '13 at 14:18









Omnomnomnom

124k786174




124k786174











  • Let me know if I can explain anything above more thoroughly
    – Omnomnomnom
    Dec 9 '13 at 14:19










  • how would you create (approx) a sphere? considering that the minimum surface unit given is a triangle? in other words, how would you triangular mesh a sphere? (here the sphere is taken as an example for any object)
    – Anonymous
    Jun 25 '17 at 5:11










  • @Anonymous you should post a new question about that.
    – Omnomnomnom
    Jun 25 '17 at 6:05










  • I think I got it, $A_i = r(theta_i, phi_i) ; B_i = r(theta_i, phi_i +Deltaphi) ; C_i = r(theta_i +Deltatheta, phi_i)$ where $vecr=(costhetasinphi,sinthetasinphi,cosphi)$ and then iterate $0 leq theta leq 2pi$ and $0leq phi leq pi$ as $theta_i = theta_i-1+Deltatheta$
    – Anonymous
    Jun 25 '17 at 6:21











  • so in general, parametrize the surface with 2 variables, and to triangular mesh vary each variable.
    – Anonymous
    Jun 25 '17 at 6:22
















  • Let me know if I can explain anything above more thoroughly
    – Omnomnomnom
    Dec 9 '13 at 14:19










  • how would you create (approx) a sphere? considering that the minimum surface unit given is a triangle? in other words, how would you triangular mesh a sphere? (here the sphere is taken as an example for any object)
    – Anonymous
    Jun 25 '17 at 5:11










  • @Anonymous you should post a new question about that.
    – Omnomnomnom
    Jun 25 '17 at 6:05










  • I think I got it, $A_i = r(theta_i, phi_i) ; B_i = r(theta_i, phi_i +Deltaphi) ; C_i = r(theta_i +Deltatheta, phi_i)$ where $vecr=(costhetasinphi,sinthetasinphi,cosphi)$ and then iterate $0 leq theta leq 2pi$ and $0leq phi leq pi$ as $theta_i = theta_i-1+Deltatheta$
    – Anonymous
    Jun 25 '17 at 6:21











  • so in general, parametrize the surface with 2 variables, and to triangular mesh vary each variable.
    – Anonymous
    Jun 25 '17 at 6:22















Let me know if I can explain anything above more thoroughly
– Omnomnomnom
Dec 9 '13 at 14:19




Let me know if I can explain anything above more thoroughly
– Omnomnomnom
Dec 9 '13 at 14:19












how would you create (approx) a sphere? considering that the minimum surface unit given is a triangle? in other words, how would you triangular mesh a sphere? (here the sphere is taken as an example for any object)
– Anonymous
Jun 25 '17 at 5:11




how would you create (approx) a sphere? considering that the minimum surface unit given is a triangle? in other words, how would you triangular mesh a sphere? (here the sphere is taken as an example for any object)
– Anonymous
Jun 25 '17 at 5:11












@Anonymous you should post a new question about that.
– Omnomnomnom
Jun 25 '17 at 6:05




@Anonymous you should post a new question about that.
– Omnomnomnom
Jun 25 '17 at 6:05












I think I got it, $A_i = r(theta_i, phi_i) ; B_i = r(theta_i, phi_i +Deltaphi) ; C_i = r(theta_i +Deltatheta, phi_i)$ where $vecr=(costhetasinphi,sinthetasinphi,cosphi)$ and then iterate $0 leq theta leq 2pi$ and $0leq phi leq pi$ as $theta_i = theta_i-1+Deltatheta$
– Anonymous
Jun 25 '17 at 6:21





I think I got it, $A_i = r(theta_i, phi_i) ; B_i = r(theta_i, phi_i +Deltaphi) ; C_i = r(theta_i +Deltatheta, phi_i)$ where $vecr=(costhetasinphi,sinthetasinphi,cosphi)$ and then iterate $0 leq theta leq 2pi$ and $0leq phi leq pi$ as $theta_i = theta_i-1+Deltatheta$
– Anonymous
Jun 25 '17 at 6:21













so in general, parametrize the surface with 2 variables, and to triangular mesh vary each variable.
– Anonymous
Jun 25 '17 at 6:22




so in general, parametrize the surface with 2 variables, and to triangular mesh vary each variable.
– Anonymous
Jun 25 '17 at 6:22

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f599803%2fcalculating-normals-for-a-polygon-mesh-3d-computer-graphics%23new-answer', 'question_page');

);

Post as a guest













































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

Mutual Information Always Non-negative

Why am i infinitely getting the same tweet with the Twitter Search API?