@react-three/drei 8.19.5 → 9.0.0-beta.3

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.
Files changed (139) hide show
  1. package/README.md +62 -329
  2. package/core/ArcballControls.cjs.js +1 -1
  3. package/core/ArcballControls.js +27 -18
  4. package/core/Billboard.d.ts +2 -2
  5. package/core/Bounds.cjs.js +1 -1
  6. package/core/Bounds.d.ts +1 -2
  7. package/core/Bounds.js +15 -26
  8. package/core/Center.d.ts +1 -1
  9. package/core/Cloud.cjs.js +1 -1
  10. package/core/Cloud.d.ts +1 -3
  11. package/core/Cloud.js +1 -4
  12. package/core/ContactShadows.cjs.js +1 -1
  13. package/core/ContactShadows.d.ts +1 -3
  14. package/core/ContactShadows.js +2 -15
  15. package/core/CubeCamera.cjs.js +1 -1
  16. package/core/CubeCamera.js +7 -7
  17. package/core/Detailed.d.ts +2 -2
  18. package/core/DeviceOrientationControls.cjs.js +1 -1
  19. package/core/DeviceOrientationControls.d.ts +1 -1
  20. package/core/DeviceOrientationControls.js +6 -2
  21. package/core/Effects.cjs.js +1 -1
  22. package/core/Effects.d.ts +2 -2
  23. package/core/Effects.js +2 -2
  24. package/core/Environment.cjs.js +1 -1
  25. package/core/Environment.d.ts +3 -13
  26. package/core/Environment.js +30 -95
  27. package/core/FirstPersonControls.cjs.js +1 -1
  28. package/core/FirstPersonControls.d.ts +1 -1
  29. package/core/FirstPersonControls.js +6 -2
  30. package/core/Float.cjs.js +1 -1
  31. package/core/Float.d.ts +1 -1
  32. package/core/Float.js +4 -5
  33. package/core/FlyControls.d.ts +1 -1
  34. package/core/GizmoHelper.cjs.js +1 -1
  35. package/core/GizmoHelper.d.ts +1 -2
  36. package/core/GizmoHelper.js +41 -31
  37. package/core/GizmoViewcube.cjs.js +1 -1
  38. package/core/GizmoViewcube.d.ts +2 -2
  39. package/core/GizmoViewcube.js +1 -1
  40. package/core/GizmoViewport.d.ts +2 -2
  41. package/core/Image.cjs.js +1 -1
  42. package/core/Image.d.ts +2 -4
  43. package/core/Image.js +1 -6
  44. package/core/Instances.cjs.js +1 -1
  45. package/core/Instances.d.ts +3 -3
  46. package/core/Instances.js +11 -5
  47. package/core/Line.d.ts +1 -1
  48. package/core/MapControls.d.ts +1 -1
  49. package/core/MeshDistortMaterial.d.ts +2 -4
  50. package/core/MeshReflectorMaterial.cjs.js +1 -1
  51. package/core/MeshReflectorMaterial.d.ts +2 -1
  52. package/core/MeshReflectorMaterial.js +5 -4
  53. package/core/MeshWobbleMaterial.d.ts +2 -4
  54. package/core/OrbitControls.cjs.js +1 -1
  55. package/core/OrbitControls.js +33 -23
  56. package/core/OrthographicCamera.d.ts +2 -2
  57. package/core/PerspectiveCamera.d.ts +2 -2
  58. package/core/PointMaterial.cjs.js +1 -1
  59. package/core/PointMaterial.d.ts +7 -3
  60. package/core/PointMaterial.js +32 -14
  61. package/core/PointerLockControls.cjs.js +1 -1
  62. package/core/PointerLockControls.d.ts +1 -3
  63. package/core/PointerLockControls.js +22 -36
  64. package/core/Points.cjs.js +1 -1
  65. package/core/Points.d.ts +3 -3
  66. package/core/Points.js +36 -17
  67. package/core/PositionalAudio.d.ts +2 -2
  68. package/core/Reflector.d.ts +1 -1
  69. package/core/RoundedBox.d.ts +1 -1
  70. package/core/ScreenQuad.d.ts +1 -1
  71. package/core/Segments.d.ts +1 -1
  72. package/core/Shadow.d.ts +2 -2
  73. package/core/SpotLight.d.ts +20 -4
  74. package/core/Stage.cjs.js +1 -1
  75. package/core/Stage.js +2 -1
  76. package/core/Stars.cjs.js +1 -1
  77. package/core/Stars.js +3 -6
  78. package/core/Text.cjs.js +1 -1
  79. package/core/Text.d.ts +2 -3
  80. package/core/Text.js +2 -3
  81. package/core/TrackballControls.cjs.js +1 -1
  82. package/core/TrackballControls.d.ts +1 -1
  83. package/core/TrackballControls.js +7 -12
  84. package/core/TransformControls.cjs.js +1 -1
  85. package/core/TransformControls.d.ts +1 -1
  86. package/core/TransformControls.js +13 -7
  87. package/core/index.cjs.js +1 -1
  88. package/core/index.d.ts +0 -6
  89. package/core/index.js +2 -9
  90. package/core/shapes.d.ts +17 -17
  91. package/core/useFBO.cjs.js +1 -1
  92. package/core/useFBO.d.ts +1 -1
  93. package/core/useFBO.js +24 -21
  94. package/core/useFBX.d.ts +1 -1
  95. package/core/useFBX.js +1 -2
  96. package/core/useGLTF.d.ts +1 -1
  97. package/core/useGLTF.js +1 -2
  98. package/core/useHelper.d.ts +1 -3
  99. package/core/useKTX2.d.ts +1 -1
  100. package/core/useKTX2.js +1 -2
  101. package/core/useTexture.d.ts +1 -1
  102. package/core/useTexture.js +1 -2
  103. package/index.cjs.js +1 -1
  104. package/index.js +1 -7
  105. package/materials/ConvolutionMaterial.cjs.js +1 -1
  106. package/materials/ConvolutionMaterial.js +0 -2
  107. package/materials/MeshReflectorMaterial.cjs.js +1 -1
  108. package/materials/MeshReflectorMaterial.d.ts +3 -0
  109. package/materials/MeshReflectorMaterial.js +27 -1
  110. package/materials/SpotLightMaterial.cjs.js +1 -1
  111. package/materials/SpotLightMaterial.js +0 -3
  112. package/native/index.cjs.js +1 -1
  113. package/native/index.js +2 -9
  114. package/package.json +8 -9
  115. package/web/Html.cjs.js +1 -1
  116. package/web/Html.js +7 -6
  117. package/web/ScrollControls.cjs.js +1 -1
  118. package/web/ScrollControls.js +5 -4
  119. package/web/Select.js +0 -1
  120. package/web/index.cjs.js +1 -1
  121. package/web/index.js +3 -10
  122. package/core/Clone.cjs.js +0 -1
  123. package/core/Clone.d.ts +0 -11
  124. package/core/Clone.js +0 -92
  125. package/core/ComputedAttribute.cjs.js +0 -1
  126. package/core/ComputedAttribute.d.ts +0 -9
  127. package/core/ComputedAttribute.js +0 -34
  128. package/core/Lightformer.cjs.js +0 -1
  129. package/core/Lightformer.d.ts +0 -41
  130. package/core/Lightformer.js +0 -51
  131. package/core/Sampler.cjs.js +0 -1
  132. package/core/Sampler.d.ts +0 -21
  133. package/core/Sampler.js +0 -65
  134. package/core/Trail.cjs.js +0 -1
  135. package/core/Trail.d.ts +0 -20
  136. package/core/Trail.js +0 -160
  137. package/core/useBoxProjectedEnv.cjs.js +0 -1
  138. package/core/useBoxProjectedEnv.d.ts +0 -8
  139. package/core/useBoxProjectedEnv.js +0 -98
