
R3f Materials
Choose and configure React Three Fiber materials—PBR, unlit, toon, and custom shaders—for 3D meshes and visual effects.
Install
npx skills add https://github.com/enzed/r3f-skills --skill r3f-materialsWhat is this skill?
- Quick-start Canvas scene with meshStandardMaterial PBR (color, roughness, metalness)
- Overview table comparing eight material types (basic, Lambert, Phong, Standard, Physical, Toon, Normal, shader)
- Documents meshBasicMaterial for unlit, fast paths with transparency, opacity, maps, and side modes
- Covers PBR-oriented meshStandardMaterial and advanced meshPhysicalMaterial use cases
- Pointers for Drei materials, shader materials, textures, and visual effects per skill description
Adoption & trust: 691 installs on skills.sh; 89 GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Frontend Designanthropics/skills
Vercel React Best Practicesvercel-labs/agent-skills
Remotion Best Practicesremotion-dev/skills
Vercel Composition Patternsvercel-labs/agent-skills
Develop Userscriptsxixu-me/skills
Next Best Practicesvercel-labs/next-skills
Journey fit
Common Questions / FAQ
Is R3f Materials safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - R3f Materials
# React Three Fiber Materials ## Quick Start ```tsx import { Canvas } from '@react-three/fiber' function Scene() { return ( <Canvas> <ambientLight intensity={0.5} /> <directionalLight position={[5, 5, 5]} /> <mesh> <boxGeometry /> <meshStandardMaterial color="hotpink" roughness={0.5} metalness={0.5} /> </mesh> </Canvas> ) } ``` ## Material Types Overview | Material | Use Case | Lighting | |----------|----------|----------| | meshBasicMaterial | Unlit, flat colors | No | | meshLambertMaterial | Matte surfaces, fast | Yes (diffuse) | | meshPhongMaterial | Shiny, specular | Yes | | meshStandardMaterial | PBR, realistic | Yes (PBR) | | meshPhysicalMaterial | Advanced PBR | Yes (PBR+) | | meshToonMaterial | Cel-shaded | Yes (toon) | | meshNormalMaterial | Debug normals | No | | shaderMaterial | Custom GLSL | Custom | ## meshBasicMaterial No lighting calculations. Always visible, fast. ```tsx <mesh> <boxGeometry /> <meshBasicMaterial color="red" transparent opacity={0.5} side={THREE.DoubleSide} // FrontSide, BackSide, DoubleSide wireframe={false} map={colorTexture} alphaMap={alphaTexture} envMap={envTexture} fog={true} /> </mesh> ``` ## meshStandardMaterial (PBR) Physically-based rendering. Recommended for realistic results. ```tsx import { useTexture } from '@react-three/drei' import * as THREE from 'three' function PBRMesh() { // Load PBR texture set const [colorMap, normalMap, roughnessMap, metalnessMap, aoMap] = useTexture([ '/textures/color.jpg', '/textures/normal.jpg', '/textures/roughness.jpg', '/textures/metalness.jpg', '/textures/ao.jpg', ]) return ( <mesh> <sphereGeometry args={[1, 64, 64]} /> <meshStandardMaterial // Base color color="#ffffff" map={colorMap} // PBR properties roughness={1} // 0 = mirror, 1 = diffuse roughnessMap={roughnessMap} metalness={0} // 0 = dielectric, 1 = metal metalnessMap={metalnessMap} // Surface detail normalMap={normalMap} normalScale={[1, 1]} // Ambient occlusion (requires uv2) aoMap={aoMap} aoMapIntensity={1} // Emissive emissive="#000000" emissiveIntensity={1} emissiveMap={emissiveTexture} // Environment envMap={envTexture} envMapIntensity={1} // Other flatShading={false} fog={true} transparent={false} /> </mesh> ) } ``` ## meshPhysicalMaterial (Advanced PBR) Extends Standard with clearcoat, transmission, sheen, etc. ```tsx // Glass material function Glass() { return ( <mesh> <sphereGeometry args={[1, 64, 64]} /> <meshPhysicalMaterial color="#ffffff" metalness={0} roughness={0} transmission={1} // 0 = opaque, 1 = fully transparent thickness={0.5} // Volume thickness for refraction ior={1.5} // Index of refraction (glass ~1.5) envMapIntensity={1} /> </mesh> ) } // Car paint function CarPaint() { return ( <mesh> <boxGeometry /> <meshPhysicalMaterial color="#ff0000" metalness={0.9} roughness={0.5} clearcoat={1} // Clearcoat layer strength clearcoatRoughness={0.1} // Clearcoat roughness /> </mesh> ) } // Fabric/velvet (sheen) function Fabric() { return ( <mesh> <sphereGeometry args={[1, 64, 64]} /> <meshPhysicalMaterial color="#8844aa" roughness={0.8} sheen={1} sheenRoughness={0.5}