Initial commit
This commit is contained in:
1 parent
ee9615239e
commit
16feac691f
4093 files changed
+1030491
No files matched your search
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ba9f9ad1847f6a4493b13013b105aa9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,258 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_FbmBillow_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_FbmBillow_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/BillowImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef FBMFRACTALINPUT_DEF // [ FBMFRACTALINPUT_DEF
|
||||
#define FBMFRACTALINPUT_DEF
|
||||
|
||||
struct FbmFractalInput
|
||||
{
|
||||
float octaves;
|
||||
float amplitude;
|
||||
float persistence;
|
||||
float frequency;
|
||||
float lacunarity;
|
||||
float warpIterations;
|
||||
float warpStrength;
|
||||
float4 warpOffsets;
|
||||
};
|
||||
|
||||
|
||||
|
||||
FbmFractalInput GetDefaultFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = 8;
|
||||
ret.amplitude = 0.5;
|
||||
ret.persistence = 0.5;
|
||||
ret.frequency = 1;
|
||||
ret.lacunarity = 2;
|
||||
ret.warpIterations = 0;
|
||||
ret.warpStrength = 0.5;
|
||||
ret.warpOffsets = float4(2.5, 1.4, 3.2, 2.7);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float _FbmOctaves;
|
||||
float _FbmAmplitude;
|
||||
float _FbmPersistence;
|
||||
float _FbmFrequency;
|
||||
float _FbmLacunarity;
|
||||
float _FbmWarpIterations;
|
||||
float _FbmWarpStrength;
|
||||
float4 _FbmWarpOffsets;
|
||||
|
||||
FbmFractalInput GetFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = _FbmOctaves;
|
||||
ret.amplitude = _FbmAmplitude;
|
||||
ret.persistence = _FbmPersistence;
|
||||
ret.frequency = _FbmFrequency;
|
||||
ret.lacunarity = _FbmLacunarity;
|
||||
ret.warpIterations = _FbmWarpIterations;
|
||||
ret.warpStrength = _FbmWarpStrength;
|
||||
ret.warpOffsets = _FbmWarpOffsets;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // ] FBMFRACTALINPUT_DEF
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Fractal Functions
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmBillow_Raw( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Billow( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmBillow_Raw( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Billow( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmBillow_Raw( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Billow( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmBillow_Raw( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Billow( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
FbmBillow Noise Functions - Fractal, Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmBillow( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float q = noise_FbmBillow_Raw( pos + fractalInput.warpOffsets.x, fractalInput );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmBillow_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmBillow( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float2 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float2 q = float2( noise_FbmBillow_Raw( pos, fractalInput ),
|
||||
noise_FbmBillow_Raw( pos + fractalInput.warpOffsets.xy, fractalInput ) );
|
||||
prev = pos;
|
||||
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmBillow_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmBillow( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float3 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float3 q = float3( noise_FbmBillow_Raw( pos.xyz, fractalInput ),
|
||||
noise_FbmBillow_Raw( pos.xyz + fractalInput.warpOffsets.xyz, fractalInput ),
|
||||
noise_FbmBillow_Raw( pos.xyz + float3( fractalInput.warpOffsets.x, fractalInput.warpOffsets.y, 0 ), fractalInput ) );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmBillow_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmBillow( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float f = noise_FbmBillow_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_FbmBillow_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5652f5e4078b044db26f000fd5f64c7
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,258 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_FbmPerlin_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_FbmPerlin_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/PerlinImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef FBMFRACTALINPUT_DEF // [ FBMFRACTALINPUT_DEF
|
||||
#define FBMFRACTALINPUT_DEF
|
||||
|
||||
struct FbmFractalInput
|
||||
{
|
||||
float octaves;
|
||||
float amplitude;
|
||||
float persistence;
|
||||
float frequency;
|
||||
float lacunarity;
|
||||
float warpIterations;
|
||||
float warpStrength;
|
||||
float4 warpOffsets;
|
||||
};
|
||||
|
||||
|
||||
|
||||
FbmFractalInput GetDefaultFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = 8;
|
||||
ret.amplitude = 0.5;
|
||||
ret.persistence = 0.5;
|
||||
ret.frequency = 1;
|
||||
ret.lacunarity = 2;
|
||||
ret.warpIterations = 0;
|
||||
ret.warpStrength = 0.5;
|
||||
ret.warpOffsets = float4(2.5, 1.4, 3.2, 2.7);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float _FbmOctaves;
|
||||
float _FbmAmplitude;
|
||||
float _FbmPersistence;
|
||||
float _FbmFrequency;
|
||||
float _FbmLacunarity;
|
||||
float _FbmWarpIterations;
|
||||
float _FbmWarpStrength;
|
||||
float4 _FbmWarpOffsets;
|
||||
|
||||
FbmFractalInput GetFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = _FbmOctaves;
|
||||
ret.amplitude = _FbmAmplitude;
|
||||
ret.persistence = _FbmPersistence;
|
||||
ret.frequency = _FbmFrequency;
|
||||
ret.lacunarity = _FbmLacunarity;
|
||||
ret.warpIterations = _FbmWarpIterations;
|
||||
ret.warpStrength = _FbmWarpStrength;
|
||||
ret.warpOffsets = _FbmWarpOffsets;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // ] FBMFRACTALINPUT_DEF
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Fractal Functions
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmPerlin_Raw( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Perlin( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmPerlin_Raw( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Perlin( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmPerlin_Raw( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Perlin( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmPerlin_Raw( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Perlin( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
FbmPerlin Noise Functions - Fractal, Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmPerlin( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float q = noise_FbmPerlin_Raw( pos + fractalInput.warpOffsets.x, fractalInput );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmPerlin_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmPerlin( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float2 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float2 q = float2( noise_FbmPerlin_Raw( pos, fractalInput ),
|
||||
noise_FbmPerlin_Raw( pos + fractalInput.warpOffsets.xy, fractalInput ) );
|
||||
prev = pos;
|
||||
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmPerlin_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmPerlin( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float3 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float3 q = float3( noise_FbmPerlin_Raw( pos.xyz, fractalInput ),
|
||||
noise_FbmPerlin_Raw( pos.xyz + fractalInput.warpOffsets.xyz, fractalInput ),
|
||||
noise_FbmPerlin_Raw( pos.xyz + float3( fractalInput.warpOffsets.x, fractalInput.warpOffsets.y, 0 ), fractalInput ) );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmPerlin_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmPerlin( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float f = noise_FbmPerlin_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_FbmPerlin_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b5c87eb8da869547bb858d421761f48
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,258 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_FbmRidge_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_FbmRidge_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/RidgeImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef FBMFRACTALINPUT_DEF // [ FBMFRACTALINPUT_DEF
|
||||
#define FBMFRACTALINPUT_DEF
|
||||
|
||||
struct FbmFractalInput
|
||||
{
|
||||
float octaves;
|
||||
float amplitude;
|
||||
float persistence;
|
||||
float frequency;
|
||||
float lacunarity;
|
||||
float warpIterations;
|
||||
float warpStrength;
|
||||
float4 warpOffsets;
|
||||
};
|
||||
|
||||
|
||||
|
||||
FbmFractalInput GetDefaultFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = 8;
|
||||
ret.amplitude = 0.5;
|
||||
ret.persistence = 0.5;
|
||||
ret.frequency = 1;
|
||||
ret.lacunarity = 2;
|
||||
ret.warpIterations = 0;
|
||||
ret.warpStrength = 0.5;
|
||||
ret.warpOffsets = float4(2.5, 1.4, 3.2, 2.7);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float _FbmOctaves;
|
||||
float _FbmAmplitude;
|
||||
float _FbmPersistence;
|
||||
float _FbmFrequency;
|
||||
float _FbmLacunarity;
|
||||
float _FbmWarpIterations;
|
||||
float _FbmWarpStrength;
|
||||
float4 _FbmWarpOffsets;
|
||||
|
||||
FbmFractalInput GetFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = _FbmOctaves;
|
||||
ret.amplitude = _FbmAmplitude;
|
||||
ret.persistence = _FbmPersistence;
|
||||
ret.frequency = _FbmFrequency;
|
||||
ret.lacunarity = _FbmLacunarity;
|
||||
ret.warpIterations = _FbmWarpIterations;
|
||||
ret.warpStrength = _FbmWarpStrength;
|
||||
ret.warpOffsets = _FbmWarpOffsets;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // ] FBMFRACTALINPUT_DEF
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Fractal Functions
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmRidge_Raw( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Ridge( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmRidge_Raw( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Ridge( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmRidge_Raw( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Ridge( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmRidge_Raw( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Ridge( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
FbmRidge Noise Functions - Fractal, Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmRidge( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float q = noise_FbmRidge_Raw( pos + fractalInput.warpOffsets.x, fractalInput );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmRidge_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmRidge( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float2 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float2 q = float2( noise_FbmRidge_Raw( pos, fractalInput ),
|
||||
noise_FbmRidge_Raw( pos + fractalInput.warpOffsets.xy, fractalInput ) );
|
||||
prev = pos;
|
||||
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmRidge_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmRidge( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float3 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float3 q = float3( noise_FbmRidge_Raw( pos.xyz, fractalInput ),
|
||||
noise_FbmRidge_Raw( pos.xyz + fractalInput.warpOffsets.xyz, fractalInput ),
|
||||
noise_FbmRidge_Raw( pos.xyz + float3( fractalInput.warpOffsets.x, fractalInput.warpOffsets.y, 0 ), fractalInput ) );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmRidge_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmRidge( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float f = noise_FbmRidge_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_FbmRidge_INC
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f64dd7ba4f8b6634dab5bc2ef9f711c5
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,258 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_FbmValue_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_FbmValue_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/ValueImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef FBMFRACTALINPUT_DEF // [ FBMFRACTALINPUT_DEF
|
||||
#define FBMFRACTALINPUT_DEF
|
||||
|
||||
struct FbmFractalInput
|
||||
{
|
||||
float octaves;
|
||||
float amplitude;
|
||||
float persistence;
|
||||
float frequency;
|
||||
float lacunarity;
|
||||
float warpIterations;
|
||||
float warpStrength;
|
||||
float4 warpOffsets;
|
||||
};
|
||||
|
||||
|
||||
|
||||
FbmFractalInput GetDefaultFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = 8;
|
||||
ret.amplitude = 0.5;
|
||||
ret.persistence = 0.5;
|
||||
ret.frequency = 1;
|
||||
ret.lacunarity = 2;
|
||||
ret.warpIterations = 0;
|
||||
ret.warpStrength = 0.5;
|
||||
ret.warpOffsets = float4(2.5, 1.4, 3.2, 2.7);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float _FbmOctaves;
|
||||
float _FbmAmplitude;
|
||||
float _FbmPersistence;
|
||||
float _FbmFrequency;
|
||||
float _FbmLacunarity;
|
||||
float _FbmWarpIterations;
|
||||
float _FbmWarpStrength;
|
||||
float4 _FbmWarpOffsets;
|
||||
|
||||
FbmFractalInput GetFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = _FbmOctaves;
|
||||
ret.amplitude = _FbmAmplitude;
|
||||
ret.persistence = _FbmPersistence;
|
||||
ret.frequency = _FbmFrequency;
|
||||
ret.lacunarity = _FbmLacunarity;
|
||||
ret.warpIterations = _FbmWarpIterations;
|
||||
ret.warpStrength = _FbmWarpStrength;
|
||||
ret.warpOffsets = _FbmWarpOffsets;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // ] FBMFRACTALINPUT_DEF
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Fractal Functions
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmValue_Raw( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Value( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmValue_Raw( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Value( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmValue_Raw( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Value( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmValue_Raw( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Value( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
FbmValue Noise Functions - Fractal, Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmValue( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float q = noise_FbmValue_Raw( pos + fractalInput.warpOffsets.x, fractalInput );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmValue_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmValue( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float2 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float2 q = float2( noise_FbmValue_Raw( pos, fractalInput ),
|
||||
noise_FbmValue_Raw( pos + fractalInput.warpOffsets.xy, fractalInput ) );
|
||||
prev = pos;
|
||||
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmValue_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmValue( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float3 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float3 q = float3( noise_FbmValue_Raw( pos.xyz, fractalInput ),
|
||||
noise_FbmValue_Raw( pos.xyz + fractalInput.warpOffsets.xyz, fractalInput ),
|
||||
noise_FbmValue_Raw( pos.xyz + float3( fractalInput.warpOffsets.x, fractalInput.warpOffsets.y, 0 ), fractalInput ) );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmValue_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmValue( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float f = noise_FbmValue_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_FbmValue_INC
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fa4ec4b261611145bf2cdb9de4b0576
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,258 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_FbmVoronoi_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_FbmVoronoi_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/VoronoiImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef FBMFRACTALINPUT_DEF // [ FBMFRACTALINPUT_DEF
|
||||
#define FBMFRACTALINPUT_DEF
|
||||
|
||||
struct FbmFractalInput
|
||||
{
|
||||
float octaves;
|
||||
float amplitude;
|
||||
float persistence;
|
||||
float frequency;
|
||||
float lacunarity;
|
||||
float warpIterations;
|
||||
float warpStrength;
|
||||
float4 warpOffsets;
|
||||
};
|
||||
|
||||
|
||||
|
||||
FbmFractalInput GetDefaultFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = 8;
|
||||
ret.amplitude = 0.5;
|
||||
ret.persistence = 0.5;
|
||||
ret.frequency = 1;
|
||||
ret.lacunarity = 2;
|
||||
ret.warpIterations = 0;
|
||||
ret.warpStrength = 0.5;
|
||||
ret.warpOffsets = float4(2.5, 1.4, 3.2, 2.7);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float _FbmOctaves;
|
||||
float _FbmAmplitude;
|
||||
float _FbmPersistence;
|
||||
float _FbmFrequency;
|
||||
float _FbmLacunarity;
|
||||
float _FbmWarpIterations;
|
||||
float _FbmWarpStrength;
|
||||
float4 _FbmWarpOffsets;
|
||||
|
||||
FbmFractalInput GetFbmFractalInput()
|
||||
{
|
||||
FbmFractalInput ret;
|
||||
|
||||
ret.octaves = _FbmOctaves;
|
||||
ret.amplitude = _FbmAmplitude;
|
||||
ret.persistence = _FbmPersistence;
|
||||
ret.frequency = _FbmFrequency;
|
||||
ret.lacunarity = _FbmLacunarity;
|
||||
ret.warpIterations = _FbmWarpIterations;
|
||||
ret.warpStrength = _FbmWarpStrength;
|
||||
ret.warpOffsets = _FbmWarpOffsets;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // ] FBMFRACTALINPUT_DEF
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Fractal Functions
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmVoronoi_Raw( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Voronoi( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmVoronoi_Raw( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Voronoi( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmVoronoi_Raw( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Voronoi( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_FbmVoronoi_Raw( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_Voronoi( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
FbmVoronoi Noise Functions - Fractal, Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_FbmVoronoi( float pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float q = noise_FbmVoronoi_Raw( pos + fractalInput.warpOffsets.x, fractalInput );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmVoronoi_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmVoronoi( float2 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float2 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float2 q = float2( noise_FbmVoronoi_Raw( pos, fractalInput ),
|
||||
noise_FbmVoronoi_Raw( pos + fractalInput.warpOffsets.xy, fractalInput ) );
|
||||
prev = pos;
|
||||
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmVoronoi_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmVoronoi( float3 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float3 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float3 q = float3( noise_FbmVoronoi_Raw( pos.xyz, fractalInput ),
|
||||
noise_FbmVoronoi_Raw( pos.xyz + fractalInput.warpOffsets.xyz, fractalInput ),
|
||||
noise_FbmVoronoi_Raw( pos.xyz + float3( fractalInput.warpOffsets.x, fractalInput.warpOffsets.y, 0 ), fractalInput ) );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_FbmVoronoi_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_FbmVoronoi( float4 pos, FbmFractalInput fractalInput )
|
||||
{
|
||||
float f = noise_FbmVoronoi_Raw( pos, fractalInput );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_FbmVoronoi_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d296ae8f0ca6d84abc2e94d9a4e202f
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f82136e328a9944fb8a5abaec170332
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+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:
|
||||
@@ -0,0 +1,213 @@
|
||||
// #ifndef UNITY_TERRAIN_TOOL_NOISE_INC
|
||||
// #define UNITY_TERRAIN_TOOL_NOISE_INC
|
||||
|
||||
// /**************************************************************************
|
||||
|
||||
// Includes
|
||||
|
||||
// **************************************************************************/
|
||||
|
||||
// #include "NoiseCommon.hlsl"
|
||||
// #include "NoiseImpl.hlsl"
|
||||
|
||||
// /**************************************************************************
|
||||
|
||||
// Fractal Functions
|
||||
|
||||
// **************************************************************************/
|
||||
|
||||
// float fbm( float p, FractalParams f )
|
||||
// {
|
||||
// float n = 0;
|
||||
|
||||
// for( float i = 0; i < f.octaves; ++i )
|
||||
// {
|
||||
// n += f.amplitude * noise_impl( p * f.frequency );
|
||||
// f.frequency *= f.lacunarity;
|
||||
// f.amplitude *= f.persistence;
|
||||
// }
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// float fbm( float2 p, FractalParams f )
|
||||
// {
|
||||
// float n = 0;
|
||||
|
||||
// for( float i = 0; i < f.octaves; ++i )
|
||||
// {
|
||||
// n += f.amplitude * noise_impl( p * f.frequency );
|
||||
// f.frequency *= f.lacunarity;
|
||||
// f.amplitude *= f.persistence;
|
||||
// }
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// float fbm( float3 p, FractalParams f )
|
||||
// {
|
||||
// float n = 0;
|
||||
|
||||
// for( float i = 0; i < f.octaves; ++i )
|
||||
// {
|
||||
// n += f.amplitude * noise_impl( p * f.frequency );
|
||||
// f.frequency *= f.lacunarity;
|
||||
// f.amplitude *= f.persistence;
|
||||
// }
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// float fbm( float4 p, FractalParams f )
|
||||
// {
|
||||
// float n = 0;
|
||||
|
||||
// for( float i = 0; i < f.octaves; ++i )
|
||||
// {
|
||||
// n += f.amplitude * noise_impl( p * f.frequency );
|
||||
// f.frequency *= f.lacunarity;
|
||||
// f.amplitude *= f.persistence;
|
||||
// }
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// float fbm( float p )
|
||||
// {
|
||||
// return fbm( p, GetFractalParams() );
|
||||
// }
|
||||
|
||||
// float fbm( float2 p )
|
||||
// {
|
||||
// return fbm( p, GetFractalParams() );
|
||||
// }
|
||||
|
||||
// float fbm( float3 p )
|
||||
// {
|
||||
// return fbm( p, GetFractalParams() );
|
||||
// }
|
||||
|
||||
// float fbm( float4 p )
|
||||
// {
|
||||
// return fbm( p, GetFractalParams() );
|
||||
// }
|
||||
|
||||
// /**************************************************************************
|
||||
|
||||
// Noise Functions
|
||||
// - Call these from your shader
|
||||
|
||||
// **************************************************************************/
|
||||
|
||||
// /**************************************************************************
|
||||
// Noise Functions - Fractal, Non-Warped
|
||||
// **************************************************************************/
|
||||
|
||||
// float noise( float1 pos, FractalParams fractal )
|
||||
// {
|
||||
// return fbm( pos, fractal );
|
||||
// }
|
||||
|
||||
// float noise( float2 pos, FractalParams fractal )
|
||||
// {
|
||||
// return fbm( pos, fractal );
|
||||
// }
|
||||
|
||||
// float noise( float3 pos, FractalParams fractal )
|
||||
// {
|
||||
// return fbm( pos, fractal );
|
||||
// }
|
||||
|
||||
// float noise( float4 pos, FractalParams fractal )
|
||||
// {
|
||||
// return fbm( pos, fractal );
|
||||
// }
|
||||
|
||||
// /**************************************************************************
|
||||
// Noise Functions - Fractal, Warped
|
||||
// **************************************************************************/
|
||||
|
||||
// float noise( float pos, FractalParams fractal, WarpParams warp )
|
||||
// {
|
||||
// // do warping
|
||||
// for ( float i = 0; i < warp.iterations; ++i )
|
||||
// {
|
||||
// float q = fbm( pos + warp.offset.x );
|
||||
// pos = pos + warp.strength * q;
|
||||
// }
|
||||
|
||||
// float f = fbm( pos, fractal );
|
||||
|
||||
// return f;
|
||||
// }
|
||||
|
||||
// float noise( float2 pos, FractalParams fractal, WarpParams warp )
|
||||
// {
|
||||
// // do warping
|
||||
// for ( float i = 0; i < warp.iterations; ++i )
|
||||
// {
|
||||
// float2 q = float2( fbm( pos ), fbm( pos + warp.offset.xy ) );
|
||||
// pos = pos + warp.strength * q;
|
||||
// }
|
||||
|
||||
// float f = fbm( pos, fractal );
|
||||
|
||||
// return f;
|
||||
// }
|
||||
|
||||
// float noise( float3 pos, FractalParams fractal, WarpParams warp )
|
||||
// {
|
||||
// float q;
|
||||
// // do warping
|
||||
// for ( float i = 0; i < warp.iterations; ++i )
|
||||
// {
|
||||
// q = float3( fbm( pos.xyz ),
|
||||
// fbm( pos.xyz + warp.offset.xyz ),
|
||||
// fbm( pos.xyz + float3( warp.offset.x, warp.offset.y, 0 ) ) );
|
||||
// pos = pos + warp.strength * q;
|
||||
// }
|
||||
|
||||
// float f = fbm( pos, fractal );
|
||||
|
||||
// return f;
|
||||
// }
|
||||
|
||||
// float noise( float4 pos, FractalParams fractal, WarpParams warp )
|
||||
// {
|
||||
// // do warping
|
||||
// // for ( float i = 0; i < warp.iterations; ++i )
|
||||
// // {
|
||||
// // float4 q = float4( fbm( pos ), fbm( pos + warp.offset.xyzw ) );
|
||||
// // pos = pos + warp.strength * q;
|
||||
// // }
|
||||
|
||||
// float f = fbm( pos, fractal );
|
||||
|
||||
// return f;
|
||||
// }
|
||||
|
||||
// /**************************************************************************
|
||||
// Noise Functions - Non-Fractal, Non-Warped
|
||||
// **************************************************************************/
|
||||
|
||||
// float noise( float pos )
|
||||
// {
|
||||
// return noise_impl( pos );
|
||||
// }
|
||||
|
||||
// float noise( float2 pos )
|
||||
// {
|
||||
// return noise_impl( pos );
|
||||
// }
|
||||
|
||||
// float noise( float3 pos )
|
||||
// {
|
||||
// return noise_impl( pos );
|
||||
// }
|
||||
|
||||
// float noise( float4 pos )
|
||||
// {
|
||||
// return noise_impl( pos );
|
||||
// }
|
||||
|
||||
// #endif // UNITY_TERRAIN_TOOL_NOISE_INC
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cdbd56e6a76e764e83c7bc3683dd1cf
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,164 @@
|
||||
#ifndef NOISE_COMMON_INC
|
||||
#define NOISE_COMMON_INC
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Properties
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
// NOISE PROPERTIES
|
||||
|
||||
float3 _NoiseTranslation;
|
||||
float3 _NoiseRotation;
|
||||
float3 _NoiseScale;
|
||||
float4x4 _NoiseTransform;
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Util Functions
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
inline float when_eq( float x, float y )
|
||||
{
|
||||
return ( 1 - sign( abs( x - y ) ) );
|
||||
}
|
||||
|
||||
inline float4 remap( float4 n, float o, float p, float a, float b )
|
||||
{
|
||||
return a.xxxx + (b.xxxx - a.xxxx) * (n - o.xxxx) / (p.xxxx - o.xxxx);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Apply Noise Transform Functions
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
inline float4x4 TRS( float3 translation, float3 rotation, float3 scale )
|
||||
{
|
||||
float4x4 trs = (float4x4)0;
|
||||
|
||||
// TODO(wyatt): construct TRS matrix on the fly
|
||||
|
||||
return trs;
|
||||
}
|
||||
|
||||
inline float ApplyNoiseTransform( float p )
|
||||
{
|
||||
p *= _NoiseTransform._m00;
|
||||
p += _NoiseTransform._m30;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
inline float2 ApplyNoiseTransform( float2 p )
|
||||
{
|
||||
float3 pos = float3(p.x, 0, p.y);
|
||||
|
||||
p = mul(_NoiseTransform, float4(pos, 1)).xz;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
inline float3 ApplyNoiseTransform( float3 p )
|
||||
{
|
||||
p = mul(_NoiseTransform, float4(p.xyz, 1)).xyz;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Cubic Interpolation Functions
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
float2 cubic( float p )
|
||||
{
|
||||
return p * p * ( 3 - 2 * p * p );
|
||||
}
|
||||
|
||||
float2 cubic( float2 p )
|
||||
{
|
||||
return p * p * ( 3 - 2 * p * p );
|
||||
}
|
||||
|
||||
float3 cubic( float3 p )
|
||||
{
|
||||
return p * p * ( 3 - 2 * p * p );
|
||||
}
|
||||
|
||||
float3 cubic( float4 p )
|
||||
{
|
||||
return p * p * ( 3 - 2 * p * p );
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Quintic Interpolation Functions
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
float2 quintic( float1 p )
|
||||
{
|
||||
return p * p * p * ( p * (6 * p - 15) + 10 );
|
||||
}
|
||||
|
||||
float2 quintic( float2 p )
|
||||
{
|
||||
return p * p * p * ( p * (6 * p - 15) + 10 );
|
||||
}
|
||||
|
||||
float3 quintic( float3 p )
|
||||
{
|
||||
return p * p * p * ( p * (6 * p - 15) + 10 );
|
||||
}
|
||||
|
||||
float4 quintic( float4 p )
|
||||
{
|
||||
return p * p * p * ( p * (6 * p - 15) + 10 );
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Hashing Functions
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
float hash( float p )
|
||||
{
|
||||
float x = p * 98102.5453;
|
||||
|
||||
return -1 + 2 * frac( sin( x ) );
|
||||
}
|
||||
|
||||
float2 hash( float2 p )
|
||||
{
|
||||
float x = dot( p, float2( 165.244, 492.128 ) );
|
||||
float y = dot( p, float2( 382.763, 234.567 ) );
|
||||
|
||||
return -1 + 2 * frac( sin( float2( x, y ) ) * 98102.5453123 );
|
||||
}
|
||||
|
||||
float3 hash( float3 p )
|
||||
{
|
||||
p = float3( dot( p, float3( 1234.1, 442.66, 94.2 ) ), // x
|
||||
dot( p, float3( 92.12, 639.221, 1.234 ) ), // y
|
||||
dot( p, float3( 98.124, 103.83, 55.928 ) ) ); // z
|
||||
|
||||
return -1 + 2 * frac( sin( p ) * 98102.5453123 );
|
||||
}
|
||||
|
||||
float4 hash( float4 p )
|
||||
{
|
||||
p = float4( dot( p, float4( 1234.1, 442.66, 94.2, 56.98 ) ), // x
|
||||
dot( p, float4( 92.12, 639.221, 1.234, 89.025 ) ), // y
|
||||
dot( p, float4( 98.124, 773.83, 55.928, 4.99 ) ), // z
|
||||
dot( p, float4( 23.46, 105.1, 200.79, 73.5 ) ) ); // w
|
||||
|
||||
return -1 + 2 * frac( sin( p ) * 98102.5453123 );
|
||||
}
|
||||
|
||||
#endif
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2549a0c186073a4fa9e0ae0a28dda76
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef UNITY_NOISE_IMPL_INCLUDE // [ UNITY_NOISE_IMPL_INCLUDE
|
||||
#define UNITY_NOISE_IMPL_INCLUDE
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Specific noise implementations
|
||||
|
||||
- Include noise implementation files here.These should have guards that check if the
|
||||
keyword for that implementation is actually enabled.
|
||||
- Add your custom implementations here. These all declare a function "noise_impl"
|
||||
that gets fed into the noise function in Noise.hlsl.
|
||||
- To use a particular implementation, either add a shader keyword in the .shader
|
||||
or statically define a particular implementation after including Noise.hlsl
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
#include "Implementation/Ridge.hlsl"
|
||||
#include "Implementation/Voronoi.hlsl"
|
||||
#include "Implementation/Billow.hlsl"
|
||||
#include "Implementation/Perlin.hlsl"
|
||||
#include "Implementation/Value.hlsl"
|
||||
|
||||
#endif // ] UNITY_NOISE_IMPL_INCLUDE
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fd82854ec477e046977ebb462dce022
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
Shader "Hidden/TerrainTools/NoiseLib/DefaultPreview"
|
||||
{
|
||||
Properties { _MainTex ("Texture", any) = "" {} }
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always Cull OFF ZWrite Off
|
||||
|
||||
HLSLINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_TexelSize; // 1/width, 1/height, width, height
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert( appdata_t v )
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos( v.vertex );
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
Pass // 1
|
||||
{
|
||||
Name "Noise Preview"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
float4 frag( v2f i ) : SV_Target
|
||||
{
|
||||
float noiseVal = tex2D(_MainTex, i.uv);
|
||||
|
||||
// display negative areas as a separate color
|
||||
float4 negativeColor = float4( 0, abs( noiseVal.x ), abs( noiseVal.x ), 1 );
|
||||
float4 positiveColor = float4( noiseVal.xxx, 1 );
|
||||
float t = max( sign( noiseVal.x ), 0 );
|
||||
|
||||
return lerp( negativeColor, positiveColor, t );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0588b781cb7914649a214b84025ee94e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c59344a2f022d744b9e1a136bc14a99
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_NoneBillow_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_NoneBillow_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/BillowImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
NoneBillow Noise Functions - Non-Fractal, Non-Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_NoneBillow( float pos )
|
||||
{
|
||||
return get_noise_Billow( pos );
|
||||
}
|
||||
|
||||
float noise_NoneBillow( float2 pos )
|
||||
{
|
||||
return get_noise_Billow( pos );
|
||||
}
|
||||
|
||||
float noise_NoneBillow( float3 pos )
|
||||
{
|
||||
return get_noise_Billow( pos );
|
||||
}
|
||||
|
||||
float noise_NoneBillow( float4 pos )
|
||||
{
|
||||
return get_noise_Billow( pos );
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_NoneBillow_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 218f6547ceea47e499447da29e480342
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_NonePerlin_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_NonePerlin_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/PerlinImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
NonePerlin Noise Functions - Non-Fractal, Non-Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_NonePerlin( float pos )
|
||||
{
|
||||
return get_noise_Perlin( pos );
|
||||
}
|
||||
|
||||
float noise_NonePerlin( float2 pos )
|
||||
{
|
||||
return get_noise_Perlin( pos );
|
||||
}
|
||||
|
||||
float noise_NonePerlin( float3 pos )
|
||||
{
|
||||
return get_noise_Perlin( pos );
|
||||
}
|
||||
|
||||
float noise_NonePerlin( float4 pos )
|
||||
{
|
||||
return get_noise_Perlin( pos );
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_NonePerlin_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f78ae83a9d6a8c84c84743c813fae7b1
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_NoneRidge_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_NoneRidge_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/RidgeImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
NoneRidge Noise Functions - Non-Fractal, Non-Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_NoneRidge( float pos )
|
||||
{
|
||||
return get_noise_Ridge( pos );
|
||||
}
|
||||
|
||||
float noise_NoneRidge( float2 pos )
|
||||
{
|
||||
return get_noise_Ridge( pos );
|
||||
}
|
||||
|
||||
float noise_NoneRidge( float3 pos )
|
||||
{
|
||||
return get_noise_Ridge( pos );
|
||||
}
|
||||
|
||||
float noise_NoneRidge( float4 pos )
|
||||
{
|
||||
return get_noise_Ridge( pos );
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_NoneRidge_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1801622f96fd75d45a8308a87d43ead0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_NoneValue_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_NoneValue_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/ValueImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
NoneValue Noise Functions - Non-Fractal, Non-Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_NoneValue( float pos )
|
||||
{
|
||||
return get_noise_Value( pos );
|
||||
}
|
||||
|
||||
float noise_NoneValue( float2 pos )
|
||||
{
|
||||
return get_noise_Value( pos );
|
||||
}
|
||||
|
||||
float noise_NoneValue( float3 pos )
|
||||
{
|
||||
return get_noise_Value( pos );
|
||||
}
|
||||
|
||||
float noise_NoneValue( float4 pos )
|
||||
{
|
||||
return get_noise_Value( pos );
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_NoneValue_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca1cd8fb8b2dde242ad53fb6fee57538
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
// DO NOT EDIT THIS FILE!! THIS IS AUTOMATICALLY GENERATED!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_NoneVoronoi_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_NoneVoronoi_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "../Implementation/VoronoiImpl.hlsl"
|
||||
#include "../NoiseCommon.hlsl"
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
NoneVoronoi Noise Functions - Non-Fractal, Non-Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_NoneVoronoi( float pos )
|
||||
{
|
||||
return get_noise_Voronoi( pos );
|
||||
}
|
||||
|
||||
float noise_NoneVoronoi( float2 pos )
|
||||
{
|
||||
return get_noise_Voronoi( pos );
|
||||
}
|
||||
|
||||
float noise_NoneVoronoi( float3 pos )
|
||||
{
|
||||
return get_noise_Voronoi( pos );
|
||||
}
|
||||
|
||||
float noise_NoneVoronoi( float4 pos )
|
||||
{
|
||||
return get_noise_Voronoi( pos );
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_NoneVoronoi_INC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23eb8ff59be491548920f846156f66da
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,91 @@
|
||||
Shader "Hidden/TerrainTools/Noise/Preview"
|
||||
{
|
||||
Properties { _MainTex ("Texture", any) = "" {} }
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always Cull OFF ZWrite Off
|
||||
|
||||
HLSLINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_TexelSize; // 1/width, 1/height, width, height
|
||||
float _Layer;
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
inline float4 remap( float4 n, float o, float p, float a, float b )
|
||||
{
|
||||
return a.xxxx + (b.xxxx - a.xxxx) * (n - o.xxxx) / (p.xxxx - o.xxxx);
|
||||
}
|
||||
|
||||
v2f vert( appdata_t v )
|
||||
{
|
||||
v2f o;
|
||||
|
||||
o.vertex = UnityObjectToClipPos( v.vertex );
|
||||
o.uv = v.uv;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Noise Preview (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
float4 frag( v2f i ) : SV_Target
|
||||
{
|
||||
float r = tex2D(_MainTex, i.uv).r;
|
||||
|
||||
// r = remap( r.xxxx, 0, 1, -4, 5 );
|
||||
|
||||
float4 color = lerp( float4( 0, abs( r ), abs( r ), 1 ), float4( r.xxx, 1 ), max( sign( r ), 0 ) );
|
||||
|
||||
// color the out of range values
|
||||
color = lerp( color, float4( r - .9, 0, 0, 1 ), max( sign( r - 1 ), 0 ) ); // if over 1
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Noise Preview (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
float4 frag( v2f i ) : SV_Target
|
||||
{
|
||||
float r = tex2D(_MainTex, i.uv).r;
|
||||
|
||||
return lerp( float4( 0, abs( r ), abs( r ), 1 ), float4( r.xxx, 1 ), max( sign( r ), 0 ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ce320ed6c780f148ba0564386cbb70d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd1282737e7d3e74abcdffe94b89491a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
Shader ${ShaderCategory}
|
||||
{
|
||||
Properties { _MainTex ("Texture", any) = "" {} }
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always Cull OFF ZWrite Off
|
||||
|
||||
HLSLINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_TexelSize; // 1/width, 1/height, width, height
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert( appdata_t v )
|
||||
{
|
||||
v2f o;
|
||||
|
||||
o.vertex = UnityObjectToClipPos( v.vertex );
|
||||
o.uv = v.uv;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
BEGINPASSTEMPLATE
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "${NoiseName} Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// ${Includes}
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_${VariantName}( pos, ${GetInputs} );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // ${NoiseName} Noise
|
||||
{
|
||||
Name "${NoiseName} Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
${Includes}
|
||||
|
||||
float4 frag( v2f i ) : SV_Target
|
||||
{
|
||||
// calc pos for center of pixel
|
||||
float3 uv = float3( i.uv.x, 0, i.uv.y ) - float3( .5, 0, .5 );
|
||||
uv += + float3(.5, 0, .5) * _MainTex_TexelSize.xxy; // offset by half a texel so we are sampling noise for the center of the texel
|
||||
|
||||
float3 pos3D = ApplyNoiseTransform( uv.xyz );
|
||||
float2 pos2D = ApplyNoiseTransform( uv.xz );
|
||||
|
||||
float n = noise_${VariantName}( pos3D, ${GetInputs} );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "${NoiseName} Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
${Includes}
|
||||
|
||||
float _UVY;
|
||||
|
||||
float4 frag( v2f i ) : SV_Target
|
||||
{
|
||||
float3 pos = ApplyNoiseTransform( float3(i.uv.x, _UVY, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
float n = noise_${VariantName}( pos, ${GetInputs} );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
ENDPASSTEMPLATE
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8099751248575c489e0b5da5ac605ff
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 94e656d7d8c4ac74f943c9f10d62641e, type: 3}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
Shader ${ShaderCategory}
|
||||
{
|
||||
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", any) = "" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
HLSLINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainTool.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_TexelSize; // 1/width, 1/height, width, height
|
||||
|
||||
sampler2D _BrushTex;
|
||||
|
||||
float4 _BrushParams;
|
||||
#define BRUSH_STRENGTH (_BrushParams[0])
|
||||
#define BRUSH_TARGETHEIGHT (_BrushParams[1])
|
||||
#define BRUSH_PINCHAMOUNT (_BrushParams[2])
|
||||
#define BRUSH_ROTATION (_BrushParams[3])
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 pcUV : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 pcUV : TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert(appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.pcUV = v.pcUV;
|
||||
return o;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
BEGINPASSTEMPLATE
|
||||
|
||||
Pass // ${NoiseName} Noise Fill
|
||||
{
|
||||
Name "${NoiseName} Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
${Includes}
|
||||
|
||||
float4 _TerrainXform;
|
||||
float4 _TerrainScale;
|
||||
|
||||
float2 TransformPosition( float2 brushUV )
|
||||
{
|
||||
return _TerrainXform.xz + brushUV * _TerrainScale.xz;
|
||||
}
|
||||
|
||||
float4 frag(v2f i) : SV_Target
|
||||
{
|
||||
float h = UnpackHeightmap( tex2D( _MainTex, i.pcUV ) );
|
||||
|
||||
float2 pos = TransformPosition( i.pcUV );
|
||||
|
||||
float n = noise_${VariantName}( pos, ${GetDefaultInputs} );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
ENDPASSTEMPLATE
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dae4c679dc34e914f93c2ee9bcaa3d94
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 94e656d7d8c4ac74f943c9f10d62641e, type: 3}
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_${VariantName}_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_${VariantName}_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
${Includes}
|
||||
|
||||
${FractalDataDefinitions}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Fractal Functions
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_${VariantName}_Raw( float pos, ${FunctionParams} )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_${NoiseName}( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_${VariantName}_Raw( float2 pos, ${FunctionParams} )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_${NoiseName}( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_${VariantName}_Raw( float3 pos, ${FunctionParams} )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_${NoiseName}( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float noise_${VariantName}_Raw( float4 pos, ${FunctionParams} )
|
||||
{
|
||||
float prev = 0;
|
||||
float n = 0;
|
||||
|
||||
float octaves = ceil(fractalInput.octaves) + (1 - sign(frac(fractalInput.octaves)));
|
||||
|
||||
for( float i = 0; i < octaves; ++i )
|
||||
{
|
||||
prev = n;
|
||||
n += fractalInput.amplitude * get_noise_${NoiseName}( pos * fractalInput.frequency );
|
||||
fractalInput.frequency *= fractalInput.lacunarity;
|
||||
fractalInput.amplitude *= fractalInput.persistence;
|
||||
}
|
||||
|
||||
n = lerp(prev, n, frac(fractalInput.octaves));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
${VariantName} Noise Functions - Fractal, Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_${VariantName}( float pos, ${FunctionParams} )
|
||||
{
|
||||
float prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float q = noise_${VariantName}_Raw( pos + fractalInput.warpOffsets.x, ${FunctionInputs} );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_${VariantName}_Raw( pos, ${FunctionInputs} );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_${VariantName}( float2 pos, ${FunctionParams} )
|
||||
{
|
||||
float2 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float2 q = float2( noise_${VariantName}_Raw( pos, ${FunctionInputs} ),
|
||||
noise_${VariantName}_Raw( pos + fractalInput.warpOffsets.xy, ${FunctionInputs} ) );
|
||||
prev = pos;
|
||||
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_${VariantName}_Raw( pos, ${FunctionInputs} );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_${VariantName}( float3 pos, ${FunctionParams} )
|
||||
{
|
||||
float3 prev = 0;
|
||||
|
||||
float warpIterations = ceil(fractalInput.warpIterations) + (1 - sign(frac(fractalInput.warpIterations)));
|
||||
|
||||
// do warping
|
||||
for ( float i = 0; i < warpIterations; ++i )
|
||||
{
|
||||
float3 q = float3( noise_${VariantName}_Raw( pos.xyz, ${FunctionInputs} ),
|
||||
noise_${VariantName}_Raw( pos.xyz + fractalInput.warpOffsets.xyz, ${FunctionInputs} ),
|
||||
noise_${VariantName}_Raw( pos.xyz + float3( fractalInput.warpOffsets.x, fractalInput.warpOffsets.y, 0 ), ${FunctionInputs} ) );
|
||||
prev = pos;
|
||||
pos = pos + fractalInput.warpStrength * q;
|
||||
}
|
||||
|
||||
pos = lerp(prev, pos, frac(fractalInput.warpIterations));
|
||||
|
||||
float f = noise_${VariantName}_Raw( pos, ${FunctionInputs} );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_${VariantName}( float4 pos, ${FunctionParams} )
|
||||
{
|
||||
float f = noise_${VariantName}_Raw( pos, ${FunctionInputs} );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_${VariantName}_INC
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c40c320988718f4f8272b8fcaa1c505
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 94e656d7d8c4ac74f943c9f10d62641e, type: 3}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#ifndef UNITY_TERRAIN_TOOL_NOISE_${VariantName}_INC
|
||||
#define UNITY_TERRAIN_TOOL_NOISE_${VariantName}_INC
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
Includes
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
${Includes}
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
${VariantName} Noise Functions - Non-Fractal, Non-Warped
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
float noise_${VariantName}( float pos )
|
||||
{
|
||||
return get_noise_${NoiseName}( pos );
|
||||
}
|
||||
|
||||
float noise_${VariantName}( float2 pos )
|
||||
{
|
||||
return get_noise_${NoiseName}( pos );
|
||||
}
|
||||
|
||||
float noise_${VariantName}( float3 pos )
|
||||
{
|
||||
return get_noise_${NoiseName}( pos );
|
||||
}
|
||||
|
||||
float noise_${VariantName}( float4 pos )
|
||||
{
|
||||
return get_noise_${NoiseName}( pos );
|
||||
}
|
||||
|
||||
#endif // UNITY_TERRAIN_TOOL_NOISE_${VariantName}_INC
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c32eb128d786de429fcf9673dcc7221
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 94e656d7d8c4ac74f943c9f10d62641e, type: 3}
|
||||
Reference in new issue
Block a user