package/README.md CHANGED
@@ -4,13 +4,13 @@
4
4
  [![Downloads](https://img.shields.io/npm/dt/@react-three/drei.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/@react-three/drei)
5
5
  [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/poimandres)
6
6
 
7
- A growing collection of useful helpers and fully functional, ready-made abstractions for [react-three-fiber](https://github.com/pmndrs/react-three-fiber). If you make a component that is generic enough to be useful to others, think about making it available here through a PR!
7
+ A growing collection of useful helpers and fully functional, ready-made abstractions for [@react-three/fiber](https://github.com/pmndrs/react-three-fiber). If you make a component that is generic enough to be useful to others, think about making it available here through a PR!
8
8
 
9
9
  ```bash
10
10
  npm install @react-three/drei
11
11
  ```
12
12
 
13
- :point_right: this package is using the stand-alone [`three-stdlib`](https://github.com/pmndrs/three-stdlib) instead of [`three/examples/jsm`](https://github.com/mrdoob/three.js/tree/dev/examples/jsm). :point_left:
13
+ :point_right: this package is using the stand-alone [`three-stdlib`](https://github.com/pmndrs/three-stdlib) instead of [`three/examples/jsm`](https://github.com/mrdoob/three.js/tree/master/examples/jsm). :point_left:
14
14
 
15
15
  ### Basic usage:
16
16
 
@@ -65,10 +65,6 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
65
65
  <li><a href="#effects">Effects</a></li>
66
66
  <li><a href="#gradienttexture">GradientTexture</a></li>
67
67
  <li><a href="#edges">Edges</a></li>
68
- <li><a href="#trail">Trail</a></li>
69
- <li><a href="#sampler">Sampler</a></li>
70
- <li><a href="#computedattribute">Computed Attribute</a></li>
71
- <li><a href="#clone">Clone</a></li>
72
68
  <li><a href="#useanimations">useAnimations</a></li>
73
69
  </ul>
74
70
  <li><a href="#shaders">Shaders</a></li>
@@ -103,8 +99,6 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
103
99
  <li><a href="#useaspect">useAspect</a></li>
104
100
  <li><a href="#usecursor">useCursor</a></li>
105
101
  <li><a href="#useintersect">useIntersect</a></li>
106
- <li><a href="#useboxprojectedenv">useBoxProjectedEnv</a></li>
107
- <li><a href="#useTrail">useTrail</a></li>
108
102
  </ul>
109
103
  <li><a href="#loading">Loaders</a></li>
110
104
  <ul>
@@ -165,7 +159,6 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
165
159
  <li><a href="#stage">Stage</a></li>
166
160
  <li><a href="#backdrop">Backdrop</a></li>
167
161
  <li><a href="#environment">Environment</a></li>
168
- <li><a href="#lightformer">Lightformer</a></li>
169
162
  <li><a href="#spotlight">SpotLight</a></li>
170
163
  <li><a href="#shadow">Shadow</a></li>
171
164
  <li><a href="#contactshadows">ContactShadows</a></li>
@@ -186,7 +179,7 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
186
179
 
187
180
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/camera-perspectivecamera--perspective-camera-scene-st)
188
181
 
189
- A responsive [THREE.PerspectiveCamera](https://threejs.org/docs/index.html#api/en/cameras/PerspectiveCamera) that can set itself as the default.
182
+ A responsive [THREE.PerspectiveCamera](https://threejs.org/docs/#api/en/cameras/PerspectiveCamera) that can set itself as the default.
190
183
 
191
184
  ```jsx
192
185
  <PerspectiveCamera makeDefault {...props} />
@@ -211,7 +204,7 @@ You can also drive it manually, it won't be responsive and you have to calculate
211
204
 
212
205
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/camera-orthographiccamera--orthographic-camera-scene-st)
213
206
 
214
- A responsive [THREE.OrthographicCamera](https://threejs.org/docs/index.html#api/en/cameras/OrthographicCamera) that can set itself as the default.
207
+ A responsive [THREE.OrthographicCamera](https://threejs.org/docs/#api/en/cameras/OrthographicCamera) that can set itself as the default.
215
208
 
216
209
  ```jsx
217
210
  <OrthographicCamera makeDefault {...props}>
@@ -223,7 +216,7 @@ A responsive [THREE.OrthographicCamera](https://threejs.org/docs/index.html#api/
223
216
 
224
217
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/camera-cubecamera--default-story)
225
218
 
226
- A [THREE.CubeCamera](https://threejs.org/docs/index.html#api/en/cameras/CubeCamera) that returns its texture as a render-prop. It makes children invisible while rendering to the internal buffer so that they are not included in the reflection.
219
+ A [THREE.CubeCamera](https://threejs.org/docs/#api/en/cameras/CubeCamera) that returns its texture as a render-prop. It makes children invisible while rendering to the internal buffer so that they are not included in the reflection.
227
220
 
228
221
  Using the `frames` prop you can control if this camera renders indefinitively or statically (a given number of times).
229
222
  If you have two static objects in the scene, make it `frames={2}` for instance, so that both objects get to "see" one another in the reflections, which takes multiple renders.
@@ -242,15 +235,15 @@ If you have moving objects, unset the prop and use a smaller `resolution` instea
242
235
 
243
236
  # Controls
244
237
 
245
- If available controls have damping enabled by default, they manage their own updates, remove themselves on unmount, are compatible with the `invalidateFrameloop` canvas-flag. They inherit all props from their underlying [THREE controls](https://github.com/mrdoob/three.js/tree/dev/examples/jsm/controls).
238
+ If available controls have damping enabled by default, they manage their own updates, remove themselves on unmount, are compatible with the `invalidateFrameloop` canvas-flag. They inherit all props from their underlying [THREE controls](https://github.com/mrdoob/three.js/tree/master/examples/jsm/controls).
246
239
 
247
- Some controls allow you to set `makeDefault`, similar to, for instance, PerspectiveCamera. This will set react-three-fiber's `controls` field in the root store. This can make it easier in situations where you want controls to be known and other parts of the app could respond to it. Some drei controls already take it into account, like CameraShake, Gizmo and TransformControls.
240
+ Some controls allow you to set `makeDefault`, similar to, for instance, PerspectiveCamera. This will set @react-three/fiber's `controls` field in the root store. This can make it easier in situations where you want controls to be known and other parts of the app could respond to it. Some drei controls already take it into account, like CameraShake, Gizmo and TransformControls.
248
241
 
249
242
  Drei currently exports OrbitControls [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/controls-orbitcontrols--orbit-controls-story), MapControls [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/controls-mapcontrols--map-controls-scene-st), TrackballControls, ArcballControls, FlyControls, DeviceOrientationControls, PointerLockControls [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/controls-pointerlockcontrols--pointer-lock-controls-scene-st), FirstPersonControls [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/controls-firstpersoncontrols--first-person-controls-story)
250
243
 
251
244
  All controls react to the default camera. If you have a `<PerspectiveCamera makeDefault />` in your scene, they will control it. If you need to inject an imperative camera or one that isn't the default, use the `camera` prop: `<OrbitControls camera={MyCamera} />`.
252
245
 
253
- PointerLockControls additionally supports a `selector` prop, which enables the binding of `click` event handlers for control activation to other elements than `document` (e.g. a 'Click here to play' button). All elements matching the `selector` prop will activate the controls. It will also center raycast events by default, so regular onPointerOver/etc events on meshes will continue to work.
246
+ PointerLockControls additionally supports a `selector` prop, which enables the binding of `click` event handlers for control activation to other elements than `document` (e.g. a 'Click here to play' button). All elements matching the `selector` prop will activate the controls.
254
247
 
255
248
  # TransformControls
256
249
 
@@ -260,7 +253,7 @@ PointerLockControls additionally supports a `selector` prop, which enables the b
260
253
  <a href="https://codesandbox.io/s/btsbj"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/btsbj/screenshot.png" alt="Tranform controls"/></a>
261
254
  </p>
262
255
 
263
- An abstraction around [THREE.TransformControls](https://threejs.org/docs/index.html?q=transfor#examples/en/controls/TransformControls).
256
+ An abstraction around [THREE.TransformControls](https://threejs.org/docs/#examples/en/controls/TransformControls).
264
257
 
265
258
  You can wrap objects which then receive a transform gizmo.
266
259
 
@@ -371,7 +364,7 @@ Semi-OrbitControls with spring-physics, polar zoom and snap-back, for presentati
371
364
  rotation={[0, 0, 0]} // Default rotation
372
365
  polar={[0, Math.PI / 2]} // Vertical limits
373
366
  azimuth={[-Infinity, Infinity]} // Horizontal limits
374
- config={{ mass: 1, tension: 170, friction: 26 }} // Spring config
367
+ config = { mass: 1, tension: 170, friction: 26 } // Spring config
375
368
  >
376
369
  <mesh />
377
370
  </PresentationControls>
@@ -379,12 +372,12 @@ Semi-OrbitControls with spring-physics, polar zoom and snap-back, for presentati
379
372
 
380
373
  # Shapes
381
374
 
382
- [Buffer-geometry](https://threejs.org/docs/index.html#api/en/core/BufferGeometry) short-cuts for Plane, Box, Sphere, Circle, Cone, Cylinder, Tube, Torus, TorusKnot, Ring, Tetrahedron, Polyhedron, Icosahedron, Octahedron, Dodecahedron, Extrude, Lathe.
375
+ [Buffer-geometry](https://threejs.org/docs/#api/en/core/BufferGeometry) short-cuts for Plane, Box, Sphere, Circle, Cone, Cylinder, Tube, Torus, TorusKnot, Ring, Tetrahedron, Polyhedron, Icosahedron, Octahedron, Dodecahedron, Extrude, Lathe.
383
376
 
384
377
  ```jsx
385
378
  <Plane args={[2, 2]} />
386
379
  <Sphere>
387
- <meshBasicMaterial attach="material" color="hotpink" />
380
+ <meshBasicMaterial color="hotpink" />
388
381
  </Sphere>
389
382
  ```
390
383
 
@@ -394,7 +387,7 @@ A box buffer geometry with rounded corners, done with extrusion.
394
387
 
395
388
  ```jsx
396
389
  <RoundedBox args={[1, 1, 1]} radius={0.05} smoothness={4} {...meshProps}>
397
- <meshPhongMaterial attach="material" color="#f3f3f3" wireframe />
390
+ <meshPhongMaterial color="#f3f3f3" wireframe />
398
391
  </RoundedBox>
399
392
  ```
400
393
 
@@ -442,7 +435,7 @@ function Foo() {
442
435
  <a href="https://codesandbox.io/s/yup2o"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/yup2o/screenshot.png" alt="Demo"/></a>
443
436
  </p>
444
437
 
445
- Hi-quality text rendering w/ signed distance fields (SDF) and antialiasing, using [troika-3d-text](https://github.com/protectwise/troika/tree/master/packages/troika-3d-text). All of troikas props are valid!
438
+ Hi-quality text rendering w/ signed distance fields (SDF) and antialiasing, using [troika-3d-text](https://github.com/protectwise/troika/tree/master/packages/troika-3d-text). All of troikas props are valid! Text is suspense-based!
446
439
 
447
440
  ```jsx
448
441
  <Text color="black" anchorX="center" anchorY="middle">
@@ -450,14 +443,6 @@ Hi-quality text rendering w/ signed distance fields (SDF) and antialiasing, usin
450
443
  </Text>
451
444
  ```
452
445
 
453
- Text will suspend while loading the font data, but in order to completely avoid FOUC you can pass the characters it needs to render.
454
-
455
- ```jsx
456
- <Text font={fontUrl} characters="abcdefghijklmnopqrstuvwxyz0123456789!">
457
- hello world!
458
- </Text>
459
- ```
460
-
461
446
  #### Line
462
447
 
463
448
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/abstractions-line--basic-line)
@@ -544,7 +529,7 @@ Renders a THREE.Line2 using THREE.CubicBezierCurve3 for interpolation.
544
529
 
545
530
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/abstractions-positionalaudio--positional-audio-scene-st) ![](https://img.shields.io/badge/-suspense-brightgreen)
546
531
 
547
- A wrapper around [THREE.PositionalAudio](https://threejs.org/docs/index.html#api/en/audio/PositionalAudio). Add this to groups or meshes to tie them to a sound that plays when the camera comes near.
532
+ A wrapper around [THREE.PositionalAudio](https://threejs.org/docs/#api/en/audio/PositionalAudio). Add this to groups or meshes to tie them to a sound that plays when the camera comes near.
548
533
 
549
534
  ```jsx
550
535
  <PositionalAudio
@@ -597,11 +582,11 @@ Make sure to set the `makeDefault` prop on your controls, in that case you do no
597
582
 
598
583
  #### Effects
599
584
 
600
- Abstraction around threes own [EffectComposer](https://threejs.org/docs/index.html#examples/en/postprocessing/EffectComposer).
585
+ Abstraction around threes own [EffectComposer](https://threejs.org/docs/#examples/en/postprocessing/EffectComposer).
601
586
 
602
587
  ```jsx
603
588
  <Effects multisamping={8} renderIndex={1} disableGamma={false} disableRenderPass={false}>
604
- <lUTPass attachArray="passes" lut={texture3D} />
589
+ <lUTPass attach="passes" lut={texture3D} />
605
590
  </Effects>
606
591
  ```
607
592
 
@@ -632,7 +617,7 @@ A declarative THREE.Texture which attaches to "map" by default. You can use this
632
617
  <a href="https://codesandbox.io/s/ny3p4"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/ny3p4/screenshot.png" alt="Demo"/></a>
633
618
  </p>
634
619
 
635
- Abstracts [THREE.EdgesGeometry](https://threejs.org/docs/index.html?q=EdgesGeometry#api/en/geometries/EdgesGeometry). It pulls the geometry automatically from its parent, optionally you can ungroup it and give it a `geometry` prop. You can give it children, for instance a custom material.
620
+ Abstracts [THREE.EdgesGeometry](https://threejs.org/docs/#api/en/geometries/EdgesGeometry). It pulls the geometry automatically from its parent, optionally you can ungroup it and give it a `geometry` prop. You can give it children, for instance a custom material.
636
621
 
637
622
  ```jsx
638
623
  <mesh>
@@ -646,166 +631,6 @@ Abstracts [THREE.EdgesGeometry](https://threejs.org/docs/index.html?q=EdgesGeome
646
631
  </mesh>
647
632
  ```
648
633
 
649
- #### Trail
650
-
651
- [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/misc-trail--use-trail-st)
652
-
653
- A declarative, `three.MeshLine` based Trails implementation. You can attach it to any mesh and it will give it a beautiful trail.
654
-
655
- Props defined bellow with their default values.
656
-
657
- ```jsx
658
- <Trail
659
- width={0.2} // Width of the line
660
- color={'hotpink'} // Color of the line
661
- length={1} // Length of the line
662
- decay={1} // How fast the line fades away
663
- local={false} // Wether to use the target's world or local positions
664
- stride={0} // Min distance between previous and current point
665
- interval={1} // Number of frames to wait before next calculation
666
- target={undefined} // Optional target. This object will produce the trail.
667
- attenuation={(width) => width} // A function to define the width in each point along it.
668
- >
669
- {/* If `target` is not defined, Trail will use the first `Object3D` child as the target. */}
670
- <mesh>
671
- <sphereGeometry />
672
- <meshBasicMaterial />
673
- </mesh>
674
-
675
- {/* You can optionally define a custom meshLineMaterial to use. */}
676
- {/* <meshLineMaterial color={"red"} /> */}
677
- </Trail>
678
- ```
679
-
680
- 👉 Inspired by [TheSpite's Codevember 2021 #9](https://spite.github.io/codevember-2021/9/)
681
-
682
- #### Sampler
683
-
684
- [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/misc-sampler--sampler-st)
685
-
686
- <p>
687
- <a href="https://codesandbox.io/s/ehflx3">
688
- <img width="20%" src="https://codesandbox.io/api/v1/sandboxes/ehflx3/screenshot.png" alt="Demo"/>
689
- </a> <br />
690
- <small>– <a href="https://codesandbox.io/s/ehflx3">Complex Demo</a> by <a href="https://twitter.com/CantBeFaraz">@CantBeFaraz</a></small> <br />
691
- <small>– <a href="https://codesandbox.io/s/k6rcp2">Simple Demo</a> by <a href="https://twitter.com/ggsimm">@ggsimm</a></small>
692
- </p>
693
-
694
- Declarative abstraction around MeshSurfaceSampler & InstancedMesh.
695
- It samples points from the passed mesh and transforms an InstancedMesh's matrix to distribute instances on the points.
696
-
697
- Check the demos & code for more.
698
-
699
- You can either pass a Mesh and InstancedMesh as children:
700
-
701
- ```tsx
702
- // This simple example scatters 1000 spheres on the surface of the sphere mesh.
703
- <Sampler
704
- weight={"normal"} // the name of the attribute to be used as sampling weight
705
- transform={transformPoint} // a function that transforms each instance given a sample. See the examples for more.
706
- >
707
- <mesh>
708
- <sphereGeometry args={[2]} />
709
- </mesh>
710
-
711
- <instancedMesh args={[null, null, 1_000]}>
712
- <sphereGeometry args={[0.1]}>
713
- </instancedMesh>
714
- </Sampler>
715
- ```
716
-
717
- or use refs when you can't compose declaratively:
718
-
719
- ```tsx
720
- const { nodes } = useGLTF('my/mesh/url')
721
- const mesh = useRef(nodes)
722
- const instances = useRef()
723
-
724
- return <>
725
- <instancedMesh args={[null, null, 1_000]}>
726
- <sphereGeometry args={[0.1]}>
727
- </instancedMesh>
728
-
729
- <Sampler mesh={mesh} instances={instances}>
730
- </>
731
- ```
732
-
733
- #### ComputedAttribute
734
-
735
- [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/misc-sampler--sampler-weight-st)
736
-
737
- Create and attach an attribute declaratively.
738
-
739
- ```tsx
740
- <sphereGeometry>
741
- <ComputedAttribute
742
- // attribute will be added to the geometry with this name
743
- name="my-attribute-name"
744
- compute={(geometry) => {
745
- // ...someLogic;
746
- return new THREE.BufferAttribute([1, 2, 3], 1)
747
- }}
748
- // you can pass any BufferAttribute prop to this component, eg.
749
- usage={THREE.StaticReadUsage}
750
- />
751
- </sphereGeometry>
752
- ```
753
-
754
- #### Clone
755
-
756
- <p>
757
- <a href="https://codesandbox.io/s/42glz0"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/42glz0/screenshot.png" alt="Demo"/></a>
758
- </p>
759
-
760
- Declarative abstraction around THREE.Object3D.clone. This is useful when you want to create a shallow copy of an existing fragment (and Object3D, Groups, etc) into your scene, for instance a group from a loaded GLTF. This clone is now re-usable, but it will still refer to the original geometries and materials.
761
-
762
- ```ts
763
- <Clone
764
- /** Any pre-existing THREE.Object3D (groups, meshes, ...), or an array of objects */
765
- object: THREE.Object3D | THREE.Object3D[]
766
- /** Children will be placed within the object, or within the group that holds arrayed objects */
767
- children?: React.ReactNode
768
- /** Can clone materials and/or geometries deeply (default: false) */
769
- deep?: boolean | 'materialsOnly' | 'geometriesOnly'
770
- /** The property keys it will shallow-clone (material, geometry, visible, ...) */
771
- keys?: string[]
772
- /** Can either spread over props or fill in JSX children, applies to every mesh within */
773
- inject?: MeshProps | React.ReactNode | ((object: THREE.Object3D) => React.ReactNode)
774
- /** Short access castShadow, applied to every mesh within */
775
- castShadow?: boolean
776
- /** Short access receiveShadow, applied to every mesh within */
777
- receiveShadow?: boolean
778
- />
779
- ```
780
-
781
- You create a shallow clone by passing a pre-existing object to the `object` prop.
782
-
783
- ```jsx
784
- const { nodes } = useGLTF(url)
785
- return (
786
- <Clone object={nodes.table} />
787
- ```
788
-
789
- Or, multiple objects:
790
-
791
- ```jsx
792
- <Clone object={[nodes.foo, nodes.bar]} />
793
- ```
794
-
795
- You can dynamically insert objects, these will apply to anything that isn't a group or a plain object3d (meshes, lines, etc):
796
-
797
- ```jsx
798
- <Clone object={nodes.table} inject={<meshStandardMaterial color="green" />} />
799
- ```
800
-
801
- Or make inserts conditional:
802
-
803
- ```jsx
804
- <Clone object={nodes.table} inject={
805
- {(object) => (object.name === 'table' ? <meshStandardMaterial color="green" /> : null)}
806
- } />
807
- ```
808
-
809
634
  #### useAnimations
810
635
 
811
636
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/abstractions-useanimations--use-animations-st)
@@ -814,7 +639,7 @@ Or make inserts conditional:
814
639
  <a href="https://codesandbox.io/s/pecl6"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/pecl6/screenshot.png" alt="Demo"/></a>
815
640
  </p>
816
641
 
817
- A hook that abstracts [AnimationMixer](https://threejs.org/docs/index.html#api/en/animation/AnimationMixer).
642
+ A hook that abstracts [AnimationMixer](https://threejs.org/docs/#api/en/animation/AnimationMixer).
818
643
 
819
644
  ```jsx
820
645
  const { nodes, materials, animations } = useGLTF(url)
@@ -845,7 +670,7 @@ return <primitive object={scene} />
845
670
  <a href="https://codesandbox.io/s/l900i"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/l900i/screenshot.png" alt="Demo"/></a>
846
671
  </p>
847
672
 
848
- Easily add reflections and/or blur to any mesh. It takes surface roughness into account for a more realistic effect. This material extends from [THREE.MeshStandardMaterial](https://threejs.org/docs/index.html?q=meshsta#api/en/materials/MeshStandardMaterial) and accepts all its props.
673
+ Easily add reflections and/or blur to any mesh. It takes surface roughness into account for a more realistic effect. This material extends from [THREE.MeshStandardMaterial](https://threejs.org/docs/#api/en/materials/MeshStandardMaterial) and accepts all its props.
849
674
 
850
675
  ```jsx
851
676
  <mesh>
@@ -883,8 +708,8 @@ This material makes your geometry wobble and wave around. It was taken from the
883
708
 
884
709
  ```jsx
885
710
  <mesh>
886
- <boxBufferGeometry attach="geometry" />
887
- <MeshWobbleMaterial attach="material" factor={1} speed={10} />
711
+ <boxGeometry />
712
+ <MeshWobbleMaterial factor={1} speed={10} />
888
713
  </mesh>
889
714
  ```
890
715
 
@@ -900,14 +725,14 @@ This material makes your geometry distort following simplex noise.
900
725
 
901
726
  ```jsx
902
727
  <mesh>
903
- <boxBufferGeometry attach="geometry" />
904
- <MeshDistortMaterial attach="material" distort={1} speed={10} />
728
+ <boxGeometry />
729
+ <MeshDistortMaterial distort={1} speed={10} />
905
730
  </mesh>
906
731
  ```
907
732
 
908
733
  #### PointMaterial
909
734
 
910
- Antialiased round dots. It takes the same props as regular THREE.PointsMaterial
735
+ An antialiased round dot that always keeps the same size.
911
736
 
912
737
  ```jsx
913
738
  <points>
@@ -923,7 +748,7 @@ Antialiased round dots. It takes the same props as regular THREE.PointsMaterial
923
748
  <a href="https://codesandbox.io/s/dh2jc"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/dh2jc/screenshot.png" alt="Demo"/></a>
924
749
  </p>
925
750
 
926
- Injects [percent closer soft shadows (pcss)](https://threejs.org/examples/?q=pcss#webgl_shadowmap_pcss) into threes shader chunk.
751
+ Injects [percent closer soft shadows (pcss)](https://threejs.org/examples/#webgl_shadowmap_pcss) into threes shader chunk.
927
752
 
928
753
  ```jsx
929
754
  softShadows({
@@ -946,7 +771,7 @@ softShadows({
946
771
  Creates a THREE.ShaderMaterial for you with easier handling of uniforms, which are also automatically declared as setter/getters on the object.
947
772
 
948
773
  ```jsx
949
- import { extend } from 'react-three-fiber'
774
+ import { extend } from '@react-three/fiber'
950
775
  import glsl from 'babel-plugin-glsl/macro'
951
776
 
952
777
  const ColorShiftMaterial = shaderMaterial(
@@ -974,7 +799,7 @@ extend({ ColorShiftMaterial })
974
799
 
975
800
  // in your component
976
801
  <mesh>
977
- <colorShiftMaterial attach="material" color="hotpink" time={1} />
802
+ <colorShiftMaterial color="hotpink" time={1} />
978
803
  </mesh>
979
804
  ```
980
805
 
@@ -984,7 +809,7 @@ extend({ ColorShiftMaterial })
984
809
 
985
810
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/modifiers-curvemodifier)
986
811
 
987
- Given a curve will replace the children of this component with a mesh that move along said curve calling the property `moveAlongCurve` on the passed ref. Uses [three's Curve Modifier](https://threejs.org/examples/?q=curve#webgl_modifier_curve)
812
+ Given a curve will replace the children of this component with a mesh that move along said curve calling the property `moveAlongCurve` on the passed ref. Uses [three's Curve Modifier](https://threejs.org/examples/#webgl_modifier_curve)
988
813
 
989
814
  ```jsx
990
815
  const curveRef = useRef()
@@ -994,7 +819,7 @@ const curve = React.useMemo(() => new THREE.CatmullRomCurve3([...handlePos], tru
994
819
  return (
995
820
  <CurveModifier ref={curveRef} curve={curve}>
996
821
  <mesh>
997
- <boxBufferGeometry args={[10, 10]} />
822
+ <boxGeometry args={[10, 10]} />
998
823
  </mesh>
999
824
  </CurveModifier>
1000
825
  )
@@ -1221,7 +1046,7 @@ useHelper(condition && mesh, BoxHelper, 'red') // you can passe false instead of
1221
1046
 
1222
1047
  This hook uses [DetectGPU by @TimvanScherpenzeel](https://github.com/TimvanScherpenzeel/detect-gpu), wrapped into suspense, to determine what tier should be assigned to the user's GPU.
1223
1048
 
1224
- 👉 This hook CAN be used outside the react-three-fiber `Canvas`.
1049
+ 👉 This hook CAN be used outside the @react-three/fiber `Canvas`.
1225
1050
 
1226
1051
  ```jsx
1227
1052
  function App() {
@@ -1248,7 +1073,7 @@ const scale = useAspect(
1248
1073
  )
1249
1074
  return (
1250
1075
  <mesh scale={scale}>
1251
- <planeBufferGeometry />
1076
+ <planeGeometry />
1252
1077
  <meshBasicMaterial map={imageTexture} />
1253
1078
  ```
1254
1079
 
@@ -1271,63 +1096,13 @@ return (
1271
1096
  <a href="https://codesandbox.io/s/gsm1y"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/gsm1y/screenshot.png" alt="Demo"/></a>
1272
1097
  </p>
1273
1098
 
1274
- A very cheap frustum check that gives you a reference you can observe in order to know if the object has entered the view or is outside of it. This relies on [THREE.Object3D.onBeforeRender](https://threejs.org/docs/index.html?q=obj#api/en/core/Object3D.onBeforeRender) so it only works on objects that are effectively rendered, like meshes, lines, sprites. It won't work on groups, object3d's, bones, etc.
1099
+ A very cheap frustum check that gives you a reference you can observe in order to know if the object has entered the view or is outside of it. This relies on [THREE.Object3D.onBeforeRender](https://threejs.org/docs/#api/en/core/Object3D.onBeforeRender) so it only works on objects that are effectively rendered, like meshes, lines, sprites. It won't work on groups, object3d's, bones, etc.
1275
1100
 
1276
1101
  ```jsx
1277
1102
  const ref = useIntersect((visible) => console.log('object is visible', visible))
1278
1103
  return <mesh ref={ref} />
1279
1104
  ```
1280
1105
 
1281
- #### useBoxProjectedEnv
1282
-
1283
- <p>
1284
- <a href="https://codesandbox.io/s/s006f"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/s006f/screenshot.png" alt="Demo"/></a>
1285
- </p>
1286
-
1287
- The cheapest possible way of getting reflections in threejs. This will box-project the current environment map onto a plane. It returns an object that you need to spread over its material. The spread object contains a ref, onBeforeCompile and customProgramCacheKey. If you combine it with drei/CubeCamera you can "film" a single frame of the environment and feed it to the material, thereby getting realistic reflections at no cost. Align it with the position and scale properties.
1288
-
1289
- ```jsx
1290
- const projection = useBoxProjectedEnv(
1291
- [0, 0, 0], // Position
1292
- [1, 1, 1] // Scale
1293
- )
1294
-
1295
- <CubeCamera frames={1}>
1296
- {(texture) => (
1297
- <mesh>
1298
- <planeGeometry />
1299
- <meshStandardMaterial envMap={texture} {...projection} />
1300
- </mesh>
1301
- )}
1302
- </CubeCamera>
1303
- ```
1304
-
1305
- #### useTrail
1306
-
1307
- [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/misc-trail--use-trail-st)
1308
-
1309
- A hook to obtain an array of points that make up a [Trail](#trail). You can use this array to drive your own `MeshLine` or make a trail out of anything you please.
1310
-
1311
- Note: The hook returns a ref (`MutableRefObject<Vector3[]>`) this means updates to it will not trigger a re-draw, thus keeping this cheap.
1312
-
1313
- ```js
1314
- const points = useTrail(
1315
- target, // Required target object. This object will produce the trail.
1316
- {
1317
- length, // Length of the line
1318
- decay, // How fast the line fades away
1319
- local, // Wether to use the target's world or local positions
1320
- stride, // Min distance between previous and current point
1321
- interval, // Number of frames to wait before next calculation
1322
- }
1323
- )
1324
-
1325
- // To use...
1326
- useFrame(() => {
1327
- meshLineRef.current.position.setPoints(points.current)
1328
- })
1329
- ```
1330
-
1331
1106
  # Loading
1332
1107
 
1333
1108
  #### Loader
@@ -1471,7 +1246,7 @@ const envMap = useCubeTexture(['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png',
1471
1246
  <a href="https://codesandbox.io/s/i6t0j"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/i6t0j/screenshot.png" alt="Demo"/></a>
1472
1247
  </p>
1473
1248
 
1474
- A wrapper around [THREE.InstancedMesh](https://threejs.org/docs/index.html?q=instan#api/en/objects/InstancedMesh). This allows you to define hundreds of thousands of objects in a single draw call, but declaratively!
1249
+ A wrapper around [THREE.InstancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh). This allows you to define hundreds of thousands of objects in a single draw call, but declaratively!
1475
1250
 
1476
1251
  ```jsx
1477
1252
  <Instances
@@ -1556,19 +1331,34 @@ function Model({ url }) {
1556
1331
 
1557
1332
  #### Points
1558
1333
 
1559
- A wrapper around [THREE.Points](https://threejs.org/docs/index.html?q=points#api/en/objects/Points). It has the same api and properties as Instances.
1334
+ A wrapper around [THREE.Points](https://threejs.org/docs/#api/en/objects/Points). It has the same api and properties as Instances.
1560
1335
 
1561
1336
  ```jsx
1562
1337
  <Points
1563
1338
  limit={1000} // Optional: max amount of items (for calculating buffer size)
1564
1339
  range={1000} // Optional: draw-range
1565
1340
  >
1566
- <pointsMaterial vertexColors />
1341
+ <pointsMaterial />
1567
1342
  <Point position={[1, 2, 3]} color="red" onClick={onClick} onPointerOver={onPointerOver} ... />
1568
1343
  // As many as you want, make them conditional, mount/unmount them, lazy load them, etc ...
1569
1344
  </Points>
1570
1345
  ```
1571
1346
 
1347
+ If you have a material that supports vertex colors (like drei/PointMaterial) you can have individual colors!
1348
+
1349
+ ```jsx
1350
+ <Points>
1351
+ <PointMaterial />
1352
+ <Point color="hotpink" />
1353
+ ```
1354
+
1355
+ Otherwise use any material you like:
1356
+
1357
+ ```jsx
1358
+ <Points>
1359
+ <pointsMaterial vertexColors size={10} />
1360
+ ```
1361
+
1572
1362
  If you just want to use buffers for position, color and size, you can use the alternative API:
1573
1363
 
1574
1364
  ```jsx
@@ -1620,7 +1410,7 @@ useFrame(() => {
1620
1410
  <a href="https://codesandbox.io/s/12nmp"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/12nmp/screenshot.png" alt="Demo"/></a>
1621
1411
  </p>
1622
1412
 
1623
- A wrapper around [THREE.LOD](https://threejs.org/docs/index.html#api/en/objects/LOD) (Level of detail).
1413
+ A wrapper around [THREE.LOD](https://threejs.org/docs/#api/en/objects/LOD) (Level of detail).
1624
1414
 
1625
1415
  ```jsx
1626
1416
  <Detailed distances={[0, 10, 20]} {...props}>
@@ -1632,7 +1422,7 @@ A wrapper around [THREE.LOD](https://threejs.org/docs/index.html#api/en/objects/
1632
1422
 
1633
1423
  #### Preload
1634
1424
 
1635
- The WebGLRenderer will compile materials only when they hit the frustrum, which can cause jank. This component precompiles the scene using [gl.compile](https://threejs.org/docs/index.html#api/en/renderers/WebGLRenderer.compile) which makes sure that your app is responsive from the get go.
1425
+ The WebGLRenderer will compile materials only when they hit the frustrum, which can cause jank. This component precompiles the scene using [gl.compile](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.compile) which makes sure that your app is responsive from the get go.
1636
1426
 
1637
1427
  By default gl.compile will only preload visible objects, if you supply the `all` prop, it will circumvent that. With the `scene` and `camera` props you could also use it in portals.
1638
1428
 
@@ -1666,7 +1456,7 @@ A very fast, but often good-enough bounds-only raycast for meshes. You can use t
1666
1456
 
1667
1457
  #### AdaptiveDpr
1668
1458
 
1669
- Drop this component into your scene and it will cut the pixel-ratio on regress according to the canvas's performance min/max settings. This allows you to temporarily reduce visual quality in exchange for more performance, for instance when the camera moves (look into drei's controls regress flag). Optionally, you can set the canvas to a pixelated filter, which would be even faster.
1459
+ Drop this component into your scene and it will cut the pixel-ratio on [regress](#) according to the canvases perrformance min/max settings. This allows you to temporarily reduce visuals for more performance, for instance when the camera moves (look into drei's controls `regress` flag). Optionally you can set the canvas to a pixelated filter, which would be even faster.
1670
1460
 
1671
1461
  ```jsx
1672
1462
  <AdaptiveDpr pixelated />
@@ -1699,7 +1489,7 @@ useBVH(mesh)
1699
1489
 
1700
1490
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/staging-center--default-story)
1701
1491
 
1702
- Calculates a boundary box and centers its children accordingly. `alignTop` adjusts it so that it sits flush on y=0.
1492
+ Calculates a boundary box and centers its children accordingly. `alignTop` makes adjusts it so that it's sits flush on y=0.
1703
1493
 
1704
1494
  ```jsx
1705
1495
  <Center alignTop>
@@ -1713,10 +1503,10 @@ Calculates a boundary box and centers its children accordingly. `alignTop` adjus
1713
1503
  <a href="https://codesandbox.io/s/rz2g0"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/rz2g0/screenshot.png" alt="Demo"/></a>
1714
1504
  </p>
1715
1505
 
1716
- Calculates a boundary box and centers the camera accordingly. If you are using controls, make sure to pass them the `makeDefault` prop. `fit` fits the current view on first render. `clip` sets the cameras near/far planes. `observe` will optionally use r3f's resize-observer to refresh bounds on resize.
1506
+ Calculates a boundary box and centers the camera accordingly. If you are using controls, make sure to pass them the `makeDefault` prop. `fit` fits the current view on first render. `clip` sets the cameras near/far planes.
1717
1507
 
1718
1508
  ```jsx
1719
- <Bounds fit clip observe damping={6} margin={1.2}>
1509
+ <Bounds fit clip damping={6} margin={1.2}>
1720
1510
  <mesh />
1721
1511
  </Bounds>
1722
1512
  ```
@@ -1846,10 +1636,10 @@ A cheap canvas-texture-based circular gradient.
1846
1636
  <a href="https://codesandbox.io/s/qxjoj"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/qxjoj/screenshot.png" alt="Demo"/></a>
1847
1637
  </p>
1848
1638
 
1849
- A [contact shadow](https://threejs.org/examples/?q=con#webgl_shadow_contact) implementation, facing upwards (positive Y) by default. `scale` can be a positive number or a 2D array `[x: number, y: number]`.
1639
+ A [contact shadow](https://threejs.org/examples/#webgl_shadow_contact) implementation, facing upwards (positive Y) by default. `scale` can be a positive number or a 2D array `[x: number, y: number]`.
1850
1640
 
1851
1641
  ```jsx
1852
- <ContactShadows opacity={1} scale={10} blur={1} far={10} resolution={256} color="#000000" />
1642
+ <ContactShadows opacity={1} scale={10} blur={1} far={10} resolution={256} />
1853
1643
  ```
1854
1644
 
1855
1645
  Since this is a rather expensive effect you can limit the amount of frames it renders when your objects are static. For instance making it render only once:
@@ -1890,9 +1680,6 @@ function Foo() {
1890
1680
 
1891
1681
  <p>
1892
1682
  <a href="https://codesandbox.io/s/t4l0f"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/t4l0f/screenshot.png" alt="Demo"/></a>
1893
- <a href="https://codesandbox.io/s/mih0lx"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/mih0lx/screenshot.png" alt="Demo"/></a>
1894
- <a href="https://codesandbox.io/s/e662p3"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/e662p3/screenshot.png" alt="Demo"/></a>
1895
- <a href="https://codesandbox.io/s/lwo219"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/lwo219/screenshot.png" alt="Demo"/></a>
1896
1683
  </p>
1897
1684
 
1898
1685
  Sets up a global cubemap, which affects the default `scene.environment`, and optionally `scene.background`, unless a custom scene has been passed. A selection of [presets](src/helpers/environment-assets.ts) from [HDRI Haven](https://hdrihaven.com/) are available for convenience. If you pass an array of files it will use THREE.CubeTextureLoader.
@@ -1901,11 +1688,11 @@ Sets up a global cubemap, which affects the default `scene.environment`, and opt
1901
1688
 
1902
1689
  ```jsx
1903
1690
  <Environment
1904
- background={false} // can be true, false or "only" (which only sets the background) (default: false)
1691
+ background={false}
1905
1692
  files={['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']}
1906
1693
  path="/"
1907
1694
  preset={null}
1908
- scene={undefined} // adds the ability to pass a custom THREE.Scene, can also be a ref
1695
+ scene={undefined} // adds the ability to pass a custom THREE.Scene
1909
1696
  />
1910
1697
  ```
1911
1698
 
@@ -1915,60 +1702,6 @@ If you provide a single string it will use THREE.RGBELoader.
1915
1702
  <Environment files="file.hdr" />
1916
1703
  ```
1917
1704
 
1918
- If you already have a cube texture you can pass it directly:
1919
-
1920
- ```jsx
1921
- <CubeCamera>{(texture) => <Environment map={texture} />}</CubeCamera>
1922
- ```
1923
-
1924
- If you provide children you can even render a custom environment. It will render the contents into an off-buffer and film a single frame with a cube camera (whose props you can configure: near=1, far=1000, resolution=256).
1925
-
1926
- ```jsx
1927
- <Environment background near={1} far={1000} resolution={256}>
1928
- <mesh scale={100}>
1929
- <sphereGeometry args={[1, 64, 64]} />
1930
- <meshBasicMaterial map={texture} side={THREE.BackSide} />
1931
- </mesh>
1932
- </Environment>
1933
- ```
1934
-
1935
- You can even mix a generic HDRI environment into a custom one with either the `preset` or the `files` prop.
1936
-
1937
- ```jsx
1938
- return (
1939
- <Environment background near={1} far={1000} resolution={256} preset="warehouse">
1940
- <mesh />
1941
- ```
1942
-
1943
- Declarative environment content can also animate with the `frames` prop, the envmap can be live. Give it a low resolution and this will happen at very little cost
1944
-
1945
- ```jsx
1946
- return (
1947
- <Environment frames={Infinity} resolution={256}>
1948
- <Float>
1949
- <mesh />
1950
- </Float>
1951
- ```
1952
-
1953
- #### Lightformer
1954
-
1955
- <p>
1956
- <a href="https://codesandbox.io/s/lwo219"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/lwo219/screenshot.png" alt="Demo"/></a>
1957
- </p>
1958
-
1959
- This component draws flat rectangles, circles or rings, mimicking the look of a light-former. You can set the output `intensity`, which will effect emissiveness once you put it into an HDRI `<Environment>`, where it mostly belong. It will act like a real light without the expense, you can have as many as you want.
1960
-
1961
- ```jsx
1962
- <Environment>
1963
- <Lightformer
1964
- form="rect" // circle | ring | rect (optional, default = rect)
1965
- intensity={1} // power level (optional = 1)
1966
- color="white" // (optional = white)
1967
- scale={[10, 5]} // Scale it any way you prefer (optional = [1, 1])
1968
- target={[0, 0, 0]} // Target position (optional = undefined)
1969
- />
1970
- ```
1971
-
1972
1705
  #### Sky
1973
1706
 
1974
1707
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/staging-sky--sky-st)
@@ -1977,7 +1710,7 @@ This component draws flat rectangles, circles or rings, mimicking the look of a
1977
1710
  <a href="https://codesandbox.io/s/vkgi6"><img width="20%" src="https://codesandbox.io/api/v1/sandboxes/vkgi6/screenshot.png" alt="Demo"/></a>
1978
1711
  </p>
1979
1712
 
1980
- Adds a [sky](https://threejs.org/examples/webgl_shaders_sky.html) to your scene.
1713
+ Adds a [sky](https://threejs.org/examples/#webgl_shaders_sky) to your scene.
1981
1714
 
1982
1715
  ```jsx
1983
1716
  <Sky distance={450000} sunPosition={[0, 1, 0]} inclination={0} azimuth={0.25} {...props} />