A streamlined boilerplate for Three.js projects, designed to get you up and running quickly.
Follow these steps to set up your project using this boilerplate:
# Clone the repository and cd into the project
git clone https://github.com/zoyron/threejs-boilerplate.git your-project-name
cd your-project-name
# Remove git history and start fresh with your own Git history
rm -rf .git
git init
# Install dependencies
npm install
# Run the development server
npm run dev
Your project is now running at http://localhost:5173 (or another port if 5173 is occupied).
- Canvas
- Scene
- Sizes(the object)
- Perspective Camera(most usualy and popular choice)
- Lights(optional, with ambient light being the most popular choice)
- Creating geometry or points-geometry; could be inbuilt, custom, random or using shaders
- Creating material or points-material; could be inbuilt, custom, random or using shaders
- Creating mesh or points; could be inbuilt, custom, random or using shaders
above three are the points where we mostly use shaders
- Adding the created mesh or points to the scene or group
- Adding a scene renderer
- Adding a window resizing event listener, and updating the render inside it
- Adding orbit controls and damping them if required
- adding the animate() function, and giving necessary logic and functionality to it
- calling the animate() function