Phyllotaxis Spirals,`Sunflower Seed Spirals:
interesting comparison of 2 similar codes to make Phyllotaxis Spirals, both tests use 200 points. which is most regular?
if you want to use the 2nd code, it's not finished, it writes 2 superimposed sunflowers, the second winds back in;)
same with 400 dots:
TAGS: plot equally spaced dots points on a spiral
Nice Links with PHI related mathematitians that do amazing things:
http://linuxgazette.net/133/luana.html
this guys page.
http://richsunproductions.info/vsfx705/modelingsuite.html
HOLY COW!!!
nice maths pics of phi toruses
https://www.google.fr/search?q=phi+spiral+on+different+shapes&espv=210&es_sm=93&source=lnms&tbm=isch&sa=X&ei=WmbDUuvACKG47Aa4wIGoCg&ved=0CAkQ_AUoAQ&biw=855&bih=547&dpr=2#es_sm=93&espv=210&q=phi+spiral+on+torus&tbm=isch
code for making geodesic domes and mesh
http://www.opengl.org.ru/docs/pg/0208.html
GTS triangulated surface GNU library:
http://gts.sourceforge.net/
3D programming code for algorythms and otherwordly elemental 3d tedium and weirdy graphics
Tuesday, December 31, 2013
Thursday, March 7, 2013
Marching Cubes tricks-semi-advanced Info
Some speed optimisation and accuracy considerations for marching cubes:
it's amazing how brief and effective a simple implementation of marching cubes is. only about 100 lines apart from the tables, so easy to read! It just calculates an equation on points, checks the values between points, for all edges of a cube, and the data table returns what triangles that corresponds to. it's literally 2 or 3 loops and some lists of points and lines and a data table.
If you have a basic implementation of marching cubes, you will find that each triangle is separate from each other and has its own vertices, so any mesh with 10,000 triangles will represent 30,000 vertices. a slightly optimised code would produce about 11,000 vertices instead.
Another consideration is that the simple versions calculate 12 edges for each cube, and when you add all the cubes together, it's about 4 times more edges than you really need to process.
So- to divide that part of the code processing by a factor of 4, you should use only the 3 edges of the cube on the front lower left corner, March through all the cubes and store all their values in an array, and then you will have all the edges by doing only 3 edges instead of 12.
to read edges from the new array, every time you have the cube and need to send 12 of them to the triangles data table,you simply get the right array values for the cubes adjacent.
to calculate the points in the 1st place, from which the edge-ISOsurface intersection values are assessed, most marching cubes just walk through all the points and put them in an array.
Some marching cubes also do octree segmentation divisions of the space and only check the points and edges inside quadrants of the space which clearly contain the surface., and areas that are far from the ISO level are thrown out.
You can also just not bother to do any edges and cubes and marching, for any cubes of which 1 point is really far from the ISO value. get the 1st cube corner, check it's value, and leave it out if it's far away from the surface. you can even rewrite all the points , as they are calculated at 1st, that are far from the ISO, to a specific value so that all the cubes to be left out have that specific value on any of their points.
Here's a little trick about snapping very small triangles and throwing them out. At the linear interpolation stage of the edges, just make points are very close to cube corners equals to keep corners like as explained in the Snap MC implementation-this literally took 2 lines to change the triangles, and another 3 lines to omit triangles that are flattened.
Another consideration is
it's amazing how brief and effective a simple implementation of marching cubes is. only about 100 lines apart from the tables, so easy to read! It just calculates an equation on points, checks the values between points, for all edges of a cube, and the data table returns what triangles that corresponds to. it's literally 2 or 3 loops and some lists of points and lines and a data table.
If you have a basic implementation of marching cubes, you will find that each triangle is separate from each other and has its own vertices, so any mesh with 10,000 triangles will represent 30,000 vertices. a slightly optimised code would produce about 11,000 vertices instead.
Another consideration is that the simple versions calculate 12 edges for each cube, and when you add all the cubes together, it's about 4 times more edges than you really need to process.
So- to divide that part of the code processing by a factor of 4, you should use only the 3 edges of the cube on the front lower left corner, March through all the cubes and store all their values in an array, and then you will have all the edges by doing only 3 edges instead of 12.
to read edges from the new array, every time you have the cube and need to send 12 of them to the triangles data table,you simply get the right array values for the cubes adjacent.
to calculate the points in the 1st place, from which the edge-ISOsurface intersection values are assessed, most marching cubes just walk through all the points and put them in an array.
Some marching cubes also do octree segmentation divisions of the space and only check the points and edges inside quadrants of the space which clearly contain the surface., and areas that are far from the ISO level are thrown out.
You can also just not bother to do any edges and cubes and marching, for any cubes of which 1 point is really far from the ISO value. get the 1st cube corner, check it's value, and leave it out if it's far away from the surface. you can even rewrite all the points , as they are calculated at 1st, that are far from the ISO, to a specific value so that all the cubes to be left out have that specific value on any of their points.
Here's a little trick about snapping very small triangles and throwing them out. At the linear interpolation stage of the edges, just make points are very close to cube corners equals to keep corners like as explained in the Snap MC implementation-this literally took 2 lines to change the triangles, and another 3 lines to omit triangles that are flattened.
Tuesday, February 26, 2013
Mesh generators, videos, etc
Here's a page for different kinds of mesh generators similar to marching cubes.
here's an awesome video, original morphologies:
This one is pretty good it does some biped / quadruped meshes with bone structure stuff. if there was a neural net code for U3D they could make things that adapt to their environment.
speaking of neural net evolving artificial organisms, this is one of the cooler ones
some complete game systems of this kind will appear once all the tools are around to put them together fast. having studied animal biomechanics from centipedes to birds, its fair to say that nature doesnt waste time evolving entire patterns of movement from random jerks, it adds together toolsets of preprogrammed neural behaviour like sinusoidal leg movement that exist as dormant dna since the pre cambrian times of the trilobites etc. funny to think that your skull is an old fish head that has been extended for other purposes. oh dam... going on divergeant topic... back to mesh
mesh gen of liquid mechanics... amazing work
theres alot of info about delauney mesh gens but i thought that delauney mesh are abit chaotic, it seems wiser to find ways to make points and triangulate them by your own experiments than copy stuff like delauney algorythms.
here's an awesome video, original morphologies:
This one is pretty good it does some biped / quadruped meshes with bone structure stuff. if there was a neural net code for U3D they could make things that adapt to their environment.
speaking of neural net evolving artificial organisms, this is one of the cooler ones
some complete game systems of this kind will appear once all the tools are around to put them together fast. having studied animal biomechanics from centipedes to birds, its fair to say that nature doesnt waste time evolving entire patterns of movement from random jerks, it adds together toolsets of preprogrammed neural behaviour like sinusoidal leg movement that exist as dormant dna since the pre cambrian times of the trilobites etc. funny to think that your skull is an old fish head that has been extended for other purposes. oh dam... going on divergeant topic... back to mesh
mesh gen of liquid mechanics... amazing work
theres alot of info about delauney mesh gens but i thought that delauney mesh are abit chaotic, it seems wiser to find ways to make points and triangulate them by your own experiments than copy stuff like delauney algorythms.
Thursday, February 21, 2013
Trilateration of Normals for IsoSurface 3D meshes
Edit-
So I have managed a nice fast script that makes perfect normals, based on the shape formula rather than the mesh.
it can update a 6500 vertex mesh 58 times per second, pretty fast, if you need the code im around.
The rest of the posts just goes through the total puzzlement I went through to figure out the above solution, and in the end of the following solutions were kind of nonsense.
I figured that Trilateration , same as they use with GPS, would be good for surmising the exact normal position. apart from the fact we are missing the exact iso value that should exist at the normal point, as well as position. if you're really hard in maths, you can try that, it's a simple formula but it needs to be derived properly. Trying to think of triangles on and within spheres screws with your head!
Afterwards, I decided to draw 3 points very close to the vertex, measure the difference in between iso levels at the 3 points, and seeing as we can measure the precise iso level that exists at the vertex made by the marching cubes, we can prolong the 3 points as 2 segments in a straight line up to where they would meet the exact iso level of the vertex , and have the exact plane of the iso in close proximity to the vertex.
I coded it fine except it's buggy I don't know how to finish the code.
Here is a picture to show the general idea, it's basically sending out 3 points as feelers close to the vertex and prolonging the points relative to each other's value so that they equals the vertex value. that will give you 2 points coplanar to the vertex on the same iso that you make a normal from.
Its taking too long to program these things, forget both of those methods for now, I am going to do a simple solution, Which involves sampling 3 points on a small sphere surrounding vertex, taking the highest ISO value, then sampling 3 more points next to it , in a smaller radius, and then 3 more in a smaller radius, which should narrow it down to about 1/10000 in about 20 cycles, I will see if I can use a RotateAround method for it. After some thinking the best tools for that would be quaternion.aroundaxis (something) and vector3.slerp, in case one day you find yourself doing a spherical point scanner for something!
Here is a brief code for highlighting normals in unity, you have to switch to scene view to see them :
highlight normals:
#pragma strict
function Update () {
var mesh : Mesh = GetComponent(MeshFilter).mesh;
var vertices : Vector3[] = mesh.vertices;
var normals : Vector3[] = mesh.normals;
for (var i = 0 ; i < vertices.length; i++){
vertices[i] = transform.TransformPoint(vertices[i] );
Debug.DrawLine (vertices[i], vertices[i] + (normals[i] * 0.1), Color.red);
}
}
So I have managed a nice fast script that makes perfect normals, based on the shape formula rather than the mesh.
it can update a 6500 vertex mesh 58 times per second, pretty fast, if you need the code im around.
The rest of the posts just goes through the total puzzlement I went through to figure out the above solution, and in the end of the following solutions were kind of nonsense.
I figured that Trilateration , same as they use with GPS, would be good for surmising the exact normal position. apart from the fact we are missing the exact iso value that should exist at the normal point, as well as position. if you're really hard in maths, you can try that, it's a simple formula but it needs to be derived properly. Trying to think of triangles on and within spheres screws with your head!
Afterwards, I decided to draw 3 points very close to the vertex, measure the difference in between iso levels at the 3 points, and seeing as we can measure the precise iso level that exists at the vertex made by the marching cubes, we can prolong the 3 points as 2 segments in a straight line up to where they would meet the exact iso level of the vertex , and have the exact plane of the iso in close proximity to the vertex.
I coded it fine except it's buggy I don't know how to finish the code.
Here is a picture to show the general idea, it's basically sending out 3 points as feelers close to the vertex and prolonging the points relative to each other's value so that they equals the vertex value. that will give you 2 points coplanar to the vertex on the same iso that you make a normal from.
Its taking too long to program these things, forget both of those methods for now, I am going to do a simple solution, Which involves sampling 3 points on a small sphere surrounding vertex, taking the highest ISO value, then sampling 3 more points next to it , in a smaller radius, and then 3 more in a smaller radius, which should narrow it down to about 1/10000 in about 20 cycles, I will see if I can use a RotateAround method for it. After some thinking the best tools for that would be quaternion.aroundaxis (something) and vector3.slerp, in case one day you find yourself doing a spherical point scanner for something!
Here is a brief code for highlighting normals in unity, you have to switch to scene view to see them :
highlight normals:
#pragma strict
function Update () {
var mesh : Mesh = GetComponent(MeshFilter).mesh;
var vertices : Vector3[] = mesh.vertices;
var normals : Vector3[] = mesh.normals;
for (var i = 0 ; i < vertices.length; i++){
vertices[i] = transform.TransformPoint(vertices[i] );
Debug.DrawLine (vertices[i], vertices[i] + (normals[i] * 0.1), Color.red);
}
}
Monday, February 18, 2013
box projection of textures on procedural tunnels
So the last 3 days I did box projection texture mapping on some curvaceous abstract procedural shapes made with marching cubes.
Perlin noise tunnels with box projection UVs
at the start I had 3 lines of code that puts the 3 planes of the box X/Y/Z onto any rounded surface and that was easy, the tricky thing was finding how to calculate the joining triangles in between the planes
moral of the story is to definitely make pictures of the triangles that you are editing and not just launch off into some formula, and to have some good mesh troubleshooting tools so you can see within unity the triangles stats by clicking on each triangle.
Wiki says that there are algorithms for making cubic projection seamless but you will be hard pressed to find some papers and posts on that topic.
Buy the UV cubic remapping code for $5 if you want! it is in actionscript/JS and it is pretty straightforwards so you can adapt it to C etc. You will have to have some mesh to apply it to!
Subscribe to:
Posts (Atom)