An interactive 3D glasses viewer built with Three.js featuring customizable Ray-Ban models. Experience realistic 3D rendering with real-time color customization and smooth controls.
- ๐จ Real-time Color Customization - Change frame, lens, and bridge colors instantly
- ๐ฑ๏ธ Interactive Controls - Smooth mouse and touch controls for 360ยฐ viewing
- ๐ฑ Responsive Design - Works perfectly on desktop, tablet, and mobile devices
- โก High Performance - Optimized rendering with WebGL and modern Three.js features
- ๐ฏ Auto-rotation - Optional automatic model rotation with adjustable speed
- ๐ Modern UI - Clean, dark theme with gradient accents and smooth animations
- โฟ Accessibility - Screen reader support and keyboard navigation
- ๐ง Developer Friendly - Well-documented code with modern ES6+ features
- Node.js (v16 or higher)
- Modern web browser with WebGL support
-
Clone the repository
git clone https://github.com/yourusername/3d-glasses-viewer.git cd 3d-glasses-viewer -
Install dependencies
npm install
-
Start development server
npm run dev
-
Open your browser Navigate to
http://localhost:5173to view the application
# Build the project
npm run build
# Preview the production build
npm run preview| Action | Description |
|---|---|
| Mouse Drag | Rotate the 3D model |
| Mouse Wheel | Zoom in/out |
| GUI Panel | Customize colors and settings |
| Auto Rotate | Toggle automatic rotation |
3d-glasses-viewer/
โโโ src/
โ โโโ 3dGlass.js # Main Three.js application
โ โโโ index.html # HTML structure
โ โโโ style.css # Modern CSS styling
โโโ static/
โ โโโ draco/ # Draco compression files
โ โโโ models/ # 3D model assets
โโโ package.json # Dependencies and scripts
โโโ vite.config.js # Vite configuration
โโโ README.md # This file
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint
npm run format # Format code with Prettier- Three.js - 3D graphics library
- Vite - Fast build tool and dev server
- lil-gui - Lightweight GUI controls
- DRACO - 3D geometry compression
- WebGL - Hardware-accelerated graphics
- Place your
.gltfor.glbfile instatic/models/ - Update the
modelPathinsrc/3dGlass.js - Adjust material indices if needed
The application uses CSS custom properties for easy theming:
:root {
--primary-color: #2563eb;
--background-color: #0f172a;
--surface-color: #1e293b;
/* ... more variables */
}- Pixel Ratio: Automatically capped at 2x for performance
- Shadow Maps: Enabled with soft shadows
- Tone Mapping: ACES Filmic for realistic lighting
- Lazy Loading: Models load asynchronously with progress indicators
- โ Chrome 80+
- โ Firefox 75+
- โ Safari 13+
- โ Edge 80+
- โ Mobile browsers with WebGL support
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use modern ES6+ JavaScript features
- Follow the existing code style
- Add comments for complex logic
- Test on multiple browsers
- Ensure responsive design
This project is licensed under the MIT License - see the LICENSE file for details.
- Three.js community for the amazing 3D library
- Ray-Ban for the inspiration (this is a fan project)
- Vite team for the excellent build tool
- lil-gui for the lightweight controls
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the maintainer
- Multiple glasses models
- AR/VR support
- Export functionality
- Advanced lighting controls
- Material presets
- Social sharing
Made with โค๏ธ by Dev Amir
Experience the future of 3D web applications