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
※ The hook with `~~Texutre` calculates the texture resolution and canvas resolution and covers the texture.
44
49
@@ -283,113 +288,6 @@ usePerformanceMonitor({
283
288
});
284
289
```
285
290
286
-
# How to make "custom fxHooks"
287
-
288
-
With some functions provided by `use-shader-fx`, creating a custom hook is straightforward (the challenging part is only the shader!). Please refer to existing `fxHooks` for details.
289
-
290
-
In addition, we have prepared a template in the repository below that is useful for creating custom hooks, so please clone and use it in the location where you created your custom hook.
Generates FBO and returns a double-buffered buffer texture after swapping. The `useFBO` of `drei` by default performs `setSize` for `THREE.WebGLRenderTarget` upon changes in `dpr` and `size`, making it challenging to handle buffer textures during changes like dpr adjustments. Therefore, a non-reactive hook against updates of dpr and size was created. It's possible to make them reactive individually through options. If you want to `setSize` at a custom timing, the `fxObject` that the fxHook receives as the third argument also stores `renderTarget`.
302
-
303
-
```ts
304
-
typeUseFboProps= {
305
-
scene:THREE.Scene;
306
-
camera:THREE.Camera;
307
-
size:Size;
308
-
/** If dpr is set, dpr will be multiplied, default:false */
309
-
dpr?:number|false;
310
-
/** Whether to resize when resizing occurs. If isDpr is true, set FBO to setSize even if dpr is changed, default:false */
311
-
isSizeUpdate?:boolean;
312
-
/** Defines the count of MSAA samples. Can only be used with WebGL 2. Default is 0. */
313
-
samples?:number;
314
-
/** Renders to the depth buffer. Unlike the three.js, Default is false. */
315
-
depthBuffer?:boolean;
316
-
/** If set, the scene depth will be rendered to this texture. Default is false. */
When you call the update function, it returns a double-buffered texture. The second argument gets a function called before `gl.render()`, allowing for operations like swapping materials or setting uniforms.
The `3D` series has a set of exported hooks, each with `Create`, like `useCreateWobble3D`, which can be used as a texture, but also to add `object3D` as a `primitive` to an r3f scene. It is also possible to add `object3D` as a `primitive` to an r3f scene.
0 commit comments