Upload project files
This commit is contained in:
8
Shader/Include.meta
Normal file
8
Shader/Include.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd42b02a5aded1e468d9c8b1aa71b343
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
105
Shader/Include/ClassicNoise3D.hlsl
Normal file
105
Shader/Include/ClassicNoise3D.hlsl
Normal file
@@ -0,0 +1,105 @@
|
||||
#include "Packages/com.misaki.art-tools/Shader/Include/Common/NoiseCommon.hlsl"
|
||||
|
||||
float ClassicNoise_impl(float3 pi0, float3 pf0, float3 pi1, float3 pf1)
|
||||
{
|
||||
pi0 = wglnoise_mod289(pi0);
|
||||
pi1 = wglnoise_mod289(pi1);
|
||||
|
||||
float4 ix = float4(pi0.x, pi1.x, pi0.x, pi1.x);
|
||||
float4 iy = float4(pi0.y, pi0.y, pi1.y, pi1.y);
|
||||
float4 iz0 = pi0.z;
|
||||
float4 iz1 = pi1.z;
|
||||
|
||||
float4 ixy = wglnoise_permute(wglnoise_permute(ix) + iy);
|
||||
float4 ixy0 = wglnoise_permute(ixy + iz0);
|
||||
float4 ixy1 = wglnoise_permute(ixy + iz1);
|
||||
|
||||
float4 gx0 = lerp(-1, 1, frac(floor(ixy0 / 7) / 7));
|
||||
float4 gy0 = lerp(-1, 1, frac(floor(ixy0 % 7) / 7));
|
||||
float4 gz0 = 1 - abs(gx0) - abs(gy0);
|
||||
|
||||
bool4 zn0 = gz0 < -0.01;
|
||||
gx0 += zn0 * (gx0 < -0.01 ? 1 : -1);
|
||||
gy0 += zn0 * (gy0 < -0.01 ? 1 : -1);
|
||||
|
||||
float4 gx1 = lerp(-1, 1, frac(floor(ixy1 / 7) / 7));
|
||||
float4 gy1 = lerp(-1, 1, frac(floor(ixy1 % 7) / 7));
|
||||
float4 gz1 = 1 - abs(gx1) - abs(gy1);
|
||||
|
||||
bool4 zn1 = gz1 < -0.01;
|
||||
gx1 += zn1 * (gx1 < -0.01 ? 1 : -1);
|
||||
gy1 += zn1 * (gy1 < -0.01 ? 1 : -1);
|
||||
|
||||
float3 g000 = normalize(float3(gx0.x, gy0.x, gz0.x));
|
||||
float3 g100 = normalize(float3(gx0.y, gy0.y, gz0.y));
|
||||
float3 g010 = normalize(float3(gx0.z, gy0.z, gz0.z));
|
||||
float3 g110 = normalize(float3(gx0.w, gy0.w, gz0.w));
|
||||
float3 g001 = normalize(float3(gx1.x, gy1.x, gz1.x));
|
||||
float3 g101 = normalize(float3(gx1.y, gy1.y, gz1.y));
|
||||
float3 g011 = normalize(float3(gx1.z, gy1.z, gz1.z));
|
||||
float3 g111 = normalize(float3(gx1.w, gy1.w, gz1.w));
|
||||
|
||||
float n000 = dot(g000, pf0);
|
||||
float n100 = dot(g100, float3(pf1.x, pf0.y, pf0.z));
|
||||
float n010 = dot(g010, float3(pf0.x, pf1.y, pf0.z));
|
||||
float n110 = dot(g110, float3(pf1.x, pf1.y, pf0.z));
|
||||
float n001 = dot(g001, float3(pf0.x, pf0.y, pf1.z));
|
||||
float n101 = dot(g101, float3(pf1.x, pf0.y, pf1.z));
|
||||
float n011 = dot(g011, float3(pf0.x, pf1.y, pf1.z));
|
||||
float n111 = dot(g111, pf1);
|
||||
|
||||
float3 fade_xyz = wglnoise_fade(pf0);
|
||||
float4 n_z = lerp(float4(n000, n100, n010, n110),
|
||||
float4(n001, n101, n011, n111), fade_xyz.z);
|
||||
float2 n_yz = lerp(n_z.xy, n_z.zw, fade_xyz.y);
|
||||
float n_xyz = lerp(n_yz.x, n_yz.y, fade_xyz.x);
|
||||
return 1.46 * n_xyz;
|
||||
}
|
||||
|
||||
// Classic Perlin noise
|
||||
float ClassicNoise(float3 p)
|
||||
{
|
||||
float3 i = floor(p);
|
||||
float3 f = frac(p);
|
||||
return ClassicNoise_impl(i, f, i + 1, f - 1);
|
||||
}
|
||||
|
||||
// Classic Perlin noise, periodic variant
|
||||
float PeriodicNoise(float3 p, float3 rep)
|
||||
{
|
||||
float3 i0 = wglnoise_mod(floor(p), rep);
|
||||
float3 i1 = wglnoise_mod(i0 + 1, rep);
|
||||
float3 f = frac(p);
|
||||
return ClassicNoise_impl(i0, f, i1, f - 1);
|
||||
}
|
||||
|
||||
float NoiseFBM(float3 p, float octaves, float lacunarity, float gain)
|
||||
{
|
||||
float sum = 0;
|
||||
float amp = 1;
|
||||
float freq = 1;
|
||||
for (int i = 0; i < octaves; i++)
|
||||
{
|
||||
sum += ClassicNoise(p * freq) * amp;
|
||||
freq *= lacunarity;
|
||||
amp *= gain;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
// ShaderGraph function
|
||||
void ClassicNoise_float(float3 p, out float Out)
|
||||
{
|
||||
Out = ClassicNoise(p);
|
||||
|
||||
}
|
||||
|
||||
void PeriodicNoise_float(float3 p, float3 rep, out float Out)
|
||||
{
|
||||
Out = PeriodicNoise(p, rep);
|
||||
}
|
||||
|
||||
void NoiseFBM_float(float3 p, float octaves, float lacunarity, float gain, out float Out)
|
||||
{
|
||||
Out = NoiseFBM(p, octaves, lacunarity, gain);
|
||||
}
|
||||
7
Shader/Include/ClassicNoise3D.hlsl.meta
Normal file
7
Shader/Include/ClassicNoise3D.hlsl.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a148fadaea89f44cb527885b6ca0655
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Shader/Include/Common.meta
Normal file
8
Shader/Include/Common.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65fb634016e1f9e4da54f4af4f20f27c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
59
Shader/Include/Common/NoiseCommon.hlsl
Normal file
59
Shader/Include/Common/NoiseCommon.hlsl
Normal file
@@ -0,0 +1,59 @@
|
||||
float wglnoise_mod(float x, float y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float2 wglnoise_mod(float2 x, float2 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float3 wglnoise_mod(float3 x, float3 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float4 wglnoise_mod(float4 x, float4 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float2 wglnoise_fade(float2 t)
|
||||
{
|
||||
return t * t * t * (t * (t * 6 - 15) + 10);
|
||||
}
|
||||
|
||||
float3 wglnoise_fade(float3 t)
|
||||
{
|
||||
return t * t * t * (t * (t * 6 - 15) + 10);
|
||||
}
|
||||
|
||||
float wglnoise_mod289(float x)
|
||||
{
|
||||
return x - floor(x / 289) * 289;
|
||||
}
|
||||
|
||||
float2 wglnoise_mod289(float2 x)
|
||||
{
|
||||
return x - floor(x / 289) * 289;
|
||||
}
|
||||
|
||||
float3 wglnoise_mod289(float3 x)
|
||||
{
|
||||
return x - floor(x / 289) * 289;
|
||||
}
|
||||
|
||||
float4 wglnoise_mod289(float4 x)
|
||||
{
|
||||
return x - floor(x / 289) * 289;
|
||||
}
|
||||
|
||||
float3 wglnoise_permute(float3 x)
|
||||
{
|
||||
return wglnoise_mod289((x * 34 + 1) * x);
|
||||
}
|
||||
|
||||
float4 wglnoise_permute(float4 x)
|
||||
{
|
||||
return wglnoise_mod289((x * 34 + 1) * x);
|
||||
}
|
||||
7
Shader/Include/Common/NoiseCommon.hlsl.meta
Normal file
7
Shader/Include/Common/NoiseCommon.hlsl.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab1c13ca725af4e42bb92eca00cb93e8
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7357
Shader/MossShader.shadergraph
Normal file
7357
Shader/MossShader.shadergraph
Normal file
File diff suppressed because it is too large
Load Diff
10
Shader/MossShader.shadergraph.meta
Normal file
10
Shader/MossShader.shadergraph.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a83ceba9a943be4a9474ef1b84d2a8d
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
Reference in New Issue
Block a user