Building a Rainy Night Convenience Store Scene in Three.js with AI-Assisted Development
This article walks through how to build an atmospheric rainy night convenience store scene in Three.js with the help of large language models. It covers why this scene is an ideal practice project, how to translate vague artistic goals into concrete technical requirements, prompt engineering tips, a rain particle implementation example, and practical performance optimization techniques. Front-end and 3D developers looking to speed up their AI-assisted workflow will find actionable guidance throughout.
Building a Rainy Night Convenience Store Scene in Three.js with AI-Assisted Development
1. Why a Rainy Night Convenience Store Is an Ideal Practice Project
In front-end 3D development, a complete scene demo tests your skills far better than a dozen scattered mini-demos. A rainy night convenience store covers nearly every core challenge in Three.js development:
- Atmosphere: A rainy night means low ambient light, wet reflective ground, and neon glow—requiring a combined use of lighting, materials, and post-processing.
- Geometry modeling: The storefront, shelves, signage, and rain particles involve assembling basic geometry and building custom shapes.
- Dynamic effects: Falling rain, ripples, flickering signage, and pedestrian silhouettes put particle systems and animation loops to the test.
- Performance constraints: With many scene elements and lots of transparent materials, the frame rate can collapse quickly without deliberate optimization.
A project like this used to take an experienced graphics developer several days. With today’s mainstream AI coding tools, an average developer can build a runnable first version within hours.
2. Breaking Down Requirements: Turning “Atmosphere” into Technical Specs
Large language models excel at executing explicit instructions but struggle with vague descriptions like “make it feel atmospheric.” The first step, therefore, is translating artistic language into technical language:
| Emotional Description | Technical Breakdown |
|---|---|
| Rainy night | Dark skybox + Fog effect + rain particle system |
| Wet ground | Plane material with high metalness, low roughness + reflection map |
| Warm interior | Point light (warm tone) + emissive window texture |
| Neon sign | Emissive material + flicker animation + Bloom post-processing |
The finer the breakdown, the higher the usable-code rate the model produces. In practice, it’s best to have the model generate a scene structure checklist first, confirm it, and then generate code module by module—rather than asking for everything at once.
3. Three Lessons in Prompt Design
1. Iterate module by module, not all at once
In practice, expecting one prompt to produce a perfect result is unrealistic—proportions, performance, and details all require back-and-forth refinement. A more effective approach is to build the skeleton first, then layer in details:
- Round 1: Scene initialization, camera, basic lighting;
- Round 2: Main building geometry and materials;
- Round 3: Rain particles and ground reflections;
- Round 4: Post-processing and performance tuning.
2. Anchor proportions with real-world references
Models often get proportions wrong—a sign too large, a doorframe too short. Providing real-world size references in the prompt (e.g., “storefront 6 meters wide, 3.5 meters tall, sign 2 meters long”) effectively corrects this.
3. State your performance budget explicitly
Declare constraints directly in the prompt, such as “keep particle count under 3,000” or “allow only one real-time shadow-casting light.” This pushes the model toward restrained implementations and saves costly rework later.
4. Core Implementation Snippets
Here’s a sample rain particle implementation based on Three.js:
const rainCount = 3000;const geometry = new THREE.BufferGeometry();const positions = new Float32Array(rainCount * 3);for (let i = 0; i < rainCount; i++) {positions[i * 3] = (Math.random() - 0.5) * 40; // xpositions[i * 3 + 1] = Math.random() * 20; // ypositions[i * 3 + 2] = (Math.random() - 0.5) * 40; // z}geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));const rain = new THREE.Points(geometry, new THREE.PointsMaterial({color: 0xaaccee, size: 0.08, transparent: true, opacity: 0.6}));scene.add(rain);function updateRain() {const pos = rain.geometry.attributes.position;for (let i = 0; i < rainCount; i++) {let y = pos.getY(i) - 0.4;if (y < 0) y = 20;pos.setY(i, y);}pos.needsUpdate = true;}
Combined with fog and a warm point light, a simple rainy night atmosphere takes shape:
scene.fog = new THREE.FogExp2(0x0a0a12, 0.03);const storeLight = new THREE.PointLight(0xffddaa, 2, 15);storeLight.position.set(0, 3, 5);scene.add(storeLight);
5. Key Performance Optimization Tips
Transparent materials and particles are the most common frame-rate killers. A few universal principles:
- Reduce draw calls: Render repeated small objects like shelf products with InstancedMesh, and merge static geometry.
- Limit real-time shadows: Keep at most one shadow-casting light; replace the rest with fake shadows or emissive textures.
- Enable post-processing selectively: Bloom boosts atmosphere significantly, but render at half resolution and scale up.
- Mobile fallback strategy: Detect device performance and dynamically reduce particle count and pixel ratio to preserve a playable baseline.
6. Conclusion
The value of AI-assisted 3D development isn’t “zero code”—it’s dramatically compressing the path from idea to prototype. Developers still need a solid grasp of lighting, materials, and performance optimization to communicate precise requirements and debug issues quickly when working with large language models. The tool turns ideas into runnable, interactive work fast, while aesthetic judgment and technical oversight remain in the developer’s hands. That’s the best collaboration model for the future of front-end 3D development.
