# Changing a simplex grid to an orthogonal grid.

Well I'm on my way in learning noise, a computer algorithm that's used to create real life structures and textures, etc. The noise I'm trying to learn is Simplex Noise, I already have it in the program but I have no idea how the math behind it works.

I know a simplex is the smallest possible thing to fill an n-dimendional space which has exactly n+1 corners. Imagine having a grid of 2D simplices (many equilateral triangles) next to each other. Obvioulsy this would make the grid quiet tilted to the side and not aligned correctly on the X and Y axis.

Here's a link to a pdf with a picture, it's on the 6th page.

I know I'm supposed to shear (skew) the whole grid by the diagonal but that's exactly what I don't understand. Any help will useful, since this can be used in any dimension and I have no idea how to do this now imagine when I climb up to 3, 4 or even the 5th dimension.

Note:

Also comment if you have an idea of what tags I should add/remove. Thanks!!!

An N-simplex is an N-dimensional triangle.

• a 0-simplex is a point
• a 1-simplex is a line segment
• a 2-simplex is a triangle
• a 3-simplex is a tetrahedron
• a 4-simplex is a 4D hyperpyramid
• $\cdots$

N-dimensional space can be tessellated with N-simplices, however the the simplices are slightly skewed in 3 or more dimensions.

You can use the simplex noise skewing function to skew from original grid space to simplicial grid space. The skewing factor for N-dimensional noise is as follows.

$$F = \frac {\sqrt{N+1} - 1} {N}$$

A point can be skewed as follows.

$$x' = x + (x + y + \cdots)F \\ y' = y + (x + y + \cdots)F \\ \vdots$$

This will take the N-simplex vertices on the original grid and skew them to whole number coordinates. Simplical subdivision is easy to perform in the simplicial grid space. Vertices with whole number components are also easily hashed to pseudorandom gradients.

Note that there is also a simplex noise unskewing function. The unskewing factor is as follows.

$$G = \frac {\frac {1} {\sqrt{N+1}} - 1} {N}$$

A point can be unskewed back to original grid space as follows.

$$x = x' + (x' + y' + \cdots)G \\ y = y' + (x' + y' + \cdots)G \\ \vdots$$

As written above, $G$ is a negative number. The Perlin and Gustavson implementations use $G'=-G$ and subtract the $(x + y + \cdots)G'$ term. The result is the same.

An unskewed displacement vector relative to each vertex is used in the kernel summation calculation.

Also see:

• Wikipedia - Simplex Noise
• Wikipedia - Simplex
• Wikipedia - Tetragonal disphenoid honeycomb