You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
948 B
Plaintext
32 lines
948 B
Plaintext
/******************************************************************************/
|
|
/*
|
|
Project - MudBun
|
|
Publisher - Long Bunny Labs
|
|
http://LongBunnyLabs.com
|
|
Author - Ming-Lun "Allen" Chou
|
|
http://AllenChou.net
|
|
*/
|
|
/******************************************************************************/
|
|
|
|
#pragma kernel generate_noise_cache
|
|
|
|
#define kThreadGroupExtent (4)
|
|
#define kThreadGroupSize (kThreadGroupExtent * kThreadGroupExtent * kThreadGroupExtent)
|
|
|
|
#include "../../Shader/Noise/ClassicNoise3D.cginc"
|
|
|
|
RWTexture3D<float> noiseCache;
|
|
int3 noiseCacheDimension;
|
|
float noiseCacheDensity;
|
|
float3 noiseCachePeriod;
|
|
|
|
[numthreads(kThreadGroupExtent, kThreadGroupExtent, kThreadGroupExtent)]
|
|
void generate_noise_cache(uint3 id : SV_DispatchThreadID)
|
|
{
|
|
if (any(id >= uint3(noiseCacheDimension)))
|
|
return;
|
|
|
|
noiseCache[id] = saturate(0.8f * mbn_pnoise(id / noiseCacheDensity, noiseCachePeriod) + 0.5f) - 0.5f;
|
|
}
|
|
|