6
2012
Noob Triangulator (js)
Testing mesh (triangle) generation.. (screenshot: random mesh plane)
The REAL Triangulator is here: http://wiki.unity3d.com/index.php/Triangulator (it can handle complex shapes etc.)
My javascript triangulator works by adding 1 vertex in the middle, and every triangle will point to it.
I was thinking could use this for drawing outlines with mouse, then create mesh from the outline, noob-triangulate it.
Webplayer:
nothing much to see..
Download source:
FakeTriangulator2.unityPackage
—
Image#2: Two pass mesh with hole testing, using 3d triangulator, then modify mesh again – see comments section for the 3d tri. source (21.09.2014)
Related Posts
15 Comments + Add Comment
Leave a comment
Recent posts
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
- Check if point is inside polygon 2D (using line intersection)
- UnityHub: Enable Create Project Button (without having to select Cloud Organization)
- UI: Make Tooltip background fit Text content length
- Pong-Wars in Unity
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub)
- UnityHub: Add support for custom project title (instead of folder name) or use ProductName
- Testing Unity MUSE AI
Hi,
I find your idea very interesting and I was thinking of a similar idea, not with only one center point, but many interior points with a random number generator. Have you thought of the problems of a very concav hull?
I still haven’t got any result yet but I really look forward seeing your code (and sharing mine eventually, when it worths it).
Bye.
Yeah, this wont work with complex shapes..
What will you do with the random points? You need more mesh resolution or ..?
^ Source added.
(I think one version was also included with this http://unitycoder.com/blog/2012/02/15/raycast-realtime-visibility-2-0/ )
Well after I day of work I changed my mind. Random points seemed beautiful in mind, but in orther to avoid hard recalculation of the triangles set I decided make a loop over all triangles and adding a vertex in all if their centers. This way I make sure that the new vertex will be in the figure (because a triangle is a simple shape with its center in itself) and the new triangle set is as “easy” as changing every triangle for 3 new triangles, with 2 old points and 1 new point (the new vertex). If you want it, when it’s over I will share the code. I am already having some success 🙂
Yes would be nice to see it!
I was thinking, you could “scale” all the vertices,
to create inner vertices at good positions (half way from middle vertex and outer vertex)
Done. It’s cool how you can increase the number of triangles and eventually making the mesh look like a fractal…
But I don’t know where to post it and I don’t see your email anywhere.
Thanks! email here: http://unitycoder.com/blog/requests/
got it thanks! actually thats like tesselation maker 🙂
Delaunay Triangulator.cs
http://forum.unity3d.com/threads/208125-Delaunay-Triangulation-Problem
fast tessellator + triangulation:
https://github.com/speps/LibTessDotNet
triangulation stuff (with sources/links) :
http://forum.unity3d.com/threads/181596-Triangulation-of-spline-to-mesh-questions-and-results
3D Delaunay Triangulator (see last comment with source download)
http://answers.unity3d.com/questions/307544/mesh-from-vertices-polygon-from-spline.html
interesting triangulation demo (Sweep Line algorithm, with sources)
http://computacion.cs.cinvestav.mx/~anzures/geom/triangulation.php
about clipper & poly2tri:
http://www.gamedev.net/page/resources/_/technical/artificial-intelligence/generating-2d-navmeshes-r3393
Computational Geometry Lecture 16: Polygon triangulation
using poly2tri:
http://luminaryapps.com/blog/triangulating-3d-polygons-in-unity/