glodrei
Version:
useful add-ons for react-three-fiber
29 lines (23 loc) • 827 B
text/mdx
title: NormalTexture / useNormalTexture
sourcecode: src/core/NormalTexture.tsx
[](https://drei.pmnd.rs/?path=/story/staging-normaltexture) 
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} />
...
)
```