Initial commit
This commit is contained in:
1 parent
ee9615239e
commit
16feac691f
4093 files changed
+1030491
No files matched your search
+168
@@ -0,0 +1,168 @@
|
||||
#ifndef UNITY_NOISE_BILLOW_INC // [ UNITY_NOISE_BILLOW_INC
|
||||
#define UNITY_NOISE_BILLOW_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
BILLOW NOISE
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
1D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Billow( float p )
|
||||
{
|
||||
float i = floor( p );
|
||||
float f = frac( p );
|
||||
|
||||
float u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
a(0) b(1)
|
||||
_____________
|
||||
|
||||
x-axis
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float a = hash( i + 0.0 );
|
||||
float b = hash( i + 1.0 );
|
||||
|
||||
float ga = a * ( f - 0.0 );
|
||||
float gb = b * ( f - 1.0 );
|
||||
|
||||
float n = lerp( ga, gb, u );
|
||||
|
||||
return abs( n );
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
2D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Billow( float2 p )
|
||||
{
|
||||
float2 i = floor( p );
|
||||
float2 f = frac( p );
|
||||
|
||||
float2 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
c(0,1) d(1,1)
|
||||
_____________
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
|____________|
|
||||
|
||||
a(0,0) b(1,0)
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float2 a = hash( i + float2( 0.0, 0.0 ) );
|
||||
float2 b = hash( i + float2( 1.0, 0.0 ) );
|
||||
float2 c = hash( i + float2( 0.0, 1.0 ) );
|
||||
float2 d = hash( i + float2( 1.0, 1.0 ) );
|
||||
|
||||
float ga = dot( a, f - float2( 0.0, 0.0 ) );
|
||||
float gb = dot( b, f - float2( 1.0, 0.0 ) );
|
||||
float gc = dot( c, f - float2( 0.0, 1.0 ) );
|
||||
float gd = dot( d, f - float2( 1.0, 1.0 ) );
|
||||
|
||||
float n = lerp( lerp( ga, gb, u.x ), // lerp along bottom edge of cell
|
||||
lerp( gc, gd, u.x ), // lerp along top edge of cell
|
||||
u.y ); // lerp between top and bottom edges
|
||||
|
||||
return abs( n );
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
3D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Billow( float3 p )
|
||||
{
|
||||
float3 i = floor( p );
|
||||
float3 f = frac( p );
|
||||
|
||||
float3 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
c2(0,1,1) d2(1,1,1)
|
||||
______________
|
||||
/| /|
|
||||
c1(0,1,0) / |d1(1,1,0) / |
|
||||
/____|________/ |
|
||||
| | | |
|
||||
| |_ _ _ _|_ _ _|
|
||||
| / aa(0,0,1) / b2(1,0,1)
|
||||
| / | /
|
||||
|____________|/
|
||||
a1(0,0,0) b1(1,0,0)
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float3 a1 = hash( i + float3( 0.0, 0.0, 0.0 ) );
|
||||
float3 b1 = hash( i + float3( 1.0, 0.0, 0.0 ) );
|
||||
float3 c1 = hash( i + float3( 0.0, 1.0, 0.0 ) );
|
||||
float3 d1 = hash( i + float3( 1.0, 1.0, 0.0 ) );
|
||||
|
||||
float3 a2 = hash( i + float3( 0.0, 0.0, 1.0 ) );
|
||||
float3 b2 = hash( i + float3( 1.0, 0.0, 1.0 ) );
|
||||
float3 c2 = hash( i + float3( 0.0, 1.0, 1.0 ) );
|
||||
float3 d2 = hash( i + float3( 1.0, 1.0, 1.0 ) );
|
||||
|
||||
float ga1 = dot( a1, f - float3( 0.0, 0.0, 0.0 ) );
|
||||
float gb1 = dot( b1, f - float3( 1.0, 0.0, 0.0 ) );
|
||||
float gc1 = dot( c1, f - float3( 0.0, 1.0, 0.0 ) );
|
||||
float gd1 = dot( d1, f - float3( 1.0, 1.0, 0.0 ) );
|
||||
|
||||
float ga2 = dot( a2, f - float3( 0.0, 0.0, 1.0 ) );
|
||||
float gb2 = dot( b2, f - float3( 1.0, 0.0, 1.0 ) );
|
||||
float gc2 = dot( c2, f - float3( 0.0, 1.0, 1.0 ) );
|
||||
float gd2 = dot( d2, f - float3( 1.0, 1.0, 1.0 ) );
|
||||
|
||||
float t1 = lerp( lerp( ga1, gb1, u.x ),
|
||||
lerp( gc1, gd1, u.x ),
|
||||
u.y );
|
||||
|
||||
float t2 = lerp( lerp( ga2, gb2, u.x ),
|
||||
lerp( gc2, gd2, u.x ),
|
||||
u.y );
|
||||
|
||||
float n = lerp( t1, t2, u.z );
|
||||
|
||||
return abs( n );
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
4D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Billow( float4 p )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // ] UNITY_NOISE_BILLOW_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b859e27f3ab44704ba5b3ac2322f913a
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
#ifndef UNITY_NOISE_PERLIN_INC // [ UNITY_NOISE_PERLIN_INC
|
||||
#define UNITY_NOISE_PERLIN_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
PERLIN NOISE
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
1D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Perlin( float p )
|
||||
{
|
||||
float i = floor( p );
|
||||
float f = frac( p );
|
||||
|
||||
float u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
a(0) b(1)
|
||||
_____________
|
||||
|
||||
x-axis
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float a = hash( i + 0.0 );
|
||||
float b = hash( i + 1.0 );
|
||||
|
||||
float ga = a * ( f - 0.0 );
|
||||
float gb = b * ( f - 1.0 );
|
||||
|
||||
return remap( lerp( ga, gb, u ).xxxx, -1, 1, 0, 1).x;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
2D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Perlin( float2 p )
|
||||
{
|
||||
float2 i = floor( p );
|
||||
float2 f = frac( p );
|
||||
|
||||
float2 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
c(0,1) d(1,1)
|
||||
_____________
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
|____________|
|
||||
|
||||
a(0,0) b(1,0)
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float2 a = hash( i + float2( 0.0, 0.0 ) );
|
||||
float2 b = hash( i + float2( 1.0, 0.0 ) );
|
||||
float2 c = hash( i + float2( 0.0, 1.0 ) );
|
||||
float2 d = hash( i + float2( 1.0, 1.0 ) );
|
||||
|
||||
float ga = dot( a, f - float2( 0.0, 0.0 ) );
|
||||
float gb = dot( b, f - float2( 1.0, 0.0 ) );
|
||||
float gc = dot( c, f - float2( 0.0, 1.0 ) );
|
||||
float gd = dot( d, f - float2( 1.0, 1.0 ) );
|
||||
|
||||
return remap( lerp( lerp( ga, gb, u.x ), // lerp along bottom edge of cell
|
||||
lerp( gc, gd, u.x ), // lerp along top edge of cell
|
||||
u.y ).xxxx, // lerp between top and bottom edges
|
||||
-1, 1, 0, 1 ).x;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
3D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Perlin( float3 p )
|
||||
{
|
||||
float3 i = floor( p );
|
||||
float3 f = frac( p );
|
||||
|
||||
float3 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
c2(0,1,1) d2(1,1,1)
|
||||
______________
|
||||
/| /|
|
||||
c1(0,1,0) / |d1(1,1,0) / |
|
||||
/____|________/ |
|
||||
| | | |
|
||||
| |_ _ _ _|_ _ _|
|
||||
| / aa(0,0,1) / b2(1,0,1)
|
||||
| / | /
|
||||
|____________|/
|
||||
a1(0,0,0) b1(1,0,0)
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float3 a1 = hash( i + float3( 0.0, 0.0, 0.0 ) );
|
||||
float3 b1 = hash( i + float3( 1.0, 0.0, 0.0 ) );
|
||||
float3 c1 = hash( i + float3( 0.0, 1.0, 0.0 ) );
|
||||
float3 d1 = hash( i + float3( 1.0, 1.0, 0.0 ) );
|
||||
|
||||
float3 a2 = hash( i + float3( 0.0, 0.0, 1.0 ) );
|
||||
float3 b2 = hash( i + float3( 1.0, 0.0, 1.0 ) );
|
||||
float3 c2 = hash( i + float3( 0.0, 1.0, 1.0 ) );
|
||||
float3 d2 = hash( i + float3( 1.0, 1.0, 1.0 ) );
|
||||
|
||||
float ga1 = dot( a1, f - float3( 0.0, 0.0, 0.0 ) );
|
||||
float gb1 = dot( b1, f - float3( 1.0, 0.0, 0.0 ) );
|
||||
float gc1 = dot( c1, f - float3( 0.0, 1.0, 0.0 ) );
|
||||
float gd1 = dot( d1, f - float3( 1.0, 1.0, 0.0 ) );
|
||||
|
||||
float ga2 = dot( a2, f - float3( 0.0, 0.0, 1.0 ) );
|
||||
float gb2 = dot( b2, f - float3( 1.0, 0.0, 1.0 ) );
|
||||
float gc2 = dot( c2, f - float3( 0.0, 1.0, 1.0 ) );
|
||||
float gd2 = dot( d2, f - float3( 1.0, 1.0, 1.0 ) );
|
||||
|
||||
float t1 = lerp( lerp( ga1, gb1, u.x ),
|
||||
lerp( gc1, gd1, u.x ),
|
||||
u.y );
|
||||
|
||||
float t2 = lerp( lerp( ga2, gb2, u.x ),
|
||||
lerp( gc2, gd2, u.x ),
|
||||
u.y );
|
||||
|
||||
return remap( lerp( t1, t2, u.z ).xxxx, -1, 1, 0, 1 ).x;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
4D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Perlin( float4 p )
|
||||
{
|
||||
float4 i = floor( p );
|
||||
float4 f = frac( p );
|
||||
|
||||
float4 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
4D ASCII SHAPES TOO HARD TO MAKE!!!!!
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // ] UNITY_NOISE_PERLIN_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7fdc975188c9ee40b0410e49d501e80
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
#ifndef UNITY_NOISE_RIDGE_INC // [ UNITY_NOISE_RIDGE_INC
|
||||
#define UNITY_NOISE_RIDGE_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
RIDGE NOISE
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
1D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Ridge( float p )
|
||||
{
|
||||
float i = floor( p );
|
||||
float f = frac( p );
|
||||
|
||||
float u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
a(0) b(1)
|
||||
_____________
|
||||
|
||||
x-axis
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float a = hash( i + 0.0 );
|
||||
float b = hash( i + 1.0 );
|
||||
|
||||
float ga = a * ( f - 0.0 );
|
||||
float gb = b * ( f - 1.0 );
|
||||
|
||||
float ret = lerp( ga, gb, u );
|
||||
|
||||
return 1 - abs(ret);
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
2D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Ridge( float2 p )
|
||||
{
|
||||
float2 i = floor( p );
|
||||
float2 f = frac( p );
|
||||
|
||||
float2 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
c(0,1) d(1,1)
|
||||
_____________
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
|____________|
|
||||
|
||||
a(0,0) b(1,0)
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float2 a = hash( i + float2( 0.0, 0.0 ) );
|
||||
float2 b = hash( i + float2( 1.0, 0.0 ) );
|
||||
float2 c = hash( i + float2( 0.0, 1.0 ) );
|
||||
float2 d = hash( i + float2( 1.0, 1.0 ) );
|
||||
|
||||
float ga = dot( a, f - float2( 0.0, 0.0 ) );
|
||||
float gb = dot( b, f - float2( 1.0, 0.0 ) );
|
||||
float gc = dot( c, f - float2( 0.0, 1.0 ) );
|
||||
float gd = dot( d, f - float2( 1.0, 1.0 ) );
|
||||
|
||||
float ret = lerp( lerp( ga, gb, u.x ), // lerp along bottom edge of cell
|
||||
lerp( gc, gd, u.x ), // lerp along top edge of cell
|
||||
u.y ); // lerp between top and bottom edges
|
||||
|
||||
return 1 - abs( ret );
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
3D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Ridge( float3 p )
|
||||
{
|
||||
float3 i = floor( p );
|
||||
float3 f = frac( p );
|
||||
|
||||
float3 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
c2(0,1,1) d2(1,1,1)
|
||||
______________
|
||||
/| /|
|
||||
c1(0,1,0) / |d1(1,1,0) / |
|
||||
/____|________/ |
|
||||
| | | |
|
||||
| |_ _ _ _|_ _ _|
|
||||
| / aa(0,0,1) / b2(1,0,1)
|
||||
| / | /
|
||||
|____________|/
|
||||
a1(0,0,0) b1(1,0,0)
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float3 a1 = hash( i + float3( 0.0, 0.0, 0.0 ) );
|
||||
float3 b1 = hash( i + float3( 1.0, 0.0, 0.0 ) );
|
||||
float3 c1 = hash( i + float3( 0.0, 1.0, 0.0 ) );
|
||||
float3 d1 = hash( i + float3( 1.0, 1.0, 0.0 ) );
|
||||
|
||||
float3 a2 = hash( i + float3( 0.0, 0.0, 1.0 ) );
|
||||
float3 b2 = hash( i + float3( 1.0, 0.0, 1.0 ) );
|
||||
float3 c2 = hash( i + float3( 0.0, 1.0, 1.0 ) );
|
||||
float3 d2 = hash( i + float3( 1.0, 1.0, 1.0 ) );
|
||||
|
||||
float ga1 = dot( a1, f - float3( 0.0, 0.0, 0.0 ) );
|
||||
float gb1 = dot( b1, f - float3( 1.0, 0.0, 0.0 ) );
|
||||
float gc1 = dot( c1, f - float3( 0.0, 1.0, 0.0 ) );
|
||||
float gd1 = dot( d1, f - float3( 1.0, 1.0, 0.0 ) );
|
||||
|
||||
float ga2 = dot( a2, f - float3( 0.0, 0.0, 1.0 ) );
|
||||
float gb2 = dot( b2, f - float3( 1.0, 0.0, 1.0 ) );
|
||||
float gc2 = dot( c2, f - float3( 0.0, 1.0, 1.0 ) );
|
||||
float gd2 = dot( d2, f - float3( 1.0, 1.0, 1.0 ) );
|
||||
|
||||
float t1 = lerp( lerp( ga1, gb1, u.x ), // lerp along bottom edge of cell
|
||||
lerp( gc1, gd1, u.x ), // lerp along top edge of cell
|
||||
u.y ); // lerp between top and bottom edges
|
||||
|
||||
float t2 = lerp( lerp( ga2, gb2, u.x ), // lerp along bottom edge of cell
|
||||
lerp( gc2, gd2, u.x ), // lerp along top edge of cell
|
||||
u.y ); // lerp between top and bottom edges
|
||||
|
||||
float ret = lerp( t1, t2, u.z );
|
||||
|
||||
return 1 - abs( ret );
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
4D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Ridge( float4 p )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // ] UNITY_NOISE_RIDGE_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21f70d6d5e023f244aec28e8a7276fda
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
#ifndef UNITY_NOISE_VALUE_INC // [ UNITY_NOISE_VALUE_INC
|
||||
#define UNITY_NOISE_VALUE_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
VALUE NOISE
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
1D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Value( float p )
|
||||
{
|
||||
float i = floor( p );
|
||||
float f = frac( p );
|
||||
|
||||
float u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
a(0) b(1)
|
||||
_____________
|
||||
|
||||
x-axis
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float a = hash( i + 0.0 );
|
||||
float b = hash( i + 1.0 );
|
||||
|
||||
return lerp( a, b, u );
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
2D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Value( float2 p )
|
||||
{
|
||||
float2 i = floor( p );
|
||||
float2 f = frac( p );
|
||||
|
||||
float2 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
c(0,1) d(1,1)
|
||||
_____________
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
|____________|
|
||||
|
||||
a(0,0) b(1,0)
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float2 a = hash( i + float2( 0.0, 0.0 ) );
|
||||
float2 b = hash( i + float2( 1.0, 0.0 ) );
|
||||
float2 c = hash( i + float2( 0.0, 1.0 ) );
|
||||
float2 d = hash( i + float2( 1.0, 1.0 ) );
|
||||
|
||||
float t1 = lerp( a, b, u.x ); // lerp along bottom edge of cell
|
||||
float t2 = lerp( c, d, u.x ); // lerp along top edge of cell
|
||||
|
||||
return remap( lerp( t1, t2, u.y ).xxxx, -1, 1, 0, 1 ).x;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
3D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Value( float3 p )
|
||||
{
|
||||
float3 i = floor( p );
|
||||
float3 f = frac( p );
|
||||
|
||||
float3 u = quintic( f );
|
||||
|
||||
/*=====================================================================
|
||||
|
||||
c2(0,1,1) d2(1,1,1)
|
||||
______________
|
||||
/| /|
|
||||
c1(0,1,0) / |d1(1,1,0) / |
|
||||
/____|________/ |
|
||||
| | | |
|
||||
| |_ _ _ _|_ _ _|
|
||||
| / aa(0,0,1) / b2(1,0,1)
|
||||
| / | /
|
||||
|____________|/
|
||||
a1(0,0,0) b1(1,0,0)
|
||||
|
||||
=====================================================================*/
|
||||
|
||||
float3 a1 = hash( i + float3( 0.0, 0.0, 0.0 ) );
|
||||
float3 b1 = hash( i + float3( 1.0, 0.0, 0.0 ) );
|
||||
float3 c1 = hash( i + float3( 0.0, 1.0, 0.0 ) );
|
||||
float3 d1 = hash( i + float3( 1.0, 1.0, 0.0 ) );
|
||||
|
||||
float3 a2 = hash( i + float3( 0.0, 0.0, 1.0 ) );
|
||||
float3 b2 = hash( i + float3( 1.0, 0.0, 1.0 ) );
|
||||
float3 c2 = hash( i + float3( 0.0, 1.0, 1.0 ) );
|
||||
float3 d2 = hash( i + float3( 1.0, 1.0, 1.0 ) );
|
||||
|
||||
float t1 = lerp( lerp( a1, b1, u.x ), // lerp along bottom edge of cell
|
||||
lerp( c1, d1, u.x ), // lerp along top edge of cell
|
||||
u.y ); // lerp between top and bottom edges
|
||||
float t2 = lerp( lerp( a2, b2, u.x ), // lerp along bottom edge of cell
|
||||
lerp( c2, d2, u.x ), // lerp along top edge of cell
|
||||
u.y ); // lerp between top and bottom edges
|
||||
|
||||
return remap( lerp( t1, t2, u.z ).xxxx, -1, 1, 0, 1 ).x;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
4D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Value( float4 p )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // ] UNITY_NOISE_VALUE_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b0b821fd9ba3624abfd243e8114f6d2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
#ifndef UNITY_NOISE_VORONOI_INC // [ UNITY_NOISE_VORONOI_INC
|
||||
#define UNITY_NOISE_VORONOI_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
VORONOI NOISE
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
1D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Voronoi( float p )
|
||||
{
|
||||
float i = floor( p );
|
||||
float f = frac( p );
|
||||
|
||||
// get random positions within neighboring cells + offsets
|
||||
|
||||
float n = 1;
|
||||
|
||||
for ( float x = -2; x <= 2; ++x )
|
||||
{
|
||||
float2 r = hash( i + x );
|
||||
r = r + x - f;
|
||||
float t = r * r; // iq version, cheaper than length
|
||||
|
||||
n = min( n, t );
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
2D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Voronoi( float2 p )
|
||||
{
|
||||
float2 i = floor( p );
|
||||
float2 f = frac( p );
|
||||
|
||||
// get random positions within neighboring cells + offsets
|
||||
|
||||
float n = 1;
|
||||
|
||||
for ( float x = -2; x <= 2; ++x )
|
||||
{
|
||||
for ( float y = -2; y <= 2; ++y )
|
||||
{
|
||||
float2 offset = float2( x, y );
|
||||
|
||||
float2 r = hash( i + offset );
|
||||
r = r + offset - f;
|
||||
float t = dot( r, r ); // iq version, cheaper than length
|
||||
|
||||
n = min( n, t );
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
3D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Voronoi( float3 p )
|
||||
{
|
||||
float3 i = floor( p );
|
||||
float3 f = frac( p );
|
||||
|
||||
// get random positions within neighboring cells + offsets
|
||||
|
||||
float n = 1;
|
||||
|
||||
for ( float x = -2; x <= 2; x++ )
|
||||
{
|
||||
for ( float y = -2; y <= 2; y++ )
|
||||
{
|
||||
for ( float z = -2; z <= 2; z++ )
|
||||
{
|
||||
float3 offset = float3( x, y, z );
|
||||
float3 r = hash( i + offset ) + offset - f;
|
||||
float t = dot( r, r ); // iq version, cheaper than length
|
||||
|
||||
n = min( n, t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
4D Noise
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float get_noise_Voronoi( float4 p )
|
||||
{
|
||||
float4 i = floor( p );
|
||||
float4 f = frac( p );
|
||||
|
||||
// get random positions within neighboring cells + offsets
|
||||
|
||||
float n = 1;
|
||||
|
||||
for ( float x = -2; x <= 2; ++x )
|
||||
{
|
||||
for ( float y = -2; y <= 2; ++y )
|
||||
{
|
||||
for ( float z = -2; z <= 2; ++z )
|
||||
{
|
||||
for ( float w = -2; w <= 2; ++w )
|
||||
{
|
||||
float4 offset = float4( x, y, z, w );
|
||||
|
||||
float4 r = hash( i + offset );
|
||||
r = r + offset - f;
|
||||
float t = dot( r, r ); // iq version, cheaper than length
|
||||
|
||||
n = min( n, t );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
#endif // ] UNITY_NOISE_VORONOI_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e1e501ba4328ad4ea98443de94008b6
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user