summaryrefslogtreecommitdiffstats
path: root/Scripts/Editor/GenerateNoise.cs
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-03-17 15:49:21 -0700
committeryum <yum.food.vr@gmail.com>2026-03-17 15:49:25 -0700
commit1784064c7a39a69203e8975167addf1915f940bd (patch)
tree4adc272435efcf54ac7ed8399aa33acbf422a959 /Scripts/Editor/GenerateNoise.cs
parent019c24186c87fd747aae1512abf4d4690e3aca07 (diff)
Add faster 3-in 1-out hasher for domain warping
Goes from ~1.7 ms/frame to ~1.1 ms/frame in 10-octave microbenchmark.
Diffstat (limited to 'Scripts/Editor/GenerateNoise.cs')
-rw-r--r--Scripts/Editor/GenerateNoise.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Scripts/Editor/GenerateNoise.cs b/Scripts/Editor/GenerateNoise.cs
index 73a5e20..472d5ff 100644
--- a/Scripts/Editor/GenerateNoise.cs
+++ b/Scripts/Editor/GenerateNoise.cs
@@ -47,11 +47,12 @@ public class GenerateNoise : EditorWindow
int res = _type == NoiseType.WhiteNoise ? _resolution : _resolution * _texelsPerCell;
Texture3D tex;
+ bool makeMipMaps = true;
switch (_type)
{
case NoiseType.WorleyNoise:
{
- tex = new Texture3D(res, res, res, TextureFormat.R8, false);
+ tex = new Texture3D(res, res, res, TextureFormat.R8, makeMipMaps);
GenerateWorleyField(res, _texelsPerCell, _metric, out var f1, out _);
var pixels = new byte[res * res * res];
for (int i = 0; i < pixels.Length; i++)
@@ -61,7 +62,7 @@ public class GenerateNoise : EditorWindow
}
case NoiseType.WorleyEdgeSDF:
{
- tex = new Texture3D(res, res, res, TextureFormat.R8, false);
+ tex = new Texture3D(res, res, res, TextureFormat.R8, makeMipMaps);
GenerateWorleyField(res, _texelsPerCell, _metric, out var f1, out var f2);
var pixels = new byte[res * res * res];
GenerateEdgeSDF(pixels, f2, _sdfRadius);
@@ -70,7 +71,7 @@ public class GenerateNoise : EditorWindow
}
default:
{
- tex = new Texture3D(res, res, res, TextureFormat.RGBA32, false);
+ tex = new Texture3D(res, res, res, TextureFormat.RGB24, makeMipMaps);
var pixels = new Color32[res * res * res];
GenerateWhiteNoise(pixels);
tex.SetPixels32(pixels);
@@ -79,7 +80,7 @@ public class GenerateNoise : EditorWindow
}
tex.wrapMode = TextureWrapMode.Repeat;
- tex.filterMode = FilterMode.Bilinear;
+ tex.filterMode = FilterMode.Trilinear;
tex.Apply();
string name;