Blender to Web3D as fast as possible
I'M LEAVING THIS ONE HERE BUT I RECOMMEND STARTING HERE NOW: https://github.com/SuddenDevelopment/web3d
This repo is meant to accompany a tutorial series on Youtube that starts here: https://youtu.be/1BvLpt7egss
As the course advances I'll add scripts here to make some tasks easier and grow this to be a Blender to Web toolkit.
Discuss here on Discord: https://discord.gg/5rTCdzpKnj
- Flying Apartment Asset
- React Three Fiber: Three.js Renderer
- Drei: React Three Fiber Helpers
- Three.js: 3D Engine
- Vite: Static Web Server
- CodeSandbox: Online Prototyping Container (optional)
npm install
- Open a model in Blender you want to publish (places like CG Trader are a good start)
- Export to
public/model.glb
- open a terminal to
/src
directory - run
npx gltfjsx ../public/model.glb
- rename the new
Model.js
toModel.jsx
- run
npm run dev
from terminal - look at what you did, tune and repeat
npm run dev
npm run build
npm run preview
npm run sandbox
- Import your model (I got an stl from printables.com)
- Models CAN be created progmatically if that makes sense to do.
- Models can come from multiple files
- test things with gltf export NOT glb
- Split parts
- by whats separate
- by materials
- select faces + more technique
- Reduce geometry
- Remove unnecessary components for 3d printing
- highlight and dissolve unnecessary vertices
- limited dissolve intricate parts
- join parts and set origins logically for use later
- rename parts to what's easy to recognize
- parent objects based on what needs to move together
- add materials (detailed separately)
- add lights (detailed separately)
- Materials in Blender
- UVs
- bulk script on Gist
- GLTF export materials
- BSDF Material
- Baking Materials
- Materials in R3F
- Special materials
- Cloning
- Modifying
- Unique capabilities
- more lights == slower performance
- use '-s' in gltfjsx transform
- include drei Instances if using -i
- add these properties to each light: castShadow shadow-mapSize={[2048, 2048]} shadow-bias={-.0000001} in Model.jsx
- adjust intensity values and shadow-bias
- add castShadow receiveShadow to instance Merged tag in Model.jsx
- useFrame lerp https://medium.com/@zmommaerts/animate-a-camera-in-react-three-fiber-7398326dad5d
- Theater js https://www.theatrejs.com/
- useAnimations:
- naming is everything!
- NLA tracks are a pain
- can group virtually
- onClick interactions
- play forward and backward.
- Spring https:/docs.pmnd.rs/react-three-fiber/tutorials/using-with-react-spring
- Drei Animations