UNPKG

glodrei

Version:

useful add-ons for react-three-fiber

34 lines (24 loc) 1.03 kB
--- title: MatcapTexture / useMatcapTexture sourcecode: src/core/MatcapTexture.tsx --- [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/staging-matcaptexture) ![](https://img.shields.io/badge/-suspense-brightgreen) Loads matcap textures from this repository: https://github.com/emmelleppi/matcaps (It is a fork of this repository: https://github.com/nidorx/matcaps) 👉 Note: `useMatcapTexture` hook is not meant to be used in production environments as it relies on third-party CDN. ```jsx const [matcap, url] = useMatcapTexture( 0, // index of the matcap texture https://github.com/emmelleppi/matcaps/blob/master/matcap-list.json 1024 // size of the texture ( 64, 128, 256, 512, 1024 ) ) return ( ... <meshMatcapMaterial matcap={matcap} /> ... ) ``` 👉 You can also use the exact name of the matcap texture, like so: ```jsx const [matcap] = useMatcapTexture('3E2335_D36A1B_8E4A2E_2842A5') ``` 👉 Use the `url` to download the texture when you are ready for production!