react-three-fiber by example
Examples of using react-three-fiber.
Table of Contents
Basic
-
Using a color element to attach a background color to a scene
-
A minimal boilerplate for r3f
Cameras
-
Using Drei’s map controls to pan around a scene
-
Mapcontrols screenspacepanning
Using MapControls screenspace panning to normalize mouse movements to the viewport
-
Using an orthographic projection camera in r3f
Effects
-
Adding emissive materials with bloom to create glowing text
-
Using the postprocessing library to make emissive text with bloom for a glow
-
Postprocessing custom lens effect
Using postprocessing to create a custom effect like concentric circular lenses
-
Using postprocessing to create Depth of Field
-
Using postprocessing to create a halftone-like dotscreen effect
-
Creating a vignette using the Eskil option in postprocessing vignette
-
Creating a glitchy shader overlay
-
Creating a light-through-smoke godrays effect
-
Another example of godrays
-
Godrays combined with Drei’s Text component
-
Screenspace ambient occusion - shadows where objects would occlude light
-
Postprocessing triangular pixelation
A custom triangular pixelation shader effect
-
A basic vignette using postprocessing
Geometry
-
A basic plane geometry
-
A basic sphere geometry
-
Drawing lots of cubes using instancing
-
Loading a gltf model and drawing it lots of times using instancing
-
A very minimal cube example
-
Drei’s rounded box geometry
-
A tube geometry that follows the vertices of a sphere
Hooks
-
A camera shake effect
-
Drawing helpers using the useHelper hook
-
Rotating a cube using the useFrame hook
Lighting
-
A simple light following a circular path
-
Lighting using environment mapping
-
An example of three point lighting
-
High quality VSM shadow mapping
Materials
-
Glowing text using emissive mapping
-
A shader material glow effect
-
Examples of five basic material types
-
A shader material applied to a torus
-
Shaded torus with fake lighting
A fake lighting shader material on a torus
-
A checkerboard shader material on a sphere
-
Using materials with shadows
-
Applying several maps to a sphere
-
A simpler way of loading several maps to apply to a texture
-
Combining a map with a color in a material
-
Accessing useMatcapTexture for high quality materials
Models
-
Loading a gltf model in an r3f scene
Other
-
Tracking where a pointer enters and leaves an object
-
Displaying HTML labels over a scene using Drei’s Html component
-
Drawing sprites using instanced points
-
Using pointer events with a mesh for mouseover and click interactions
-
An example of the r3f-perf library
-
A basic example of the Drei reflector component
-
Applying a texture to a reflector
-
Displaying text with Drei’s Text component wrapper around Troika text
Physics
-
Three balls perpetual physics usecannon
Three balls falling and reseting
-
Three balls falling down
-
Using constaints to form a chain
-
Usecannon constraints click direction
Using constraints with clicking
-
Balls falling on top of each other