AntDX316 commited on
Commit
bb120b0
ยท
1 Parent(s): c6d36cd
Files changed (1) hide show
  1. README.md +164 -16
README.md CHANGED
@@ -7,32 +7,180 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- # HF-Shapes
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
 
14
- ## Docker Setup
15
 
16
- This project uses Docker for containerization. The default configuration runs on port 7860 which is compatible with Hugging Face Spaces.
17
 
18
- ### Running with Docker
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ```bash
21
- # Build and start the container
22
- docker compose up app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
- # For development with hot-reloading
25
- docker compose up dev
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  ```
27
 
28
- ### Environment Variables
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- - `PORT`: The port on which the server will run (default: 7860)
31
 
32
- ### Troubleshooting
33
 
34
- If you encounter issues with the container starting:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
- 1. Check if the port 7860 is already in use
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.