Material Picker
Working Example
Description
Selecting between different embedded materials of a loaded GLTF.
- Created a small room model using Sweet Home 3D.
- Exported as OBJ
- Imported into Blender, scaled to .01, exported as glTF (.glb)
- Used GLTFJSX with the transform option to compress, optimize and create initial JSX to work from.
- Exported the Armchair from Sweet Home 3D (Selection Only) as OBJ
- Imported into Blender.
- Created 5 different materials using some Poly haven textures.
- Created some swatches of the materials so that materials are exported. Swatches are not loaded into the final scene, but the materials will be loaded into memory so that they can be swapped using the UI. See
armchair.blend
in GitHub repo. - In Blender, created a UV map, using Cube Projection, to apply one of the textures. See
armchair.blend
in GitHub repo. - Exported as glTF (.glb)
- Used GLTFJSX with the transform option to compress, optimize and create initial JSX to work from.
- Imported both Room and Armchair into scene. See code in Working Example.
Note that this example requires a good understanding of Blender to reproduce a similar model containing multiple usable embedded materials.
This example also uses a Drei HUD with an Orthographic camera for the Material Picker UI Overlay.
Useful Links
Sweet Home 3D | sweethome3d.com |
Poly Haven | polyhaven.com/ |
Drei Hud | github.com/pmndrs/drei |
Drei OrthographicCamera | github.com/pmndrs/drei |
GitHub Branch
git clone https://github.com/Sean-Bradley/React-Three-Fiber-Boilerplate.git
cd React-Three-Fiber-Boilerplate
git checkout materialPicker
npm install
npm start