A simple JavaScript project using Three.js with WebGPU. Includes a torus knot with orbit controls and a background sprite layer.
- Three.js: Uses the WebGPU renderer for better performance.
- Orbit Controls: Allows user interaction via mouse movement.
- Hemisphere Lighting: Adds a basic lighting setup.
- Background Sprites: Uses
getLayer.js
to add background sprite effects.
Ensure you have a local development server (such as live-server
or http-server
) to serve your files.
# Clone the repository
git clone https://github.com/bobbyroe/threejs-webgpu-template.git
cd threejs-webgpu-template
Run a local server to serve the project:
npx http-server
or fire up Live Server
Then open http://localhost:8080
(or the appropriate URL) in your browser.
/
├── index.html # Main HTML file
├── main.js # Main JavaScript file (Three.js setup)
├── libs/
│ ├── getLayer.js # Helper function for background sprites
- Three.js (WebGPU Renderer, Orbit Controls)
- Node.js (optional, for serving files locally)
Modify main.js
to experiment with different Three.js objects, materials, or effects.
This project is licensed under the MIT License. Feel free to modify and distribute.