Building a Rainy Night City 3D Scene with AI Coding Tools: A Complete Practice Guide
This article details a complete workflow for building a WebGL-based 3D scene of a rainy night corner store, using AI coding tools as a collaborative programming partner. It covers how to translate a vague creative vision into structured technical requirements, how to iterate on common issues such as scale, atmosphere, and performance, and concludes with a set of reusable communication principles for working effectively with AI generation tools. The goal is to help developers shorten the path from an imaginative concept to a running, polished prototype.
Introduction: From a Fleeting Idea to a Running Scene
Many developers have experienced this: a vivid image flashes through your mind—a convenience store glowing with warm yellow light on a rainy night, wet streets, neon reflections shimmering in puddles—but when you sit down to build it, the sheer volume of technical details (rendering pipelines, material systems, particle effects) feels overwhelming. The traditional path to building a polished Web 3D scene required familiarity with graphics fundamentals, scene organization, lighting models, and performance tuning—a steep learning curve for most.
With the maturation of AI coding tools, this path has become significantly shorter. My approach is to treat the AI tool as a “pair programming partner” — describing target effects in natural language, having it generate complete page code built on mainstream WebGL-based rendering libraries, and then iterating through multiple rounds of dialogue to fix proportion, lighting, and performance issues. This article uses the “rainy night convenience store” scene as a case study to fully document the process and extract a reusable methodology.
Step One: Structuring a Vague Visual into Defined Requirements
Why the Quality of Your Description Determines Output Quality
The ceiling on code quality from AI coding tools is largely determined by how structured your input is. A prompt like “build me a rainy convenience store” is too broad and yields a generic template. A more effective approach is to break down the image into several key dimensions:
- Scene Elements: A convenience store building, a street, streetlights, and roadside trees.
- Atmosphere Elements: Heavy to moderate rain (via particle effects), wet ground with reflective puddles, fog or environmental attenuation.
- Lighting Design: Warm point lights inside the store, cone-shaped light from street lamps, and emissive materials for the neon sign.
- Interaction: Mouse drag to rotate the camera, scroll wheel to zoom, and an optional camera fly-through.
A Working Prompt Framework
In practice, a three-part description works well: “Scene + Atmosphere + Technical Constraints.”
Please generate a single-file Web 3D scene:- Scene: A night street with a convenience store on the corner, complete with a display window and signage.- Atmosphere: Rain (implemented with a particle system), wet reflective ground,warm interior lighting spilling out, and an emissive material for the signboard.- Technical Constraints: Pure front-end implementation, no build tools,keep particle counts and texture sizes reasonable to maintain a good frame rate.
This “what I need + what I’m worried about” structure gives the AI model both direction and guardrails, significantly reducing revision cycles.
Step Two: Accepting That the First Output Is Rarely the Final Product
This is one of the most important takeaways from the practice: the initial output from AI tools is usually just passable, not final. In this project, I encountered three common categories of issues that required multiple rounds of dialogue to resolve.
Issue 1: Scale Mismatch Between Architecture and Street
The first generated scene had a store that was too large relative to the street width, resulting in a “toy model” feel when the camera was pulled back. The fix was to specify anchor dimensions: “Use a human height of 1.7m as a base unit; the store’s floor height should be about 3.5m, and the street width roughly twice the building width.” This gave the model a reference framework to keep geometry proportions consistent across all objects.
Issue 2: The Rain Feels Flat
The core of a rainy night atmosphere is not just “having rain,” but the layered depth of the rain. Based on experience, three layers are needed:
- Foreground rain streaks: Larger, slower, semi-transparent elongated particles to create depth.
- Mid-ground dense raindrops: Numerous small, fast particles that form the bulk of the rainfall.
- Environmental humidity: Suggested via fog effects and reflective surfaces on the ground.
Relying on a single particle system struggles to achieve all three tiers. It’s necessary to explicitly request a split implementation of these layers in the dialogue.
Issue 3: Performance Bottlenecks (Frame Rate vs. Visual Fidelity)
The combined load of particle counts, reflective rendering, and multiple light shadows can easily tank the frame rate. Common optimization strategies include:
- Particle system: Use shared geometries and materials instead of creating objects per frame.
- Ground reflections: Use downsampled render targets, or opt for a pre-computed reflection map to replace expensive real-time reflections.
- Shadows: Only enable shadows for key lights and limit shadow map resolution.
- Dynamic degradation: Detect when the frame rate drops below a threshold and automatically reduce particle density.
These optimization strategies can be suggested directly in the chat. The AI tool can usually implement them, but judging the priority of which optimization to apply first still requires human input—and that’s where a developer’s value lies.
Step Three: Effective Patterns for Iterative Communication
From several rounds of experimentation, I’ve distilled three principles for efficient back-and-forth communication with AI tools:
Principle 1: Change One Type of Issue at a Time. Asking for “a size fix, a color change, and performance optimization” in a single prompt often leads to interfering changes and regressions. It’s more stable to work in phases: “Structure → Atmosphere → Performance.”
Principle 2: Describe Problems Verifiably. Instead of saying “this feels wrong,” say “The sign text is not visible from the camera’s initial position; it needs to rotate toward the main street.” A verifiable description gives the model clear, actionable direction.
Principle 3: Actively Request Explanations for Key Implementations. Ask the tool to explain the meaning of fog parameters or how the reflection is implemented. This serves both as a learning opportunity and as a method to ensure the proposed solution is reasonable, avoiding the introduction of black-box code you cannot understand or debug.
Results and Further Reflections
The final scene captured a complete rainy night atmosphere: warm light from the store spilling onto the wet pavement, the halo of the neon sign reflecting in puddles, and a three-tier rain system providing a convincing sense of depth—all while maintaining a smooth frame rate on a mid-range device.
From an engineering perspective, this practice of combining AI coding tools with creative 3D scene generation has value beyond a single project:
- For front-end developers, it serves as a low-cost scaffolding into graphics programming. The generated code itself acts as a high-quality learning material.
- For product and design teams, it compresses the creative prototype validation cycle from weeks to hours.
- For business use cases, similarly interactive 3D pages can be used in digital showrooms or marketing landing pages. Combined with standard object storage and content delivery networks, they can be quickly deployed without the need for complex infrastructure.
Conclusion
This practice reinforces a key insight: AI coding tools do not replace a developer’s judgment on the final result, but they dramatically reduce the distance from idea to a working prototype. Proportion, performance, and detail still require human iteration—and that polishing process is the best path to understanding the fundamentals of 3D rendering technology. The image of that rainy little city in your mind has never been more within reach.
