Initial commit
This commit is contained in:
1 parent
ee9615239e
commit
16feac691f
4093 files changed
+1030491
No files matched your search
@@ -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:
|
||||
Reference in new issue
Block a user