This project demonstrates a Three.js 3D scene with real-time environment mapping using a CubeTextureLoader. It features interactive lighting, orbit controls, and live GUI tweaking for material properties like metalness and roughness.
- 🔁 Cube Texture Environment Mapping
- 🎛️ Live GUI controls (
dat.GUI) for:metalnessroughness
- 🧊 Sphere, Plane, and Torus geometries using shared reflective material
- 💡 Ambient and Point Lighting
- 🕹️ Interactive OrbitControls
- 🧭 Axis Helper
- 🔄 Responsive canvas resize
your-project/
├── src/
│ ├── index.js # Main Three.js logic
│ ├── style.css # CSS styles
│ ├── index.html # html
│ └── textures
│ └── environmentMaps
│ └── 0
│ ├── px.jpg
│ ├── nx.jpg
│ ├── py.jpg
│ ├── ny.jpg
│ ├── pz.jpg
│ └── nz.jpg
│
├── dist/ # Built files (after bundling)
├── bundler/ # Webpack configuration files
├── package.json
└── README.md
Make sure you have Node.js installed. Then run:
npm installnpm run devThis will start the Webpack development server and open the scene in your browser.
-
A 3D Sphere, Plane, and Torus arranged in a group
-
Cube-mapped environment for reflections
-
GUI controls for:
metalnessroughnessenv Map Intensity
-
Axis helper and point light helper
-
Real-time updates and camera orbit interaction
-
Fully responsive canvas on window resize
- The environment map is a cube texture, composed of six images.
- Ensure your paths to texture files (inside textures/environmentMaps/0/) are correct.
- Adjust lighting intensities or material properties in the GUI to explore different effects.
npm run buildThis will output the optimized files into the dist/ directory.
