You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A declarative abstraction around [antimatter15/splat](https://github.com/antimatter15/splat). It supports re-use, multiple splats with correct depth sorting, splats can move and behave as a regular object3d's, supports alphahash & alphatest, and stream-loading.
1875
+
1876
+
```tsx
1877
+
type SplatProps = {
1878
+
/** Url towards a *.splat file, no support for *.ply */
1879
+
src: string
1880
+
/** Whether to use tone mapping, default: false */
1881
+
toneMapped?:boolean
1882
+
/** Alpha test value, , default: 0 */
1883
+
alphaTest?:number
1884
+
/** Whether to use alpha hashing, default: false */
1885
+
alphaHash?:boolean
1886
+
/** Chunk size for lazy loading, prevents chokings the worker, default: 25000 (25kb) */
In order to depth sort multiple splats correectly you can either use alphaTest, for instance with a low value. But keep in mind that this can show a slight outline under some viewing conditions.
1896
+
1897
+
```jsx
1898
+
<SplatalphaTest={0.1}src="foo.splat" />
1899
+
<SplatalphaTest={0.1}src="bar.splat" />
1900
+
```
1901
+
1902
+
You can also use alphaHash, but this can be slower and create some noise, you would typically get rid of the noise in postprocessing with a TAA pass. You don't have to use alphaHash on all splats.
1903
+
1904
+
```jsx
1905
+
<SplatalphaHashsrc="foo.splat" />
1906
+
```
1907
+
1849
1908
# Shaders
1850
1909
1851
1910
#### MeshReflectorMaterial
@@ -2368,6 +2427,16 @@ Enable shadows using the `castShadow` and `recieveShadow` prop.
2368
2427
2369
2428
> Note: Html 'blending' mode only correctly occludes rectangular HTML elements by default. Use the `geometry` prop to swap the backing geometry to a custom one if your Html has a different shape.
2370
2429
2430
+
If transform mode is enabled, the dimensions of the rendered html will depend on the position relative to the camera, the camera fov and the distanceFactor. For example, an Html component placed at (0,0,0) and with a distanceFactor of 10, rendered inside a scene with a perspective camera positioned at (0,0,2.45) and a FOV of 75, will have the same dimensions as a "plain" html element like in [this example](https://codesandbox.io/s/drei-html-magic-number-6mzt6m).
2431
+
2432
+
A caveat of transform mode is that on some devices and browsers, the rendered html may appear blurry, as discussed in [#859](https://github.com/pmndrs/drei/issues/859). The issue can be at least mitigated by scaling down the Html parent and scaling up the html children:
This component allows you to render a live scene into a cubetexture which you can then apply to a material, for instance as an environment map (via the envMap property). The contents of it run inside a portal and are separate from the rest of the canvas, therefore you can have events in there, environment maps, etc.
3629
3709
3630
3710
```tsx
@@ -3642,7 +3722,7 @@ export type RenderCubeTextureProps = Omit<JSX.IntrinsicElements['texture'], 'rot
3642
3722
/** Optional frame count, defaults to Infinity. If you set it to 1, it would only render a single frame, etc */
3643
3723
frames?:number
3644
3724
/** Optional event compute, defaults to undefined */
export type FisheyeProps = JSX.IntrinsicElements['mesh'] & {
3767
+
/** Zoom factor, 0..1, 0 */
3768
+
zoom?:number
3769
+
/** Number of segments, 64 */
3770
+
segments?:number
3771
+
/** Cubemap resolution (for each of the 6 takes), null === full screen resolution, default: 896 */
3772
+
resolution?:number
3773
+
/** Children will be projected into the fisheye */
3774
+
children: React.ReactNode
3775
+
/** Optional render priority, defaults to 1 */
3776
+
renderPriority?:number
3777
+
}
3778
+
```
3779
+
3780
+
This component will take over system rendering. It portals its children into a cubemap which is then projected onto a sphere. The sphere is rendered out on the screen, filling it. You can lower the resolution to increase performance. Six renders per frame are necessary to construct a full fisheye view, and since each facet of the cubemap only takes a portion of the screen full resolution is not necessary. You can also reduce the amount of segments (resulting in edgier rounds).
3781
+
3782
+
```jsx
3783
+
<Canvascamera={{ position: [0, 0, 5] }}>
3784
+
<Fisheye>
3785
+
<YourScene />
3786
+
</Fisheye>
3787
+
<OrbitControls />
3788
+
```
3789
+
3679
3790
#### Mask
3680
3791
3681
3792
<p>
@@ -3936,15 +4047,19 @@ For instance, one could want the Html component to be pinned to `positive x`, `p
Calculates a boundary box and centers the camera accordingly. If you are using camera 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 trigger on window resize.
4050
+
Calculates a boundary box and centers the camera accordingly. If you are using camera 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 trigger on window resize. To control the damping animation, use `maxDuration` to set the animation length in seconds, and `interpolateFunc` to define how the animation changes over time (should be an increasing function in [0, 1] interval, `interpolateFunc(0) === 0`, `interpolateFunc(1) === 1`).
The Bounds component also acts as a context provider, use the `useBounds` hook to refresh the bounds, fit the camera, clip near/far planes, go to camera orientations or focus objects. `refresh(object?: THREE.Object3D | THREE.Box3)` will recalculate bounds, since this can be expensive only call it when you know the view has changed. `clip` sets the cameras near/far planes. `to` sets a position and target for the camera. `fit` zooms and centers the view.
4062
+
The Bounds component also acts as a context provider, use the `useBounds` hook to refresh the bounds, fit the camera, clip near/far planes, go to camera orientations or focus objects. `refresh(object?: THREE.Object3D | THREE.Box3)` will recalculate bounds, since this can be expensive only call it when you know the view has changed. `reset` centers the view. `moveTo` changes the camera position. `lookAt` changes the camera orientation, with the respect to up-vector, if specified. `clip` sets the cameras near/far planes. `fit` centers the view for non-orthographic cameras (same as reset) or zooms the view for orthographic cameras.
0 commit comments