AntDX316
commited on
Commit
ยท
bb120b0
1
Parent(s):
c6d36cd
updated
Browse files
README.md
CHANGED
@@ -7,32 +7,180 @@ sdk: docker
|
|
7 |
pinned: false
|
8 |
---
|
9 |
|
10 |
-
#
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
```bash
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
```
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
37 |
-
2. Ensure the application built successfully
|
38 |
-
3. Review the container logs for more details
|
|
|
7 |
pinned: false
|
8 |
---
|
9 |
|
10 |
+
# 3D Interactive Scene
|
11 |
|
12 |
+
3D Interactive Scene is a captivating web application that lets you explore and customize stunning 3D geometries in real-time through your browser.
|
13 |
|
14 |
+
Built with React and Three.js, this interactive experience allows you to choose from six different 3D shapes (cube, sphere, torus, icosahedron, octahedron, and dodecahedron), customize their colors and textures, adjust animation speeds and scales, and toggle beautiful visual effects like bloom and chromatic aberration.
|
15 |
|
16 |
+
With intuitive mouse controls for navigation, dynamic lighting, procedural textures, and a sleek modern interface, it's perfect for anyone interested in 3D graphics, creative experimentation, or simply enjoying mesmerizing interactive art.
|
17 |
|
18 |
+
Whether you're a developer learning 3D web technologies, an artist exploring digital forms, or just someone who loves beautiful interactive experiences, this application offers an engaging way to play with 3D geometry and visual effects right in your web browser.
|
19 |
|
20 |
+
## โจ Features
|
21 |
+
|
22 |
+
- **Interactive 3D Geometries**: Choose from multiple shapes including cube, sphere, torus, icosahedron, octahedron, and dodecahedron
|
23 |
+
- **Real-time Customization**: Adjust colors, textures, animation speed, and scale
|
24 |
+
- **Visual Effects**: Toggle post-processing effects including bloom and chromatic aberration
|
25 |
+
- **Responsive Design**: Modern UI with Tailwind CSS styling
|
26 |
+
- **Orbital Controls**: Navigate around the 3D scene with mouse/touch controls
|
27 |
+
- **Dynamic Lighting**: Advanced lighting setup with ambient, point, and spot lights
|
28 |
+
- **Procedural Textures**: Custom Voronoi noise textures for enhanced visual appeal
|
29 |
+
|
30 |
+
## ๐ Quick Start
|
31 |
+
|
32 |
+
### Prerequisites
|
33 |
+
|
34 |
+
- Node.js 18 or higher
|
35 |
+
- npm or yarn package manager
|
36 |
+
|
37 |
+
### Installation
|
38 |
+
|
39 |
+
1. Clone the repository:
|
40 |
+
```bash
|
41 |
+
git clone <repository-url>
|
42 |
+
cd HF-Spaces
|
43 |
+
```
|
44 |
+
|
45 |
+
2. Install dependencies:
|
46 |
```bash
|
47 |
+
npm install
|
48 |
+
```
|
49 |
+
|
50 |
+
3. Start the development server:
|
51 |
+
```bash
|
52 |
+
npm run dev
|
53 |
+
```
|
54 |
+
|
55 |
+
4. Open your browser and navigate to `http://localhost:5173`
|
56 |
+
|
57 |
+
## ๐ณ Docker Deployment
|
58 |
+
|
59 |
+
### Using Docker Compose (Recommended)
|
60 |
+
|
61 |
+
For development:
|
62 |
+
```bash
|
63 |
+
docker-compose up dev
|
64 |
+
```
|
65 |
+
|
66 |
+
For production:
|
67 |
+
```bash
|
68 |
+
docker-compose up app
|
69 |
+
```
|
70 |
+
|
71 |
+
### Using Docker directly
|
72 |
+
|
73 |
+
Build and run:
|
74 |
+
```bash
|
75 |
+
docker build -t 3d-scene .
|
76 |
+
docker run -p 7860:7860 3d-scene
|
77 |
+
```
|
78 |
+
|
79 |
+
## ๐ ๏ธ Available Scripts
|
80 |
|
81 |
+
- `npm run dev` - Start development server
|
82 |
+
- `npm run build` - Build for production
|
83 |
+
- `npm run preview` - Preview production build
|
84 |
+
- `npm run lint` - Run ESLint
|
85 |
+
|
86 |
+
## ๐ฎ Usage
|
87 |
+
|
88 |
+
1. **Geometry Selection**: Choose from 6 different 3D shapes using the geometry buttons
|
89 |
+
2. **Color Customization**: Use the color picker to change the object's color
|
90 |
+
3. **Texture Toggle**: Switch between wireframe and textured materials
|
91 |
+
4. **Animation Speed**: Adjust rotation speed with the slider
|
92 |
+
5. **Scale Control**: Resize the object using the scale slider
|
93 |
+
6. **Visual Effects**: Toggle post-processing effects for enhanced visuals
|
94 |
+
7. **Camera Controls**:
|
95 |
+
- Left mouse: Rotate view
|
96 |
+
- Right mouse: Pan
|
97 |
+
- Scroll: Zoom in/out
|
98 |
+
|
99 |
+
## ๐๏ธ Tech Stack
|
100 |
+
|
101 |
+
- **Frontend Framework**: React 18 with TypeScript
|
102 |
+
- **3D Graphics**: Three.js with React Three Fiber
|
103 |
+
- **3D Utilities**: React Three Drei for common 3D components
|
104 |
+
- **Post-processing**: React Three Postprocessing for visual effects
|
105 |
+
- **Styling**: Tailwind CSS
|
106 |
+
- **Icons**: Lucide React
|
107 |
+
- **Build Tool**: Vite
|
108 |
+
- **Deployment**: Docker with Nginx
|
109 |
+
|
110 |
+
## ๐ Project Structure
|
111 |
+
|
112 |
+
```
|
113 |
+
HF-Spaces/
|
114 |
+
โโโ src/
|
115 |
+
โ โโโ components/
|
116 |
+
โ โ โโโ Scene.tsx # Main 3D scene component
|
117 |
+
โ โโโ App.tsx # Root application component
|
118 |
+
โ โโโ main.tsx # Application entry point
|
119 |
+
โ โโโ index.css # Global styles
|
120 |
+
โโโ public/ # Static assets
|
121 |
+
โโโ docker-compose.yml # Docker composition
|
122 |
+
โโโ Dockerfile # Production Docker image
|
123 |
+
โโโ start.sh # Application startup script
|
124 |
+
โโโ package.json # Dependencies and scripts
|
125 |
```
|
126 |
|
127 |
+
## ๐จ Customization
|
128 |
+
|
129 |
+
### Adding New Geometries
|
130 |
+
|
131 |
+
To add a new 3D shape:
|
132 |
+
|
133 |
+
1. Add the geometry type to the `ShapeProps` interface in `Scene.tsx`
|
134 |
+
2. Update the `getGeometry()` function with your new shape
|
135 |
+
3. Add the corresponding option to `geometryOptions` array
|
136 |
+
|
137 |
+
### Modifying Visual Effects
|
138 |
+
|
139 |
+
The application uses React Three Postprocessing for effects. You can customize or add new effects in the `EffectComposer` section of the `SceneContent` component.
|
140 |
+
|
141 |
+
### Texture Customization
|
142 |
+
|
143 |
+
The `createVoronoiTexture()` function generates procedural textures. Modify this function to create different patterns and materials.
|
144 |
|
145 |
+
## ๐ Deployment
|
146 |
|
147 |
+
This project is optimized for deployment on Hugging Face Spaces:
|
148 |
|
149 |
+
- Default port: 7860 (configurable via `PORT` environment variable)
|
150 |
+
- Health checks included for container orchestration
|
151 |
+
- Optimized build process with fallback npm configurations
|
152 |
+
- Static file serving with `serve` package
|
153 |
+
|
154 |
+
## ๐ค Contributing
|
155 |
+
|
156 |
+
1. Fork the repository
|
157 |
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
158 |
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
159 |
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
160 |
+
5. Open a Pull Request
|
161 |
+
|
162 |
+
## ๐ License
|
163 |
+
|
164 |
+
This project is open source and available under the [MIT License](LICENSE).
|
165 |
+
|
166 |
+
## ๐ง Troubleshooting
|
167 |
+
|
168 |
+
### Common Issues
|
169 |
+
|
170 |
+
- **Build fails**: Try `npm install --legacy-peer-deps` if you encounter peer dependency issues
|
171 |
+
- **Port conflicts**: Change the port in `docker-compose.yml` or set the `PORT` environment variable
|
172 |
+
- **Performance issues**: Reduce the number of stars in the scene or disable post-processing effects
|
173 |
+
|
174 |
+
### Performance Optimization
|
175 |
+
|
176 |
+
- The application automatically adjusts device pixel ratio for optimal performance
|
177 |
+
- Post-processing effects can be disabled for better performance on lower-end devices
|
178 |
+
- Geometry complexity can be reduced by modifying the geometry arguments
|
179 |
+
|
180 |
+
## ๐ Support
|
181 |
+
|
182 |
+
If you encounter any issues or have questions, please open an issue in the repository or contact the maintainers.
|
183 |
+
|
184 |
+
---
|
185 |
|
186 |
+
Built with โค๏ธ using React, Three.js, and modern web technologies.
|
|
|
|