Building a Rainy Night 3D City Scene with Conversational AI Programming
This article documents a hands-on practice of building an immersive rainy-night convenience store 3D scene using a cloud-based conversational AI coding assistant. It covers scenario planning and technology selection with Three.js and WebGL, generating the base framework through natural language prompts, iteratively refining materials, lighting, and a layered rain particle system, polishing details like flickering signage and camera animation, implementing performance monitoring with adaptive degradation, and summarizes practical methodology for AI-assisted development, including prompt granularity and performance-first thinking.
Introduction: When Creativity Meets AI-Assisted Development
In a traditional development workflow, turning a visual idea in your head into a runnable 3D scene usually involves tedious environment setup, geometry modeling, material tuning, and interaction coding. Even with a well-encapsulated WebGL library like Three.js, beginners still face a steep learning curve and long debugging cycles. With the rise of cloud-based conversational AI coding tools, a “describe it and get the code” paradigm is becoming viable—developers simply describe what they envision in natural language, and the AI generates a runnable base framework within seconds. This shifts the focus from “how to implement” to “what to implement” and “how to optimize.”
This article records a complete practice: using a cloud-based AI coding assistant to build an immersive rainy-night convenience store 3D scene from scratch. The process was not smooth—scene proportion imbalance, insufficient rendering performance, and weak detail expression recurred throughout the iterations. But these real technical challenges turned out to be the best test cases for evaluating AI-assisted programming capabilities.
1. Scenario Planning and Technology Selection
The first step of any 3D scene development is requirement decomposition. Before starting the conversation, the abstract idea needs to be broken down into quantifiable, verifiable functional modules. For the “rainy-night convenience store” theme, we defined the following core elements:
| Module | Functional Description | Technical Points |
|---|---|---|
| Environment & Atmosphere | Night sky, rain curtain, wet road reflections | Particle system, environment map, material reflection |
| Main Building | Store exterior, signage, display windows | Geometry composition, texture mapping, emissive materials |
| Dynamic Elements | Falling raindrops, flickering lights | Frame animation, time-driven updates, interaction events |
| User Experience | Mouse-controlled view, keyboard roaming | Orbit controls, collision detection |
We chose the WebGL ecosystem as the implementation foundation because it requires no plugins, is natively cross-platform, and is easy to share. The cloud-based conversational coding tool was selected for two core capabilities: first, it can directly map natural language descriptions into API call sequences, greatly lowering the entry barrier; second, it supports “localized modification instructions” during iteration—for example, “increase raindrop speed by 30%” precisely updates the corresponding code segment without rewriting the entire file.
2. From Dialogue to Code: Building the Base Framework with AI
The initial instruction sent to the AI assistant was: “Create a Three.js scene containing a ground plane, a sky, a convenience store building, and a particle effect simulating rain.” Notably, the AI produced a complete, runnable HTML file in its first response, including scene initialization, a render loop, basic geometry construction, and a simplified raindrop particle system prototype.
The first version was impressive but not perfect. The scene opened normally; the store was assembled from a red cube and white cuboids, and raindrop particles fell vertically. But the problems were equally obvious:
- Distorted proportions: The building-to-ground ratio was roughly 1:3, making the building look isolated in the default view;
- Harsh lighting: The scene used only a single directional light, and the ground appeared as a uniform gray plane lacking the wet texture of a rainy night;
- Monotonous particles: Raindrops fell in perfectly vertical paths, and with only about 2,000 particles, the visual density was insufficient for a “rainy night” atmosphere.
Instead of re-describing the entire requirement, we addressed these issues through incremental modification instructions, such as: “Replace the ground with a reflective plane, and add ambient light and point lights to simulate street lamp illumination,” and “Increase the raindrop particle count to 8,000 and add a horizontal wind deflection component.” The AI accurately located the corresponding modules in the code and made the changes. This interaction style proved highly efficient over subsequent iterations—each adjustment took under 30 seconds on average, and the scope of every code change was clearly traceable.
3. Deepening Visual Quality: Coordinated Tuning of Materials, Lighting, and Dynamic Systems
The visual expressiveness of a 3D scene depends on a delicate balance among material properties, lighting layout, and dynamic elements. This phase tested both the AI’s comprehension and the developer’s aesthetic judgment.
1. Material System Upgrade
The default materials of basic geometries (MeshPhongMaterial or MeshLambertMaterial) could not convey wetness. After explicitly requesting “specular reflection support” and “reduced roughness” in the instructions, the AI switched the building walls and ground to MeshStandardMaterial and introduced an environment map to enhance reflection detail. For the ground in particular, adjusting the envMapIntensity parameter allowed light sources to form blurred reflection spots on the wet surface.
2. Lighting Atmosphere Reconstruction
A night scene needs a layered lighting narrative. During iteration, we removed the original single white DirectionalLight and replaced it with three complementary light sources:
- Warm yellow point light (approximately #ffaa66): positioned above the store signage to simulate the warm glow of a neon light box;
- Cool blue hemisphere light (approximately #4466cc): serving as the ambient base tone to reinforce the cold feeling of night;
- White spotlight: shining from behind the building’s side, outlining its silhouette and casting elongated shadows on the ground.
This change significantly improved the scene’s dimensionality and emotional depth. Based on its general understanding of lighting physics, the AI reasonably configured each light’s intensity, decay distance, and shadow map size, without requiring the developer to manually compute optical parameters.
3. Dynamic Rain Curtain System
The rain simulation was upgraded from a simple Points particle system to a layered design: foreground raindrops used large, high-opacity textures falling faster, while background raindrops used small, low-opacity textures falling slightly slower, creating a depth-of-field effect. A global wind deflection angle of 2.5 degrees was added so the rain curtain slants naturally. To control performance, the total particle count was capped at 12,000, and vertex data was stored in BufferGeometry—an optimization strategy the AI proactively suggested in the conversation, demonstrating its grasp of the WebGL rendering pipeline’s underlying logic.
4. Detail Polishing and Interaction Optimization
Once the visual core stabilized, the focus shifted to detail refinement and interaction logic.
4.1 Dynamic Signage and Character Behavior
The store signage gained a flickering effect: by periodically adjusting the material’s emissiveIntensity property, it simulates the breathing brightness of an aging neon tube. The AI also added a simple low-poly human silhouette inside the transparent display window, with a path animation moving slowly within the building, giving the scene a sense of life.
4.2 Interaction Control and Camera Language
The default OrbitControls supports rotating and zooming the view, but to give users a first-person immersive experience upon entry, we added camera animation logic: after the scene loads, the camera automatically flies from 30 meters above down to 2 meters in front of the store entrance, pauses for 1.5 seconds, and then releases control to the user.
4.3 Performance Monitoring and Adaptive Degradation
To ensure smoothness on low-end devices, the AI assistant integrated a simple frame-rate monitoring logic into the code: if the fps stays below 30 for 5 consecutive seconds, the raindrop particle count is automatically reduced to 2,000 and the shadow map resolution is halved. This “soft degradation” strategy is far more user-friendly than displaying an error message.
5. Runtime Verification and Results
After roughly 30 rounds of iterative dialogue, the final version achieved the following results in mainstream browsers:
- Initial scene load time of about 1.8 seconds (approximately 520KB of resources after Gzip compression);
- Stable rendering frame rate of 55–60 fps on a mid-range laptop;
- Visual quality matching the intended “fresh yet emotional” rainy-night atmosphere.
It is worth noting that the AI-generated code was well-structured and fully commented throughout, with each round of modification presented as an incremental patch, greatly reducing the burden of code review. In the final version, over 70% of the code could be reused directly or with minor adjustments for production use.
6. Lessons Learned and an AI-Assisted Development Methodology
This practice highlights the core differences between cloud-based conversational AI programming and traditional development:
From “writing code” to “stating requirements”: The developer’s core skill is no longer memorizing API signatures, but precisely describing the target effect and its physical logic. For example, rather than saying “use Points to create rain,” say “create a particle system of 10,000 particles falling uniformly along the Y-axis with horizontal wind deflection”—the latter improves the AI’s comprehension by an order of magnitude.
Iterative feedback is the key to quality: AI models cannot grasp complex artistic aesthetics in one shot. The most effective path is “small steps, fast iterations”: raise only 3–5 concrete improvement points per round, each with quantifiable expectations (e.g., “increase speed by 20%,” “change the color to #336699”). Practice shows that the finer the instruction granularity, the closer the code fits the intent.
Performance awareness must come early: When generating feature-rich scenes, AI often defaults to the most intuitive but not necessarily optimal implementation. Developers should proactively ask during the conversation, “How would this code perform on mobile?” or “Is there a more efficient alternative algorithm?” to push the model into optimization mode.
Conclusion: From Tool to Partner
Looking back at the entire development chain, the cloud-based AI coding assistant is no longer a simple code completer—it is more like a pair-programming partner that knows the WebGL ecosystem, possesses graphics fundamentals, understands fuzzy requirements, and delivers quickly. It has turned “one person building a small, sensory-rich application” from an ideal into an everyday reality. Of course, AI still cannot replace human sensitivity to spatial aesthetics or precise judgment of user emotional flow—but those happen to be the developer’s enduring moat.
Next time a fleeting image appears in your mind, open a chat window, describe it, and watch the code glow in the rain.
