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: 47429b00bc295d743bf9619eee804e9a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+445
@@ -0,0 +1,445 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Shader "Hidden/TerrainTools/Noise/NoiseBlit/NoiseBlitFbm"
|
||||
{
|
||||
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
|
||||
// {
|
||||
// Name "Billow Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib/Fbm/Billow.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_FbmBillow( pos, GetFbmFractalInput() );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Billow Noise
|
||||
{
|
||||
Name "Billow Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/Fbm/Billow.hlsl"
|
||||
|
||||
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_FbmBillow( pos3D, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Billow Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/Fbm/Billow.hlsl"
|
||||
|
||||
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_FbmBillow( pos, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "Perlin Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib//Fbm/Perlin.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_FbmPerlin( pos, GetFbmFractalInput() );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Perlin Noise
|
||||
{
|
||||
Name "Perlin Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//Fbm/Perlin.hlsl"
|
||||
|
||||
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_FbmPerlin( pos3D, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Perlin Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//Fbm/Perlin.hlsl"
|
||||
|
||||
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_FbmPerlin( pos, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "Ridge Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib//Fbm/Ridge.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_FbmRidge( pos, GetFbmFractalInput() );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Ridge Noise
|
||||
{
|
||||
Name "Ridge Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//Fbm/Ridge.hlsl"
|
||||
|
||||
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_FbmRidge( pos3D, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Ridge Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//Fbm/Ridge.hlsl"
|
||||
|
||||
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_FbmRidge( pos, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "Value Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib//Fbm/Value.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_FbmValue( pos, GetFbmFractalInput() );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Value Noise
|
||||
{
|
||||
Name "Value Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//Fbm/Value.hlsl"
|
||||
|
||||
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_FbmValue( pos3D, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Value Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//Fbm/Value.hlsl"
|
||||
|
||||
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_FbmValue( pos, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "Voronoi Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib//Fbm/Voronoi.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_FbmVoronoi( pos, GetFbmFractalInput() );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Voronoi Noise
|
||||
{
|
||||
Name "Voronoi Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//Fbm/Voronoi.hlsl"
|
||||
|
||||
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_FbmVoronoi( pos3D, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Voronoi Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//Fbm/Voronoi.hlsl"
|
||||
|
||||
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_FbmVoronoi( pos, GetFbmFractalInput() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcba582a5cbb6d44e9a1767b15cc2a11
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+445
@@ -0,0 +1,445 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Shader "Hidden/TerrainTools/Noise/NoiseBlit/NoiseBlitNone"
|
||||
{
|
||||
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
|
||||
// {
|
||||
// Name "Billow Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib/None/Billow.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_NoneBillow( pos );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Billow Noise
|
||||
{
|
||||
Name "Billow Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/None/Billow.hlsl"
|
||||
|
||||
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_NoneBillow( pos3D );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Billow Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/None/Billow.hlsl"
|
||||
|
||||
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_NoneBillow( pos );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "Perlin Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib//None/Perlin.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_NonePerlin( pos );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Perlin Noise
|
||||
{
|
||||
Name "Perlin Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//None/Perlin.hlsl"
|
||||
|
||||
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_NonePerlin( pos3D );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Perlin Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//None/Perlin.hlsl"
|
||||
|
||||
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_NonePerlin( pos );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "Ridge Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib//None/Ridge.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_NoneRidge( pos );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Ridge Noise
|
||||
{
|
||||
Name "Ridge Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//None/Ridge.hlsl"
|
||||
|
||||
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_NoneRidge( pos3D );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Ridge Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//None/Ridge.hlsl"
|
||||
|
||||
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_NoneRidge( pos );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "Value Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib//None/Value.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_NoneValue( pos );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Value Noise
|
||||
{
|
||||
Name "Value Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//None/Value.hlsl"
|
||||
|
||||
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_NoneValue( pos3D );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Value Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//None/Value.hlsl"
|
||||
|
||||
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_NoneValue( pos );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Pass
|
||||
// {
|
||||
// Name "Voronoi Raw Noise Blit (2D)"
|
||||
|
||||
// HLSLPROGRAM
|
||||
|
||||
// #pragma vertex vert
|
||||
// #pragma fragment frag
|
||||
|
||||
// #include "../NoiseLib//None/Voronoi.hlsl"
|
||||
|
||||
// float4 frag( v2f i ) : SV_Target
|
||||
// {
|
||||
// float3 pos = ApplyNoiseTransform( float3(i.uv.x, 0, i.uv.y) - float3(.5, 0, .5) );
|
||||
|
||||
// float n = noise_NoneVoronoi( pos );
|
||||
|
||||
// return n;
|
||||
// }
|
||||
|
||||
// ENDHLSL
|
||||
// }
|
||||
|
||||
Pass // Voronoi Noise
|
||||
{
|
||||
Name "Voronoi Raw Noise Blit (2D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//None/Voronoi.hlsl"
|
||||
|
||||
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_NoneVoronoi( pos3D );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Voronoi Raw Noise Blit (3D)"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib//None/Voronoi.hlsl"
|
||||
|
||||
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_NoneVoronoi( pos );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 498bbb268f2692e44a63d62b04adcfc6
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Shader "Hidden/TerrainTools/NoiseFill/NoiseFillFbm"
|
||||
{
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
Pass // Billow Noise Fill
|
||||
{
|
||||
Name "Billow Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/Fbm/Billow.hlsl"
|
||||
|
||||
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_FbmBillow( pos, GetDefaultFbmFractalInput() );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Pass // Perlin Noise Fill
|
||||
{
|
||||
Name "Perlin Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/Fbm/Perlin.hlsl"
|
||||
|
||||
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_FbmPerlin( pos, GetDefaultFbmFractalInput() );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Pass // Ridge Noise Fill
|
||||
{
|
||||
Name "Ridge Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/Fbm/Ridge.hlsl"
|
||||
|
||||
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_FbmRidge( pos, GetDefaultFbmFractalInput() );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Pass // Value Noise Fill
|
||||
{
|
||||
Name "Value Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/Fbm/Value.hlsl"
|
||||
|
||||
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_FbmValue( pos, GetDefaultFbmFractalInput() );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Pass // Voronoi Noise Fill
|
||||
{
|
||||
Name "Voronoi Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/Fbm/Voronoi.hlsl"
|
||||
|
||||
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_FbmVoronoi( pos, GetDefaultFbmFractalInput() );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 439cd1fac919f5a4db56d7e0de2cf8c6
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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!!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Shader "Hidden/TerrainTools/NoiseFill/NoiseFillNone"
|
||||
{
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
Pass // Billow Noise Fill
|
||||
{
|
||||
Name "Billow Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/None/Billow.hlsl"
|
||||
|
||||
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_NoneBillow( pos );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Pass // Perlin Noise Fill
|
||||
{
|
||||
Name "Perlin Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/None/Perlin.hlsl"
|
||||
|
||||
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_NonePerlin( pos );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Pass // Ridge Noise Fill
|
||||
{
|
||||
Name "Ridge Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/None/Ridge.hlsl"
|
||||
|
||||
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_NoneRidge( pos );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Pass // Value Noise Fill
|
||||
{
|
||||
Name "Value Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/None/Value.hlsl"
|
||||
|
||||
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_NoneValue( pos );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Pass // Voronoi Noise Fill
|
||||
{
|
||||
Name "Voronoi Noise Fill"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../NoiseLib/None/Voronoi.hlsl"
|
||||
|
||||
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_NoneVoronoi( pos );
|
||||
|
||||
return PackHeightmap( n );
|
||||
// return PackHeightmap( lerp( h + n, n, OVERWRITE_HEIGHT ) );
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2a23b074bc886648a89cf4a47892971
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea0c5cbb02a4cd944ae5d5042e4ec7b7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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}
|
||||
@@ -0,0 +1,90 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
Shader "Hidden/GaiaPro/PowerOf" {
|
||||
|
||||
Properties {
|
||||
//The input texture
|
||||
_InputTex ("Input Texture", any) = "" {}
|
||||
//The image mask texture
|
||||
_BrushTex ("Brush Texture", any) = "" {}
|
||||
//Flag to determine whether the Mask is inverted or not
|
||||
_Invert("Invert Distance Mask", Int) = 0
|
||||
//Power function to be applied
|
||||
_Power("Strength", Float) = 1
|
||||
//Strength from 0 to 1 to determine how "strong" the image mask effect is applied
|
||||
_Strength ("Strength", Float) = 0
|
||||
|
||||
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainTool.cginc"
|
||||
|
||||
sampler2D _InputTex;
|
||||
sampler2D _BrushTex;
|
||||
int _Invert;
|
||||
float _Power;
|
||||
float _Strength;
|
||||
|
||||
float4 _MainTex_TexelSize; // 1/width, 1/height, width, height
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
|
||||
Pass // 0 Power Of
|
||||
{
|
||||
Name "Power Of"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment FilterPowerOf
|
||||
|
||||
float4 FilterPowerOf(v2f i) : SV_Target
|
||||
{
|
||||
float height = UnpackHeightmap(tex2D(_InputTex, i.pcUV));
|
||||
float powerOfHeight = pow(height,4.0f-_Power);
|
||||
// out of bounds multiplier
|
||||
float2 brushUV = PaintContextUVToBrushUV(i.pcUV);
|
||||
float2 heightmapUV = PaintContextUVToHeightmapUV(i.pcUV);
|
||||
float oob = all(saturate(brushUV) == brushUV) ? 1.0f : 0.0f;
|
||||
float brushStrength = oob * UnpackHeightmap(tex2D(_BrushTex, brushUV));
|
||||
//noise = ((noise - 0.5f) * _ContrastFilter) + 0.5f;
|
||||
//if (_Invert > 0)
|
||||
//{
|
||||
// powerOfHeight = (1.0f - powerOfHeight);
|
||||
//}
|
||||
//return PackHeightmap(height + height * (powerOfHeight-height));
|
||||
return PackHeightmap(lerp(height, powerOfHeight, brushStrength));
|
||||
//return PackHeightmap(lerp(height,(height * powerOfHeight),_Strength));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f01f7a3ba7f3c0e4c815e49919c0c43b
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,209 @@
|
||||
Shader "Hidden/Gaia/SmoothHeight" {
|
||||
|
||||
Properties { _MainTex ("Texture", any) = "" {}
|
||||
//1-pixel height transform texture representing an animation curve
|
||||
_HeightTransformTex ("Height Transform Texture", any) = "" {}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGINCLUDE
|
||||
#include "UnityCG.cginc"
|
||||
#include "TerrainTool.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
sampler2D _HeightTransformTex;
|
||||
float4 _MainTex_TexelSize; // 1/width, 1/height, width, height
|
||||
|
||||
sampler2D _BrushTex;
|
||||
sampler2D _FilterTex;
|
||||
|
||||
float4 _BrushParams;
|
||||
#define BRUSH_STRENGTH (_BrushParams[0])
|
||||
#define BRUSH_TARGETHEIGHT (_BrushParams[1])
|
||||
|
||||
float4 _SmoothWeights; // centered, min, max, unused
|
||||
|
||||
static int KernelWeightCount = 7;
|
||||
static float KernelWeights[7] = { 0.95f, 0.85f, 0.7f, 0.4f, 0.2f, 0.15f, 0.05f };
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Smooth Horizontal"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment SmoothHorizontal
|
||||
|
||||
float4 SmoothHorizontal(v2f i) : SV_Target
|
||||
{
|
||||
float2 brushUV = PaintContextUVToBrushUV(i.pcUV);
|
||||
float2 heightmapUV = PaintContextUVToHeightmapUV(i.pcUV);
|
||||
|
||||
// out of bounds multiplier
|
||||
float oob = all(saturate(brushUV) == brushUV) ? 1.0f : 0.0f;
|
||||
|
||||
float height = UnpackHeightmap(tex2D(_MainTex, heightmapUV));
|
||||
float brushStrength = BRUSH_STRENGTH * oob * UnpackHeightmap(tex2D(_BrushTex, brushUV));// *UnpackHeightmap(tex2D(_FilterTex, i.pcUV));
|
||||
|
||||
|
||||
float divisor = 1.0f;
|
||||
float offset = 0.0f;
|
||||
float h = height;
|
||||
|
||||
for (int i = 0; i < KernelWeightCount; i++) {
|
||||
offset += _MainTex_TexelSize.x * _SmoothWeights.w;
|
||||
divisor += 2.0f * KernelWeights[i];
|
||||
|
||||
float2 rightUV = heightmapUV + float2(offset, 0.0f);
|
||||
float2 leftUV = heightmapUV - float2(offset, 0.0f);
|
||||
|
||||
h += KernelWeights[i] * UnpackHeightmap(tex2D(_MainTex, rightUV));
|
||||
h += KernelWeights[i] * UnpackHeightmap(tex2D(_MainTex, leftUV));
|
||||
}
|
||||
|
||||
h /= divisor;
|
||||
|
||||
float3 new_height = float3(h, min(h, height), max(h, height));
|
||||
h = dot(new_height, _SmoothWeights.xyz);
|
||||
float transformedStrength = tex2D(_HeightTransformTex, h);
|
||||
return lerp(height, h, brushStrength);
|
||||
//return PackHeightmap(lerp(height,new_height,transformedStrength));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Smooth Vertical"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment SmoothVertical
|
||||
|
||||
float4 SmoothVertical(v2f i) : SV_Target
|
||||
{
|
||||
float2 brushUV = PaintContextUVToBrushUV(i.pcUV);
|
||||
float2 heightmapUV = PaintContextUVToHeightmapUV(i.pcUV);
|
||||
|
||||
// out of bounds multiplier
|
||||
float oob = all(saturate(brushUV) == brushUV) ? 1.0f : 0.0f;
|
||||
|
||||
float height = UnpackHeightmap(tex2D(_MainTex, heightmapUV));
|
||||
float brushStrength = BRUSH_STRENGTH * oob * UnpackHeightmap(tex2D(_BrushTex, brushUV));// *UnpackHeightmap(tex2D(_FilterTex, i.pcUV));
|
||||
|
||||
float divisor = 1.0f;
|
||||
float offset = 0.0f;
|
||||
float h = height;
|
||||
|
||||
for (int i = 0; i < KernelWeightCount; i++) {
|
||||
offset += _MainTex_TexelSize.x * _SmoothWeights.w;
|
||||
divisor += 2.0f * KernelWeights[i];
|
||||
|
||||
float2 upUV = heightmapUV + float2(0.0f, offset);
|
||||
float2 downUV = heightmapUV - float2(0.0f, offset);
|
||||
|
||||
h += KernelWeights[i] * UnpackHeightmap(tex2D(_MainTex, upUV));
|
||||
h += KernelWeights[i] * UnpackHeightmap(tex2D(_MainTex, downUV));
|
||||
}
|
||||
|
||||
h /= divisor;
|
||||
|
||||
float3 new_height = float3(h, min(h, height), max(h, height));
|
||||
h = dot(new_height, _SmoothWeights.xyz);
|
||||
float transformedStrength = tex2D(_HeightTransformTex, h);
|
||||
return lerp(height, h, brushStrength);
|
||||
//return PackHeightmap(lerp(height,new_height,transformedStrength));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
/*
|
||||
Pass // 3 smooth terrain
|
||||
{
|
||||
Name "Smooth Heights"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment SmoothHeight
|
||||
|
||||
float4 _SmoothWeights; // centered, min, max, unused
|
||||
|
||||
float aggregateHeight(float2 uv, out float oobWeight)
|
||||
{
|
||||
oobWeight = all(saturate(uv) == uv) ? 1.0f : 0.0f;
|
||||
return oobWeight * UnpackHeightmap(tex2D(_MainTex, uv));
|
||||
}
|
||||
|
||||
float4 SmoothHeight(v2f i) : SV_Target
|
||||
{
|
||||
float2 brushUV = PaintContextUVToBrushUV(i.pcUV);
|
||||
float2 heightmapUV = PaintContextUVToHeightmapUV(i.pcUV);
|
||||
|
||||
// out of bounds multiplier
|
||||
float oob = all(saturate(brushUV) == brushUV) ? 1.0f : 0.0f;
|
||||
|
||||
float height = UnpackHeightmap(tex2D(_MainTex, heightmapUV));
|
||||
float brushStrength = BRUSH_STRENGTH * oob * UnpackHeightmap(tex2D(_BrushTex, brushUV)) * UnpackHeightmap(tex2D(_FilterTex, i.pcUV));
|
||||
|
||||
float h = 0.0F;
|
||||
float xoffset = _MainTex_TexelSize.x * _SmoothWeights.w;
|
||||
float yoffset = _MainTex_TexelSize.y * _SmoothWeights.w;
|
||||
|
||||
// 3*3 filter
|
||||
h += height;
|
||||
|
||||
float sum = 1.0f;
|
||||
float weight = 1.0f;
|
||||
h += aggregateHeight(heightmapUV + float2( xoffset, 0), weight);
|
||||
sum += weight;
|
||||
h += aggregateHeight(heightmapUV + float2(-xoffset, 0), weight);
|
||||
sum += weight;
|
||||
h += aggregateHeight(heightmapUV + float2( xoffset, yoffset), weight) * 0.75f;
|
||||
sum += 0.75f * weight;
|
||||
h += aggregateHeight(heightmapUV + float2(-xoffset, yoffset), weight) * 0.75f;
|
||||
sum += 0.75f * weight;
|
||||
h += aggregateHeight(heightmapUV + float2( xoffset, -yoffset), weight) * 0.75f;
|
||||
sum += 0.75f * weight;
|
||||
h += aggregateHeight(heightmapUV + float2(-xoffset, -yoffset), weight) * 0.75f;
|
||||
sum += 0.75f * weight;
|
||||
h += aggregateHeight(heightmapUV + float2( 0, yoffset), weight);
|
||||
sum += weight;
|
||||
h += aggregateHeight(heightmapUV + float2( 0, -yoffset), weight);
|
||||
sum += weight;
|
||||
|
||||
h /= sum;
|
||||
|
||||
|
||||
float3 new_height = float3(h, min(h, height), max(h, height));
|
||||
h = dot(new_height, _SmoothWeights.xyz);
|
||||
return PackHeightmap(lerp(height, h, brushStrength));
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
*/
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0927e978b4b0b754eb857a943204650d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,38 @@
|
||||
The contents of these folders and their subfolders are derived from the Unity Terrain Tools Package under the following License:
|
||||
Unity Companion License - https://unity3d.com/legal/licenses/Unity_Companion_License
|
||||
|
||||
Here is a full "offline" copy of this license in case the link above is not accessible:
|
||||
|
||||
Unity Companion License ("License")
|
||||
v1.2
|
||||
|
||||
Unity Technologies ApS (“Unity”) grants to you a worldwide, non-exclusive, no-charge, and royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute the software that accompanies this License (“Software”), subject to the following terms and conditions:
|
||||
|
||||
1. Unity Companion Use Only. Exercise of the license granted herein is limited to exercise for the creation, use, and/or distribution of applications, software, or other content pursuant to a valid Unity content authoring and rendering engine software license (“Engine License”). That means while not limited to exercise in the software licensed under the Engine License, exercise may not be for any purpose other than the creation, use, and/or distribution of Engine License-dependent applications, software, or other content. No other exercise of the license granted herein is permitted, and in no event may the Software be used for competitive analysis or to develop a competing product or service.
|
||||
|
||||
2. No Modification of Engine License. Neither this License nor any exercise of the license granted herein modifies the Engine License in any way.
|
||||
|
||||
3. Ownership; Derivative Works.
|
||||
|
||||
3.1 You own your content. In this License, “derivative works” means derivatives of the Software itself--works derived only from the Software by you under this License (for example, modifying the code of the Software itself to improve its efficacy); “derivative works” of the Software do not include, for example, games, apps, or content that you create with the Software. You keep all right, title, and interest to your own content.
|
||||
|
||||
3.2 Unity owns its content. While you keep all right, title, and interest to your own content per the above, as between Unity and you, Unity will own all right, title, and interest to all intellectual property rights (including patent, trademark, and copyright) in the Software and derivative works of the Software, and you hereby assign and agree to assign all such rights in those derivative works to Unity. Should assignment be invalid for any reason, you grant to Unity an irrevocable, perpetual, worldwide, non-exclusive, no-charge, and royalty-free license (with the right to grant sublicenses) under those intellectual property rights to those derivative works. You also agree to waive or refrain from asserting any author’s right, moral rights, or like rights to the extent necessary to permit exploitation as contemplated under this License.
|
||||
|
||||
3.3 Your right to use derivative works. You will always have the right to use derivative works of the Software you create, consonant with this License.
|
||||
|
||||
4. Trademarks. You are not granted any right or license under this License to use any trademarks, service marks, trade names, products names, or branding of Unity or its affiliates (“Trademarks”). Descriptive uses of Trademarks are permitted; see, for example, Unity’s Branding Usage Guidelines at https://unity3d.com/public-relations/brand.
|
||||
|
||||
5. Notices & Third-Party Rights. This License, including the copyright notice associated with the Software, must be provided in all substantial portions of the Software and derivative works thereof (or, if that is impracticable, in any other location where such notices are customarily placed). Further, if the Software is accompanied by a Unity “third-party notices” or similar file, you acknowledge and agree that software identified in that file is governed by those separate license terms.
|
||||
|
||||
6. DISCLAIMER, LIMITATION OF LIABILITY. THE SOFTWARE AND ANY DERIVATIVE WORKS THEREOF IS PROVIDED ON AN "AS IS" BASIS, AND IS PROVIDED WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR NONINFRINGEMENT. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES (WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL, INCLUDING PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS, AND BUSINESS INTERRUPTION), OR OTHER LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM OR OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR ANY DERIVATIVE WORKS THEREOF OR THE USE OF OR OTHER DEALINGS IN SAME, EVEN WHERE ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
7. USE IS ACCEPTANCE and License Versions. Your access to and use of the Software constitutes your acceptance of this License and its terms and conditions. This License may be modified or updated; upon any such modification or update, you will comply with the terms of the updated License for any use of any of the Software under the updated License.
|
||||
|
||||
8. Use in Compliance with Law and Termination. Your exercise of the license granted herein will at all times be in compliance with applicable law and will not infringe any proprietary rights (including intellectual property rights); this License will terminate immediately (i) on any breach by you of this License; and (ii) if you commence any form of patent litigation, including a cross-claim or counterclaim, against anyone wherein you allege that the Software constitutes direct or secondary/indirect patent infringement.
|
||||
|
||||
9. Severability. If any provision of this License is held to be unenforceable or invalid, that provision will be enforced to the maximum extent possible and the other provisions will remain in full force and effect.
|
||||
|
||||
10. Governing Law and Venue. This License is governed by and construed in accordance with the laws of Denmark, except for its conflict of laws rules; the United Nations Convention on Contracts for the International Sale of Goods will not apply. If you reside (or your principal place of business is) within the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the state and federal courts located in San Francisco County, California concerning any dispute arising out of this License (“Dispute”). If you reside (or your principal place of business is) outside the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the courts located in Copenhagen, Denmark concerning any Dispute.
|
||||
|
||||
(03.2018)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fce6176a23540b1468517aaf85603179
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user