25
2012
Mesh Box Reference : Vertices / Triangles / UV / Normals
Mesh Box Reference Image
If you want to build a simple mesh box with scripts in Unity, this kind of image helped me to understand how it works..
Also have a look of the ChunkRender example,
how it builds the mesh by adding 4 vertices on each box face: ChunkRenderer
Main image ^
– Vertice locations / coordinates are shown: Vector3(x,y,z)
—
Part#2 : Lets build a simple mesh
What are we doing:
– Initialize vertex points array (it is a list of points in 3D space)
– Initialize triangle index array (this list tells Unity how to connect the points, to build a polygon face = triangle)
– Add 1st point to the vertex array (0,0,0)
– Add 2nd point to the vertex array (0,1,0)
– Add 3rd point to the vertex array (1,1,0)
– Now we have 3 points in 3D space..(but we cannot see anything, since we just have points..)
– Assign triangle list [0,1,2] (“connect the points”, we start from (0,0,0), then go to (0,1,0), then (1,1,0))
– Last step: Assign the points and triangle list to our Unity mesh (and then we have a visible mesh)
Download Source #1: (creating single triangle mesh with javascript)
MeshTutorial1.unityPackage
Image#2:
– In the image we have 3 points (vertices), marked with white “x”
– Dotted lines are showing how we connect the points (clockwise), to build a polygon face (triangle)
– See also: http://en.wikipedia.org/wiki/Polygon_mesh#Elements_of_mesh_modeling
Image#3
Our mesh box is actually build from bunch of triangles:
Related Posts
16 Comments + Add Comment
Leave a comment
Recent posts
- MotionVector Effect: Object “disappears” when paused
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
Recent Comments
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on
^ added (part of) part#2
Thank you very much, this helped a lot.
Good link,
Procedural generated mesh in unity (c#) and see the part 2 also)
http://blog.nobel-joergensen.com/2010/12/25/procedural-generated-mesh-in-unity/
Tangents calculator (need tangents if want to use bump maps)
http://answers.unity3d.com/questions/7789/calculating-tangents-vector4.html
Modelling by numbers : An introduction to procedural geometry
http://jayelinda.com/wp/modelling-by-numbers-part-1a/
mesh creation info:
http://forum.unity3d.com/threads/204921-Create-Mesh-at-runtime
Programmatically Generating Meshes In Unity3D:
http://kobolds-keep.net/?p=33
Thank you, before that I did not know anything about triangles.
Mesh tutorial:
http://games.deozaan.com/unity/MeshTutorial.pdf
Generating Mesh Geometry Procedurally (unity docs)
http://docs.unity3d.com/Manual/GeneratingMeshGeometryProcedurally.html
Normal mapping explained:
http://joeyspijkers.com/t_normalmapping.html *broken link
*archived page: http://web.archive.org/web/20160307112101/http://joeyspijkers.com/t_normalmapping.html
Mesh explained:
Unite 2015 – A coder’s guide to spline-based procedural geometry
https://youtu.be/o9RK6O2kOKo?t=4m13s
NetTopologySuite for Unity3d
http://forum.unity3d.com/threads/nettopologysuite-for-unity3d.370383/
Basic Procedural Mesh Tutorial Files
https://github.com/parahunter/mesh-presentation
Examples of how to draw a procedural triangle in Unity3D
https://github.com/cecarlsen/HowToDrawATriangle
subdivide
https://forum.unity.com/threads/basic-mesh-subdivision.1187134/#post-7597201