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.umd.cjs
CHANGED
|
@@ -939,6 +939,49 @@ float fbm(vec2 p) {
|
|
|
939
939
|
return value;
|
|
940
940
|
}
|
|
941
941
|
|
|
942
|
+
// 3D hash for volumetric noise
|
|
943
|
+
float hash3(vec3 p) {
|
|
944
|
+
return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
// 3D noise for seamless spherical sampling
|
|
948
|
+
float noise3D(vec3 p) {
|
|
949
|
+
vec3 i = floor(p);
|
|
950
|
+
vec3 f = fract(p);
|
|
951
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
952
|
+
|
|
953
|
+
float n000 = hash3(i);
|
|
954
|
+
float n100 = hash3(i + vec3(1.0, 0.0, 0.0));
|
|
955
|
+
float n010 = hash3(i + vec3(0.0, 1.0, 0.0));
|
|
956
|
+
float n110 = hash3(i + vec3(1.0, 1.0, 0.0));
|
|
957
|
+
float n001 = hash3(i + vec3(0.0, 0.0, 1.0));
|
|
958
|
+
float n101 = hash3(i + vec3(1.0, 0.0, 1.0));
|
|
959
|
+
float n011 = hash3(i + vec3(0.0, 1.0, 1.0));
|
|
960
|
+
float n111 = hash3(i + vec3(1.0, 1.0, 1.0));
|
|
961
|
+
|
|
962
|
+
float nx00 = mix(n000, n100, f.x);
|
|
963
|
+
float nx10 = mix(n010, n110, f.x);
|
|
964
|
+
float nx01 = mix(n001, n101, f.x);
|
|
965
|
+
float nx11 = mix(n011, n111, f.x);
|
|
966
|
+
|
|
967
|
+
float nxy0 = mix(nx00, nx10, f.y);
|
|
968
|
+
float nxy1 = mix(nx01, nx11, f.y);
|
|
969
|
+
|
|
970
|
+
return mix(nxy0, nxy1, f.z);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// FBM using 3D noise for seamless spherical clouds
|
|
974
|
+
float fbm3D(vec3 p) {
|
|
975
|
+
float value = 0.0;
|
|
976
|
+
float amplitude = 0.5;
|
|
977
|
+
for (int i = 0; i < 4; i++) {
|
|
978
|
+
value += amplitude * noise3D(p);
|
|
979
|
+
p *= 2.0;
|
|
980
|
+
amplitude *= 0.5;
|
|
981
|
+
}
|
|
982
|
+
return value;
|
|
983
|
+
}
|
|
984
|
+
|
|
942
985
|
void main() {
|
|
943
986
|
if (vDiscard > 0.5) {
|
|
944
987
|
discard;
|