UNPKG

glodrei

Version:

useful add-ons for react-three-fiber

29 lines (23 loc) 827 B
--- title: NormalTexture / useNormalTexture sourcecode: src/core/NormalTexture.tsx --- [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/staging-normaltexture) ![](https://img.shields.io/badge/-suspense-brightgreen) Loads normal textures from this repository: https://github.com/emmelleppi/normal-maps 👉 Note: `useNormalTexture` hook is not meant to be used in production environments as it relies on third-party CDN. ```jsx const [normalMap, url] = useNormalTexture( 1, // index of the normal texture - https://github.com/emmelleppi/normal-maps/blob/master/normals.json // second argument is texture attributes { offset: [0, 0], repeat: [normRepeat, normRepeat], anisotropy: 8 } ) return ( ... <meshStandardMaterial normalMap={normalMap} /> ... ) ```