gralobe 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gralobe.js +43 -0
- package/dist/gralobe.js.map +1 -1
- package/dist/gralobe.umd.cjs +43 -0
- package/dist/gralobe.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/gralobe.js
CHANGED
|
@@ -5968,6 +5968,49 @@ float fbm(vec2 p) {
|
|
|
5968
5968
|
return value;
|
|
5969
5969
|
}
|
|
5970
5970
|
|
|
5971
|
+
// 3D hash for volumetric noise
|
|
5972
|
+
float hash3(vec3 p) {
|
|
5973
|
+
return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453);
|
|
5974
|
+
}
|
|
5975
|
+
|
|
5976
|
+
// 3D noise for seamless spherical sampling
|
|
5977
|
+
float noise3D(vec3 p) {
|
|
5978
|
+
vec3 i = floor(p);
|
|
5979
|
+
vec3 f = fract(p);
|
|
5980
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
5981
|
+
|
|
5982
|
+
float n000 = hash3(i);
|
|
5983
|
+
float n100 = hash3(i + vec3(1.0, 0.0, 0.0));
|
|
5984
|
+
float n010 = hash3(i + vec3(0.0, 1.0, 0.0));
|
|
5985
|
+
float n110 = hash3(i + vec3(1.0, 1.0, 0.0));
|
|
5986
|
+
float n001 = hash3(i + vec3(0.0, 0.0, 1.0));
|
|
5987
|
+
float n101 = hash3(i + vec3(1.0, 0.0, 1.0));
|
|
5988
|
+
float n011 = hash3(i + vec3(0.0, 1.0, 1.0));
|
|
5989
|
+
float n111 = hash3(i + vec3(1.0, 1.0, 1.0));
|
|
5990
|
+
|
|
5991
|
+
float nx00 = mix(n000, n100, f.x);
|
|
5992
|
+
float nx10 = mix(n010, n110, f.x);
|
|
5993
|
+
float nx01 = mix(n001, n101, f.x);
|
|
5994
|
+
float nx11 = mix(n011, n111, f.x);
|
|
5995
|
+
|
|
5996
|
+
float nxy0 = mix(nx00, nx10, f.y);
|
|
5997
|
+
float nxy1 = mix(nx01, nx11, f.y);
|
|
5998
|
+
|
|
5999
|
+
return mix(nxy0, nxy1, f.z);
|
|
6000
|
+
}
|
|
6001
|
+
|
|
6002
|
+
// FBM using 3D noise for seamless spherical clouds
|
|
6003
|
+
float fbm3D(vec3 p) {
|
|
6004
|
+
float value = 0.0;
|
|
6005
|
+
float amplitude = 0.5;
|
|
6006
|
+
for (int i = 0; i < 4; i++) {
|
|
6007
|
+
value += amplitude * noise3D(p);
|
|
6008
|
+
p *= 2.0;
|
|
6009
|
+
amplitude *= 0.5;
|
|
6010
|
+
}
|
|
6011
|
+
return value;
|
|
6012
|
+
}
|
|
6013
|
+
|
|
5971
6014
|
void main() {
|
|
5972
6015
|
if (vDiscard > 0.5) {
|
|
5973
6016
|
discard;
|