@dailies-studio/tsl-textures 3.0.4
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/LICENSE +21 -0
- package/README.md +142 -0
- package/dist/cjs/tsl-textures.cjs +4749 -0
- package/dist/cjs/tsl-textures.min.cjs +2 -0
- package/dist/tsl-textures.js +4659 -0
- package/dist/tsl-textures.min.js +2 -0
- package/package.json +36 -0
- package/src/brain.js +116 -0
- package/src/bricks.js +116 -0
- package/src/camouflage.js +85 -0
- package/src/caustics.js +75 -0
- package/src/cave-art.js +83 -0
- package/src/circle-decor.js +76 -0
- package/src/circles.js +83 -0
- package/src/clouds.js +114 -0
- package/src/concrete.js +95 -0
- package/src/cork.js +104 -0
- package/src/crumpled-fabric.js +81 -0
- package/src/dalmatian-spots.js +80 -0
- package/src/darth-maul.js +84 -0
- package/src/dyson-sphere.js +144 -0
- package/src/entangled.js +75 -0
- package/src/fordite.js +69 -0
- package/src/gas-giant.js +94 -0
- package/src/grid.js +84 -0
- package/src/halftone.js +252 -0
- package/src/isolayers.js +79 -0
- package/src/isolines.js +72 -0
- package/src/karst-rock.js +67 -0
- package/src/marble.js +96 -0
- package/src/melter.js +76 -0
- package/src/neon-lights.js +107 -0
- package/src/perlin-noise.js +66 -0
- package/src/photosphere.js +73 -0
- package/src/planet.js +168 -0
- package/src/polka-dots.js +106 -0
- package/src/processed-wood.js +80 -0
- package/src/protozoa.js +110 -0
- package/src/reticular-veins.js +72 -0
- package/src/roman-paving.js +58 -0
- package/src/rotator.js +120 -0
- package/src/rough-clay.js +90 -0
- package/src/runny-eggs.js +180 -0
- package/src/rust.js +144 -0
- package/src/satin.js +69 -0
- package/src/scaler.js +111 -0
- package/src/scepter-head.js +94 -0
- package/src/scream.js +72 -0
- package/src/stars.js +72 -0
- package/src/static-noise.js +73 -0
- package/src/supersphere.js +108 -0
- package/src/tiger-fur.js +77 -0
- package/src/translator.js +116 -0
- package/src/tsl-textures.js +63 -0
- package/src/tsl-utils.js +344 -0
- package/src/turbulent-smoke.js +73 -0
- package/src/voronoi-cells.js +99 -0
- package/src/water-drops.js +96 -0
- package/src/watermelon.js +87 -0
- package/src/waves.js +150 -0
- package/src/wood.js +99 -0
- package/src/zebra-lines.js +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Pavel Boytchev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# tsl-textures
|
|
2
|
+
|
|
3
|
+
> This is a vendored fork of tsl-textures@3.0.4 (Pavel Boytchev, MIT) carrying the perlin-noise/static-noise clamp fix until it lands upstream: upstream calls `clamp(0, 1, k)`, but three's `clamp` signature is `(value, min, max)`, so the fix replaces it with `k.min(1)` in `perlinNoiseRaw` and `staticNoiseRaw`.
|
|
4
|
+
|
|
5
|
+
A collection of Three.js Shading Language (TSL) textures –
|
|
6
|
+
these are online real-time procedural generators of 3D textures.
|
|
7
|
+
|
|
8
|
+
Pick a texture from the [Project home page](https://boytchev.github.io/tsl-textures/).
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/planet/screenshot.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/planet/index.html)
|
|
12
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/normal-map/screenshot.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/normal-map/index.html)
|
|
13
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/wooden-toys/screenshot.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/wooden-toys/index.html)
|
|
14
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/protozoa/screenshot.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/protozoa/index.html)
|
|
15
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/neck-massage/screenshot.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/neck-massage/index.html)
|
|
16
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/watermelon/screenshot.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/watermelon/index.html)
|
|
17
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/texture-in-motion/screenshot.jpg" width="200">](https://boytchev.github.io/tsl-textures/examples/texture-in-motion/index.html)
|
|
18
|
+
|
|
19
|
+
<!--
|
|
20
|
+
#### Example "Planet"
|
|
21
|
+
|
|
22
|
+
Uses [planet.js](https://boytchev.github.io/tsl-textures/docs/planet.html)
|
|
23
|
+
for both the planet and its moon; and [stars.js](https://boytchev.github.io/tsl-textures/docs/stars.html)
|
|
24
|
+
for the stars. Click on the image for a live demo.
|
|
25
|
+
|
|
26
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-planet.jpg">](https://boytchev.github.io/tsl-textures/examples/example-planet.html)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
#### Example "Normal map"
|
|
30
|
+
|
|
31
|
+
Uses tsl-utils.js to generate two normal maps and the transition between them.
|
|
32
|
+
The normal are created directly without using any of the TSL texture generators.
|
|
33
|
+
Click on the image for a live demo.
|
|
34
|
+
|
|
35
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-normal-map.jpg">](https://boytchev.github.io/tsl-textures/examples/example-normal-map.html)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#### Example "Wooden toys"
|
|
39
|
+
|
|
40
|
+
Uses [wood.js](https://boytchev.github.io/tsl-textures/docs/wood.html) texture
|
|
41
|
+
to convert flat-color 3D models (an ambulance, a race car and a luxury SUV from
|
|
42
|
+
Car Kit (1.4) by Kenney [www.kenney.nl](https://www.kenney.nl/)) into wooden toys.
|
|
43
|
+
All the wood textures are procedurally generated in real-time. Click on the image
|
|
44
|
+
for a live demo. (Note: non-WebGPU browsers might need 30+ seconds to start up.)
|
|
45
|
+
|
|
46
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-wooden-toys.jpg">](https://boytchev.github.io/tsl-textures/examples/example-wooden-toys.html)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
#### Example "Protozoa"
|
|
50
|
+
|
|
51
|
+
Uses [protozoa.js](https://boytchev.github.io/tsl-textures/docs/protozoa.html)
|
|
52
|
+
texture to create a dynamic blob with microorganisms floating innside. A space
|
|
53
|
+
station is constructed arounnd the blob. The surface of the station is made of
|
|
54
|
+
a Dyson sphere texture from [dyson-texture.js](https://boytchev.github.io/tsl-textures/docs/dyson-sphere.html).
|
|
55
|
+
Click on the image for a live demo.
|
|
56
|
+
|
|
57
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-protozoa.jpg">](https://boytchev.github.io/tsl-textures/examples/example-protozoa.html)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
#### Example "Neck massage"
|
|
61
|
+
|
|
62
|
+
Uses [rotator.js](https://boytchev.github.io/tsl-textures/docs/rotator.html)
|
|
63
|
+
texture that applies soft matrices on model vertices. This allows to make
|
|
64
|
+
gradual rotation that looks like stretching skin and flexing muscles. The
|
|
65
|
+
animation does not use skinning or morphing, the model is not preprocessed
|
|
66
|
+
in any way, and no additional vertex data is added. Click on the image
|
|
67
|
+
for a live demo.
|
|
68
|
+
|
|
69
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-neck-massage.jpg">](https://boytchev.github.io/tsl-textures/examples/example-neck-massage.html)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
#### Example "Watermelon supersphere"
|
|
73
|
+
|
|
74
|
+
Uses [supersphere.js](https://boytchev.github.io/tsl-textures/docs/supersphere.html)
|
|
75
|
+
texture to generate the shape of a [supersphere](https://mathworld.wolfram.com/Supersphere.html)
|
|
76
|
+
and [watermelon.js](https://boytchev.github.io/tsl-textures/docs/watermelon.html)
|
|
77
|
+
texture to color the surface in a watermelon pattern. Both the shape and the pattern
|
|
78
|
+
are continuously changing. Click on the image for a live demo.
|
|
79
|
+
|
|
80
|
+
[<img src="https://boytchev.github.io/tsl-textures/examples/example-watermelon-supersphere.jpg">](https://boytchev.github.io/tsl-textures/examples/example-watermelon-supersphere.html)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
#### Example "Texture in motion"
|
|
84
|
+
|
|
85
|
+
Uses [dyson-sphere.js](https://boytchev.github.io/tsl-textures/docs/dyson-sphere.html),
|
|
86
|
+
[camouflage.js](https://boytchev.github.io/tsl-textures/docs/camouflage.html),
|
|
87
|
+
[dalmatian-spots.js](https://boytchev.github.io/tsl-textures/docs/dalmatian-spots.html) and
|
|
88
|
+
[planet.js](https://boytchev.github.io/tsl-textures/docs/planet.html) textures
|
|
89
|
+
and applies them on the elements of an animated GLTF model. Textures are blended
|
|
90
|
+
via a TSL function. Click on the image for a live demo. (Note: non-WebGPU browsers
|
|
91
|
+
might need 30+ seconds to start up.)
|
|
92
|
+
|
|
93
|
+
[<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)
|
|
94
|
+
-->
|
|
95
|
+
|
|
96
|
+
## Usage
|
|
97
|
+
|
|
98
|
+
### Use with NPM
|
|
99
|
+
|
|
100
|
+
**Install**
|
|
101
|
+
```bat
|
|
102
|
+
npm install three tsl-textures
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Use in a javascript file**
|
|
106
|
+
```js
|
|
107
|
+
// Important: Use `webgpu` version of Three.js
|
|
108
|
+
import * as THREE from 'three/webgpu';
|
|
109
|
+
|
|
110
|
+
// Import your desired texture
|
|
111
|
+
import { polkaDots } from 'tsl-textures/polka-dots';
|
|
112
|
+
|
|
113
|
+
// Create the renderer. Important: Use `WebGPURenderer`
|
|
114
|
+
renderer = new THREE.WebGPURenderer({antialias: true});
|
|
115
|
+
|
|
116
|
+
// ... Create your Three.js scene, camera, lights, etc.
|
|
117
|
+
|
|
118
|
+
// Create geometry
|
|
119
|
+
const objectGeometry = new THREE.IcosahedronGeometry(1, 12)
|
|
120
|
+
|
|
121
|
+
// Create material: Important: Use `Node` Material
|
|
122
|
+
objectMaterial = new THREE.MeshStandardNodeMaterial({
|
|
123
|
+
color: 0xCCCCCC,
|
|
124
|
+
roughness: 0.5,
|
|
125
|
+
metalness: 0.0,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Apply texture to the material's `colorNode` property
|
|
129
|
+
objectMaterial.colorNode = polkaDots ( {
|
|
130
|
+
count: 2,
|
|
131
|
+
size: 0.6,
|
|
132
|
+
blur: 0.22,
|
|
133
|
+
color: new THREE.Color(0),
|
|
134
|
+
background: new THREE.Color(16777215)
|
|
135
|
+
} );
|
|
136
|
+
|
|
137
|
+
// Assign Geometry and Material to a Mesh
|
|
138
|
+
object = new THREE.Mesh(objectGeometry, objectMaterial);
|
|
139
|
+
|
|
140
|
+
// Render
|
|
141
|
+
renderer.render( scene, camera );
|
|
142
|
+
```
|