tsl-textures 1.10.0 → 1.11.0
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/README.md +58 -0
- package/package.json +204 -33
- package/src/camouflage.js +19 -19
- package/src/cave-art.js +1 -1
- package/src/circles.js +1 -1
- package/src/clouds.js +3 -3
- package/src/concrete.js +1 -1
- package/src/cork.js +1 -1
- package/src/dalmatian-spots.js +3 -3
- package/src/darth-maul.js +1 -1
- package/src/dyson-sphere.js +1 -1
- package/src/entangled.js +4 -4
- package/src/fordite.js +1 -1
- package/src/gas-giant.js +1 -1
- package/src/grid.js +2 -2
- package/src/isolines.js +1 -1
- package/src/karst-rock.js +1 -1
- package/src/marble.js +11 -11
- package/src/neon-lights.js +1 -1
- package/src/photosphere.js +1 -1
- package/src/planet.js +1 -1
- package/src/polka-dots.js +3 -3
- package/src/processed-wood.js +1 -1
- package/src/protozoa.js +1 -1
- package/src/rotator.js +1 -1
- package/src/rough-clay.js +1 -1
- package/src/runny-eggs.js +1 -1
- package/src/rust.js +3 -3
- package/src/satin.js +1 -1
- package/src/scaler.js +1 -1
- package/src/scepter-head.js +1 -1
- package/src/scream.js +1 -1
- package/src/simplex-noise.js +1 -1
- package/src/stars.js +1 -1
- package/src/supersphere.js +1 -1
- package/src/tiger-fur.js +1 -1
- package/src/translator.js +1 -1
- package/src/voronoi-cells.js +1 -1
- package/src/water-drops.js +1 -1
- package/src/watermelon.js +1 -1
- package/src/wood.js +1 -1
- package/src/zebra-lines.js +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,15 @@ these are online real-time procedural generators of 3D textures.
|
|
|
5
5
|
Pick a texture from the [Project home page](https://boytchev.github.io/tsl-textures/).
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-planet.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/example-planet.html)
|
|
9
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-normal-map.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/example-normal-map.html)
|
|
10
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-wooden-toys.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/example-wooden-toys.html)
|
|
11
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-protozoa.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/example-protozoa.html)
|
|
12
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-neck-massage.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/example-neck-massage.html)
|
|
13
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-watermelon-supersphere.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/example-watermelon-supersphere.html)
|
|
14
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-texture-in-motion.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/example-texture-in-motion.html)
|
|
15
|
+
|
|
16
|
+
<!--
|
|
8
17
|
#### Example "Planet"
|
|
9
18
|
|
|
10
19
|
Uses [planet.js](https://boytchev.github.io/tsl-textures/docs/planet.html)
|
|
@@ -79,3 +88,52 @@ via a TSL function. Click on the image for a live demo. (Note: non-WebGPU browse
|
|
|
79
88
|
might need 30+ seconds to start up.)
|
|
80
89
|
|
|
81
90
|
[<img src="https://boytchev.github.io/tsl-textures/examples/example-texture-in-motion.jpg">](https://boytchev.github.io/tsl-textures/examples/example-texture-in-motion.html)
|
|
91
|
+
-->
|
|
92
|
+
|
|
93
|
+
## Usage
|
|
94
|
+
|
|
95
|
+
### Use with NPM
|
|
96
|
+
|
|
97
|
+
**Install**
|
|
98
|
+
```bat
|
|
99
|
+
npm install three tsl-textures
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Use in a javascript file**
|
|
103
|
+
```js
|
|
104
|
+
// Important: Use `webgpu` version of Three.js
|
|
105
|
+
import * as THREE from 'three/webgpu';
|
|
106
|
+
|
|
107
|
+
// Import your desired texture
|
|
108
|
+
import { polkaDots } from 'tsl-textures/polka-dots';
|
|
109
|
+
|
|
110
|
+
// Create the renderer. Important: Use `WebGPURenderer`
|
|
111
|
+
renderer = new THREE.WebGPURenderer({antialias: true});
|
|
112
|
+
|
|
113
|
+
// ... Create your Three.js scene, camera, lights, etc.
|
|
114
|
+
|
|
115
|
+
// Create geometry
|
|
116
|
+
const objectGeometry = new THREE.IcosahedronGeometry(1, 12)
|
|
117
|
+
|
|
118
|
+
// Create material: Important: Use `Node` Material
|
|
119
|
+
objectMaterial = new THREE.MeshStandardNodeMaterial({
|
|
120
|
+
color: 0xCCCCCC,
|
|
121
|
+
roughness: 0.5,
|
|
122
|
+
metalness: 0.0,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Apply texture to the material's `colorNode` property
|
|
126
|
+
objectMaterial.colorNode = polkaDots ( {
|
|
127
|
+
count: 2,
|
|
128
|
+
size: 0.6,
|
|
129
|
+
blur: 0.22,
|
|
130
|
+
color: new THREE.Color(0),
|
|
131
|
+
background: new THREE.Color(16777215)
|
|
132
|
+
} );
|
|
133
|
+
|
|
134
|
+
// Assign Geometry and Material to a Mesh
|
|
135
|
+
object = new THREE.Mesh(objectGeometry, objectMaterial);
|
|
136
|
+
|
|
137
|
+
// Render
|
|
138
|
+
renderer.render( scene, camera );
|
|
139
|
+
```
|
package/package.json
CHANGED
|
@@ -1,33 +1,204 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tsl-textures",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "A collection of Three.js Shading Language (TSL) textures ",
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "tsl-textures",
|
|
3
|
+
"version": "1.11.0",
|
|
4
|
+
"description": "A collection of Three.js Shading Language (TSL) textures ",
|
|
5
|
+
"main": "./src/tsl-utils.js",
|
|
6
|
+
"module": "./src/tsl-utils.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./src/tsl-utils.js",
|
|
10
|
+
"import": "./src/tsl-utils.js"
|
|
11
|
+
},
|
|
12
|
+
"./camouflage": {
|
|
13
|
+
"require": "./src/camouflage.js",
|
|
14
|
+
"import": "./src/camouflage.js"
|
|
15
|
+
},
|
|
16
|
+
"./cave-art": {
|
|
17
|
+
"require": "./src/cave-art.js",
|
|
18
|
+
"import": "./src/cave-art.js"
|
|
19
|
+
},
|
|
20
|
+
"./circles": {
|
|
21
|
+
"require": "./src/circles.js",
|
|
22
|
+
"import": "./src/circles.js"
|
|
23
|
+
},
|
|
24
|
+
"./clouds": {
|
|
25
|
+
"require": "./src/clouds.js",
|
|
26
|
+
"import": "./src/clouds.js"
|
|
27
|
+
},
|
|
28
|
+
"./concrete": {
|
|
29
|
+
"require": "./src/concrete.js",
|
|
30
|
+
"import": "./src/concrete.js"
|
|
31
|
+
},
|
|
32
|
+
"./cork": {
|
|
33
|
+
"require": "./src/cork.js",
|
|
34
|
+
"import": "./src/cork.js"
|
|
35
|
+
},
|
|
36
|
+
"./dalmatian-spots": {
|
|
37
|
+
"require": "./src/dalmatian-spots.js",
|
|
38
|
+
"import": "./src/dalmatian-spots.js"
|
|
39
|
+
},
|
|
40
|
+
"./darth-maul": {
|
|
41
|
+
"require": "./src/darth-maul.js",
|
|
42
|
+
"import": "./src/darth-maul.js"
|
|
43
|
+
},
|
|
44
|
+
"./dyson-sphere": {
|
|
45
|
+
"require": "./src/dyson-sphere.js",
|
|
46
|
+
"import": "./src/dyson-sphere.js"
|
|
47
|
+
},
|
|
48
|
+
"./entangled": {
|
|
49
|
+
"require": "./src/entangled.js",
|
|
50
|
+
"import": "./src/entangled.js"
|
|
51
|
+
},
|
|
52
|
+
"./fordite": {
|
|
53
|
+
"require": "./src/fordite.js",
|
|
54
|
+
"import": "./src/fordite.js"
|
|
55
|
+
},
|
|
56
|
+
"./gas-giant": {
|
|
57
|
+
"require": "./src/gas-giant.js",
|
|
58
|
+
"import": "./src/gas-giant.js"
|
|
59
|
+
},
|
|
60
|
+
"./grid": {
|
|
61
|
+
"require": "./src/grid.js",
|
|
62
|
+
"import": "./src/grid.js"
|
|
63
|
+
},
|
|
64
|
+
"./isolines": {
|
|
65
|
+
"require": "./src/isolines.js",
|
|
66
|
+
"import": "./src/isolines.js"
|
|
67
|
+
},
|
|
68
|
+
"./karst-rock": {
|
|
69
|
+
"require": "./src/karst-rock.js",
|
|
70
|
+
"import": "./src/karst-rock.js"
|
|
71
|
+
},
|
|
72
|
+
"./marble": {
|
|
73
|
+
"require": "./src/marble.js",
|
|
74
|
+
"import": "./src/marble.js"
|
|
75
|
+
},
|
|
76
|
+
"./neon-lights": {
|
|
77
|
+
"require": "./src/neon-lights.js",
|
|
78
|
+
"import": "./src/neon-lights.js"
|
|
79
|
+
},
|
|
80
|
+
"./photosphere": {
|
|
81
|
+
"require": "./src/photosphere.js",
|
|
82
|
+
"import": "./src/photosphere.js"
|
|
83
|
+
},
|
|
84
|
+
"./planet": {
|
|
85
|
+
"require": "./src/planet.js",
|
|
86
|
+
"import": "./src/planet.js"
|
|
87
|
+
},
|
|
88
|
+
"./polka-dots": {
|
|
89
|
+
"require": "./src/polka-dots.js",
|
|
90
|
+
"import": "./src/polka-dots.js"
|
|
91
|
+
},
|
|
92
|
+
"./processed-wood": {
|
|
93
|
+
"require": "./src/processed-wood.js",
|
|
94
|
+
"import": "./src/processed-wood.js"
|
|
95
|
+
},
|
|
96
|
+
"./protozoa": {
|
|
97
|
+
"require": "./src/protozoa.js",
|
|
98
|
+
"import": "./src/protozoa.js"
|
|
99
|
+
},
|
|
100
|
+
"./rotator": {
|
|
101
|
+
"require": "./src/rotator.js",
|
|
102
|
+
"import": "./src/rotator.js"
|
|
103
|
+
},
|
|
104
|
+
"./rough-clay": {
|
|
105
|
+
"require": "./src/rough-clay.js",
|
|
106
|
+
"import": "./src/rough-clay.js"
|
|
107
|
+
},
|
|
108
|
+
"./runny-eggs": {
|
|
109
|
+
"require": "./src/runny-eggs.js",
|
|
110
|
+
"import": "./src/runny-eggs.js"
|
|
111
|
+
},
|
|
112
|
+
"./rust": {
|
|
113
|
+
"require": "./src/rust.js",
|
|
114
|
+
"import": "./src/rust.js"
|
|
115
|
+
},
|
|
116
|
+
"./satin": {
|
|
117
|
+
"require": "./src/satin.js",
|
|
118
|
+
"import": "./src/satin.js"
|
|
119
|
+
},
|
|
120
|
+
"./scaler": {
|
|
121
|
+
"require": "./src/scaler.js",
|
|
122
|
+
"import": "./src/scaler.js"
|
|
123
|
+
},
|
|
124
|
+
"./scepter-head": {
|
|
125
|
+
"require": "./src/scepter-head.js",
|
|
126
|
+
"import": "./src/scepter-head.js"
|
|
127
|
+
},
|
|
128
|
+
"./scream": {
|
|
129
|
+
"require": "./src/scream.js",
|
|
130
|
+
"import": "./src/scream.js"
|
|
131
|
+
},
|
|
132
|
+
"./simplex-noise": {
|
|
133
|
+
"require": "./src/simplex-noise.js",
|
|
134
|
+
"import": "./src/simplex-noise.js"
|
|
135
|
+
},
|
|
136
|
+
"./stars": {
|
|
137
|
+
"require": "./src/stars.js",
|
|
138
|
+
"import": "./src/stars.js"
|
|
139
|
+
},
|
|
140
|
+
"./supersphere": {
|
|
141
|
+
"require": "./src/supersphere.js",
|
|
142
|
+
"import": "./src/supersphere.js"
|
|
143
|
+
},
|
|
144
|
+
"./tiger-fur": {
|
|
145
|
+
"require": "./src/tiger-fur.js",
|
|
146
|
+
"import": "./src/tiger-fur.js"
|
|
147
|
+
},
|
|
148
|
+
"./translator": {
|
|
149
|
+
"require": "./src/translator.js",
|
|
150
|
+
"import": "./src/translator.js"
|
|
151
|
+
},
|
|
152
|
+
"./tsl-utils": {
|
|
153
|
+
"require": "./src/tsl-utils.js",
|
|
154
|
+
"import": "./src/tsl-utils.js"
|
|
155
|
+
},
|
|
156
|
+
"./voronoi-cells": {
|
|
157
|
+
"require": "./src/voronoi-cells.js",
|
|
158
|
+
"import": "./src/voronoi-cells.js"
|
|
159
|
+
},
|
|
160
|
+
"./water-drops": {
|
|
161
|
+
"require": "./src/water-drops.js",
|
|
162
|
+
"import": "./src/water-drops.js"
|
|
163
|
+
},
|
|
164
|
+
"./watermelon": {
|
|
165
|
+
"require": "./src/watermelon.js",
|
|
166
|
+
"import": "./src/watermelon.js"
|
|
167
|
+
},
|
|
168
|
+
"./wood": {
|
|
169
|
+
"require": "./src/wood.js",
|
|
170
|
+
"import": "./src/wood.js"
|
|
171
|
+
},
|
|
172
|
+
"./zebra-lines": {
|
|
173
|
+
"require": "./src/zebra-lines.js",
|
|
174
|
+
"import": "./src/zebra-lines.js"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"repository": {
|
|
178
|
+
"type": "git",
|
|
179
|
+
"url": "git+https://github.com/boytchev/tsl-textures.git"
|
|
180
|
+
},
|
|
181
|
+
"scripts": {
|
|
182
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
183
|
+
},
|
|
184
|
+
"keywords": [
|
|
185
|
+
"texture",
|
|
186
|
+
"tsl",
|
|
187
|
+
"three.js"
|
|
188
|
+
],
|
|
189
|
+
"homepage": "https://boytchev.github.io/tsl-textures/",
|
|
190
|
+
"author": "Pavel Boytchev",
|
|
191
|
+
"files": [
|
|
192
|
+
"LICENSE",
|
|
193
|
+
"package.json",
|
|
194
|
+
"README.md",
|
|
195
|
+
"src"
|
|
196
|
+
],
|
|
197
|
+
"license": "MIT",
|
|
198
|
+
"devDependencies": {
|
|
199
|
+
"@eslint/js": "^9.4.0",
|
|
200
|
+
"eslint": "^9.4.0",
|
|
201
|
+
"eslint-plugin-html": "^8.1.1",
|
|
202
|
+
"globals": "^15.4.0"
|
|
203
|
+
}
|
|
204
|
+
}
|
package/src/camouflage.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from 'three';
|
|
7
7
|
import { exp, Fn, If, positionGeometry, round, vec3 } from 'three/tsl';
|
|
8
|
-
import { noise, prepare } from 'tsl-
|
|
8
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -17,33 +17,33 @@ var camouflage = Fn( ( params )=>{
|
|
|
17
17
|
|
|
18
18
|
var color = vec3( 0, 0, 0 ).toVar( );
|
|
19
19
|
|
|
20
|
-
If( round( noise( pos, 1, 0.2 ) ).greaterThanEqual( 1 ), () => {
|
|
21
|
-
|
|
22
|
-
color.assign( params.colorA );
|
|
23
|
-
|
|
20
|
+
If( round( noise( pos, 1, 0.2 ) ).greaterThanEqual( 1 ), () => {
|
|
21
|
+
|
|
22
|
+
color.assign( params.colorA );
|
|
23
|
+
|
|
24
24
|
}
|
|
25
25
|
)
|
|
26
|
-
.ElseIf( round( noise( pos.yzx, 1, 0.3 ) ).greaterThanEqual( 1 ), () => {
|
|
27
|
-
|
|
28
|
-
color.assign( params.colorB );
|
|
29
|
-
|
|
26
|
+
.ElseIf( round( noise( pos.yzx, 1, 0.3 ) ).greaterThanEqual( 1 ), () => {
|
|
27
|
+
|
|
28
|
+
color.assign( params.colorB );
|
|
29
|
+
|
|
30
30
|
}
|
|
31
31
|
)
|
|
32
|
-
.ElseIf( round( noise( pos.zxy, 1, 0.4 ) ).greaterThanEqual( 1 ), () => {
|
|
33
|
-
|
|
34
|
-
color.assign( params.colorC );
|
|
35
|
-
|
|
32
|
+
.ElseIf( round( noise( pos.zxy, 1, 0.4 ) ).greaterThanEqual( 1 ), () => {
|
|
33
|
+
|
|
34
|
+
color.assign( params.colorC );
|
|
35
|
+
|
|
36
36
|
}
|
|
37
37
|
)
|
|
38
|
-
.Else( () => {
|
|
39
|
-
|
|
40
|
-
color.assign( params.colorD );
|
|
41
|
-
|
|
38
|
+
.Else( () => {
|
|
39
|
+
|
|
40
|
+
color.assign( params.colorD );
|
|
41
|
+
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
return color;
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
} );
|
|
48
48
|
|
|
49
49
|
|
|
@@ -63,4 +63,4 @@ camouflage.defaults = {
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
export { camouflage };
|
|
66
|
+
export { camouflage };
|
package/src/cave-art.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { abs, add, exp, float, Fn, If, mix, or, positionGeometry, pow2, sub } from 'three/tsl';
|
|
8
|
-
import { noise, prepare } from 'tsl-
|
|
8
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var caveArt = Fn( ( params ) => {
|
package/src/circles.js
CHANGED
package/src/clouds.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { clamp, exp, Fn, min, mix, mul, positionGeometry, vec4 } from 'three/tsl';
|
|
8
|
-
import { noise, prepare } from 'tsl-
|
|
8
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -23,7 +23,7 @@ var _clouds = Fn( ( params ) => {
|
|
|
23
23
|
var a = clamp( 0, 1, mul( k, 2 ).pow( 1.5 ).sub( 1 ).mul( params.opacity ) ).toVar();
|
|
24
24
|
|
|
25
25
|
return vec4( mix( params.subcolor, params.color, min( 1, k ) ), a );
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
} );
|
|
28
28
|
|
|
29
29
|
|
|
@@ -32,7 +32,7 @@ var clouds = Fn( ( params ) => {
|
|
|
32
32
|
params = prepare( { ...clouds.defaults, ...params } );
|
|
33
33
|
|
|
34
34
|
return _clouds( params ).rgb;
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
} );
|
|
37
37
|
|
|
38
38
|
|
package/src/concrete.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import { abs, cos, cross, exp, Fn, normalLocal, positionGeometry, pow, remap, sin, sub, tangentLocal, transformNormalToView, vec3 } from 'three/tsl';
|
|
7
|
-
import { noise, prepare } from 'tsl-
|
|
7
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
package/src/cork.js
CHANGED
package/src/dalmatian-spots.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { exp, float, Fn, Loop, mix, positionGeometry } from 'three/tsl';
|
|
8
|
-
import { noise, prepare } from 'tsl-
|
|
8
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var dalmatianSpots = Fn( ( params )=>{
|
|
@@ -19,7 +19,7 @@ var dalmatianSpots = Fn( ( params )=>{
|
|
|
19
19
|
var d = float( 1.5 ).sub( params.density ).mul( 2 ).toVar();
|
|
20
20
|
var count = params.density.mul( 5 ).add( 5 ).toVar();
|
|
21
21
|
|
|
22
|
-
Loop( count, ()=> {
|
|
22
|
+
Loop( count, ()=> {
|
|
23
23
|
|
|
24
24
|
k.mulAssign( noise( pos ).abs().pow( d ).mul( 100 ).sub( 50 ).clamp( 0, 1 ).oneMinus() );
|
|
25
25
|
pos.assign( pos.mul( 1.01 ) );
|
|
@@ -27,7 +27,7 @@ var dalmatianSpots = Fn( ( params )=>{
|
|
|
27
27
|
pos.assign( pos.mul( 1.01 ) );
|
|
28
28
|
k.mulAssign( noise( pos.zxy ).abs().pow( d ).mul( 100 ).sub( 50 ).clamp( 0, 1 ).oneMinus() );
|
|
29
29
|
pos.assign( pos.mul( 1.01 ) );
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
} );
|
|
32
32
|
|
|
33
33
|
return mix( params.background, params.color, k.clamp( 0, 1 ) );
|
package/src/darth-maul.js
CHANGED
package/src/dyson-sphere.js
CHANGED
package/src/entangled.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { abs, exp, float, floor, Fn, Loop, max, mix, mul, oneMinus, positionGeometry, pow, sin } from 'three/tsl';
|
|
8
|
-
import { noise, prepare } from 'tsl-
|
|
8
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -18,18 +18,18 @@ var entangled = Fn( ( params ) => {
|
|
|
18
18
|
var k = float( -10000 ).toVar( );
|
|
19
19
|
var k1 = float( 0 ).toVar( );
|
|
20
20
|
|
|
21
|
-
Loop( floor( float( params.density ) ), ()=> {
|
|
21
|
+
Loop( floor( float( params.density ) ), ()=> {
|
|
22
22
|
|
|
23
23
|
k1.assign( sin( noise( mul( pos, scale ) ).mul( 3*Math.PI ) ) );
|
|
24
24
|
k.assign( max( k, k1 ) );
|
|
25
25
|
scale.mulAssign( 1.2 );
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
} );
|
|
28
28
|
|
|
29
29
|
k.assign( oneMinus( pow( abs( k ), 5 ) ).mul( 6 ) );
|
|
30
30
|
|
|
31
31
|
return mix( params.color, params.background, k );
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
} );
|
|
34
34
|
|
|
35
35
|
|
package/src/fordite.js
CHANGED
package/src/gas-giant.js
CHANGED
package/src/grid.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { abs, add, div, equirectUV, Fn, min, mix, mul, oneMinus, positionGeometry, pow, remapClamp, round, sin, smoothstep, sub } from 'three/tsl';
|
|
8
|
-
import { prepare } from 'tsl-
|
|
8
|
+
import { prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -30,7 +30,7 @@ var grid = Fn( ( params ) => {
|
|
|
30
30
|
var k = oneMinus( smoothstep( sub( treshold, 0.002 ), add( treshold, 0.002 ), angle ) );
|
|
31
31
|
|
|
32
32
|
return mix( params.background, params.color, k );
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
} );
|
|
35
35
|
|
|
36
36
|
|
package/src/isolines.js
CHANGED
package/src/karst-rock.js
CHANGED
package/src/marble.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { add, div, exp, Fn, If, mix, mul, oneMinus, positionGeometry, pow } from 'three/tsl';
|
|
8
|
-
import { noise, prepare } from 'tsl-
|
|
8
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -26,23 +26,23 @@ var marble = Fn( ( params ) => {
|
|
|
26
26
|
var maxSmooth = oneMinus( pow( 0.5, params.thinness.add( 7 ) ) ).toVar(),
|
|
27
27
|
minSmooth = oneMinus( pow( 0.5, params.thinness.add( 7 ).mul( 0.5 ) ) ).toVar();
|
|
28
28
|
|
|
29
|
-
If( k.greaterThan( maxSmooth ), ()=>{
|
|
30
|
-
|
|
31
|
-
k.assign( 1 );
|
|
32
|
-
|
|
29
|
+
If( k.greaterThan( maxSmooth ), ()=>{
|
|
30
|
+
|
|
31
|
+
k.assign( 1 );
|
|
32
|
+
|
|
33
33
|
} )
|
|
34
|
-
.ElseIf( k.lessThan( minSmooth ), ()=>{
|
|
35
|
-
|
|
36
|
-
k.assign( 0 );
|
|
37
|
-
|
|
34
|
+
.ElseIf( k.lessThan( minSmooth ), ()=>{
|
|
35
|
+
|
|
36
|
+
k.assign( 0 );
|
|
37
|
+
|
|
38
38
|
} )
|
|
39
|
-
.Else( ()=> {
|
|
39
|
+
.Else( ()=> {
|
|
40
40
|
|
|
41
41
|
var a = k.sub( minSmooth );
|
|
42
42
|
var b = maxSmooth.sub( minSmooth );
|
|
43
43
|
k.assign( pow( div( a, b ), 5 ).mul( 0.75 ) );
|
|
44
44
|
k.assign( k.mul( add( 0.5, noise( pos.mul( 2 ) ).mul( 1.5 ) ) ) );
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
} );
|
|
47
47
|
|
|
48
48
|
k.assign( k.add( mul( params.noise, noise( pos.mul( 150 ) ).abs().pow3() ) ) );
|
package/src/neon-lights.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { abs, exp, Fn, oneMinus, positionGeometry, select, sqrt, vec3 } from 'three/tsl';
|
|
8
|
-
import { hsl, noise, prepare, toHsl } from 'tsl-
|
|
8
|
+
import { hsl, noise, prepare, toHsl } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
package/src/photosphere.js
CHANGED
package/src/planet.js
CHANGED
package/src/polka-dots.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { acos, add, distance, exp, float, Fn, Loop, max, min, mix, mod, mul, oneMinus, positionGeometry, pow, smoothstep, } from 'three/tsl';
|
|
8
|
-
import { prepare, spherical } from 'tsl-
|
|
8
|
+
import { prepare, spherical } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -28,14 +28,14 @@ var polkaDots = Fn( ( params ) => {
|
|
|
28
28
|
var maxi = besti.add( span ).floor().clamp( 0, cnt );
|
|
29
29
|
|
|
30
30
|
var dist = float( 1 ).toVar();
|
|
31
|
-
Loop( maxi.sub( mini ), ( { i } )=> {
|
|
31
|
+
Loop( maxi.sub( mini ), ( { i } )=> {
|
|
32
32
|
|
|
33
33
|
var j = add( i, mini );
|
|
34
34
|
var theta = mod( mul( 2*Math.PI/goldenRatio, j ), 2*Math.PI );
|
|
35
35
|
var phi = acos( oneMinus( float( j ).mul( 2 ).add( 1 ).div( cnt ) ) );
|
|
36
36
|
var pnt = spherical( phi, theta );//.normalize();
|
|
37
37
|
dist.assign( min( dist, distance( vec, pnt ) ) );
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
} );
|
|
40
40
|
|
|
41
41
|
var size = exp( params.size.mul( 5 ).sub( 5 ) ).toVar();
|
package/src/processed-wood.js
CHANGED
package/src/protozoa.js
CHANGED
package/src/rotator.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Vector2, Vector3 } from "three";
|
|
7
7
|
import { cross, Fn, normalLocal, positionGeometry, sub, tangentLocal, transformNormalToView, vec4 } from 'three/tsl';
|
|
8
|
-
import { matRotYXZ, matTrans, prepare, selectPlanar } from 'tsl-
|
|
8
|
+
import { matRotYXZ, matTrans, prepare, selectPlanar } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
package/src/rough-clay.js
CHANGED
package/src/runny-eggs.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from 'three';
|
|
7
7
|
import { cross, exp, Fn, mix, mx_worley_noise_float, normalLocal, positionGeometry, sub, tangentLocal, transformNormalToView } from 'three/tsl';
|
|
8
|
-
import { prepare } from 'tsl-
|
|
8
|
+
import { prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
package/src/rust.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from 'three';
|
|
7
7
|
import { exp, Fn, Loop, mix, positionGeometry } from 'three/tsl';
|
|
8
|
-
import { noise, prepare } from 'tsl-
|
|
8
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -17,11 +17,11 @@ var _rust = Fn( ( params )=>{
|
|
|
17
17
|
|
|
18
18
|
var k = noise( pos ).toVar();
|
|
19
19
|
|
|
20
|
-
Loop( params.iterations, ()=>{
|
|
20
|
+
Loop( params.iterations, ()=>{
|
|
21
21
|
|
|
22
22
|
pos.mulAssign( 2 );
|
|
23
23
|
k.addAssign( noise( pos ) );
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
} );
|
|
26
26
|
|
|
27
27
|
k.subAssign( noise( pos.mul( 2 ) ).abs() );
|
package/src/satin.js
CHANGED
package/src/scaler.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Vector2, Vector3 } from "three";
|
|
7
7
|
import { cross, Fn, mix, normalLocal, positionGeometry, sub, tangentLocal, transformNormalToView, vec3, vec4 } from 'three/tsl';
|
|
8
|
-
import { matScale, matTrans, prepare, selectPlanar } from 'tsl-
|
|
8
|
+
import { matScale, matTrans, prepare, selectPlanar } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
package/src/scepter-head.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from "three";
|
|
7
7
|
import { abs, add, cos, floor, Fn, max, mix, mod, mul, positionGeometry, remapClamp, sign, tan, vec3 } from 'three/tsl';
|
|
8
|
-
import { hsl, noise, prepare, remapExp, toHsl } from 'tsl-
|
|
8
|
+
import { hsl, noise, prepare, remapExp, toHsl } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
package/src/scream.js
CHANGED
package/src/simplex-noise.js
CHANGED
package/src/stars.js
CHANGED
package/src/supersphere.js
CHANGED
package/src/tiger-fur.js
CHANGED
package/src/translator.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Vector2, Vector3 } from "three";
|
|
7
7
|
import { cross, Fn, normalLocal, positionGeometry, sub, tangentLocal, transformNormalToView, vec4 } from 'three/tsl';
|
|
8
|
-
import { matTrans, prepare, selectPlanar } from 'tsl-
|
|
8
|
+
import { matTrans, prepare, selectPlanar } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
package/src/voronoi-cells.js
CHANGED
package/src/water-drops.js
CHANGED
package/src/watermelon.js
CHANGED
package/src/wood.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Color } from 'three';
|
|
7
7
|
import { add, cos, exp, float, Fn, Loop, mix, mul, positionGeometry, radians, reciprocal, sin, sub, vec3 } from 'three/tsl';
|
|
8
|
-
import { noise, prepare } from 'tsl-
|
|
8
|
+
import { noise, prepare } from './tsl-utils.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
package/src/zebra-lines.js
CHANGED