I try to fill Mesh buffer with vertices, so when i try to create vertice it ask me for parameters:
position - it's clear...
normal - what is this? What is the geometric sense of this vector
(
for example I try to create pyramid mesh like this: http://en.wikipedia.org/wiki/Polygon_mesh
and what normal vector will be for Vertex1 from article? ... )
tcoord - the same question
Vertex3D: position; normal; tcoord
-
- Posts: 18
- Joined: Wed Feb 27, 2008 2:32 pm
- Location: Russia, Moscow
A normal vector is perpendicular to the polygon. So for example for floor polygons it will be upwards and for the ceiling it will be downwards. It's always useful to check the wikipedia (or google) if you are unsure about such stuff. See for example: http://en.wikipedia.org/wiki/Surface_normal
edit: Irrlicht supports you somewhat in calculating normals. As normals are perpendicular to a plane you have to calculate first a plane. You can use irr::core::plane3d by giving 3 vertices to setPlane. This will already calculate the normal for you (Normal is a public member of plane3d).
Texture coordinates are for mapping a texture on a polygon. So for each vertex of the polygon you need 2 coordinates which set the x/y position on the texture. The coordiantes are floats between 0 and 1, so left/top is (0,0 ) and right/bottom is (1,1).
edit: Irrlicht supports you somewhat in calculating normals. As normals are perpendicular to a plane you have to calculate first a plane. You can use irr::core::plane3d by giving 3 vertices to setPlane. This will already calculate the normal for you (Normal is a public member of plane3d).
Texture coordinates are for mapping a texture on a polygon. So for each vertex of the polygon you need 2 coordinates which set the x/y position on the texture. The coordiantes are floats between 0 and 1, so left/top is (0,0 ) and right/bottom is (1,1).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 18
- Joined: Wed Feb 27, 2008 2:32 pm
- Location: Russia, Moscow
Thanks... But some more questions:
It's clear for me what normal to surface is. But normal for vertice? ...
For example I try define pyramid ABCDE (ABCD - base).
What normal should be for Vertice E? ... Maybe there is some algoritm for definig vertices? Maybe somebody could give ready custom Mesh creation with comments?...
It's clear for me what normal to surface is. But normal for vertice? ...
For example I try define pyramid ABCDE (ABCD - base).
What normal should be for Vertice E? ... Maybe there is some algoritm for definig vertices? Maybe somebody could give ready custom Mesh creation with comments?...
I'm not sure if vertex-normals have a real fixed definition, don't nail me on that, but I think I've read that there are different algorithms to calculate those. In principle it's some average of the edges leading to the vertex.
I think Irrlicht can do those calculations for you. Try using recalculateNormals in the meshmanipulator.
Example 03 shows how to create a custom scenenode. Or you can also check the sources for the CCubeSceneNode.
I think Irrlicht can do those calculations for you. Try using recalculateNormals in the meshmanipulator.
Example 03 shows how to create a custom scenenode. Or you can also check the sources for the CCubeSceneNode.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Geometry is rendered by vertices (well by pixels but those are computed from vertices). Normal of vertex affects hove much light will be reflected by that vertex in to which direction so normals influence hove your model will be lit by light.
Your vertex E should (but don't have to) point up: vector(0,1,0). Its up to you to decide normal vector.
Also often vertices are shared by several polygoons, In which case you have no other possibility then made it average.
Your vertex E should (but don't have to) point up: vector(0,1,0). Its up to you to decide normal vector.
Not necessarily, if you want sharp edges of polygoons than yes, vertex normal should be perpendicular to the polygoon it belongs. If you however want your mesh to look smooth, normal should be the same for all vetrices which meet in one spot (like your E) even if they belongs to different polygoons. Normal of those vertices should be kind of average of what their normals would be if they were perpendicular to their polygoons.A normal vector is perpendicular to the polygon.
Also often vertices are shared by several polygoons, In which case you have no other possibility then made it average.