- What is react-three-fiber?
- react-three-fiber is a React renderer for threejs on the web and react-native*.
- Gives more semantic layout and assumes reasonable defaults, making it easy to get up and running quickly with less code.
- Use-cases:
- Rendering graphics in the browser with React or on mobile and web with React Native*.
- react-three-fiber is a React renderer for threejs on the web and react-native*.
*Limited documentation on react-native see https://github.com/pmndrs/react-three-fiber/blob/master/markdown/recipes.md#usage-with-react-native.
-
Prerequisites
- React, JavaScript, HTML, CSS
-
Environment
- Node >= v8.10 and npm >= v5.6
- Create React app
npx create-react-app react-three-fiber-introduction cd react-three-fiber-introduction
- Install three and react-three-fiber and start the app.
npm install three react-three-fiber use-cannon npm start
- Versions used in this project:
"dependencies": { "react": "^17.0.1", "react-dom": "^17.0.1", "react-scripts": "^4.0.0", "react-three-fiber": "^5.1.5", "three": "^0.122.0", "use-cannon": "^0.5.3", }
-
Assets
- .gltf files from sketchfab.
- Setting the Scene
- The scene graph.
- Manual setup with threejs.
- Canvas
- AxesHelper
- Geometry
- Lines
- Lights
- [Material/Mesh]
- Light sensitivity, color, texture, opacity, emissive, transmissive, metal, reflective, clearcoat
- background
- animation
- useThree(), useFrame(() => {}), camera
- performance pitfalls
-
Controls
- extend
- Orbit controls
- Events
- Dragcontrols
-
Physics
- use-cannon https://github.com/pmndrs/use-cannon
- Other things students can try on their own
- Using Assets
- Soft-shadows
- postprocessing