Building a Rainy Night City Scene with AI Coding Tools: A Practical Guide
This article presents a practical workflow for building a walkable rainy night city scene in Three.js with the help of AI coding tools. It covers breaking down a vague creative brief into measurable modules, structuring prompts with roles, goals, constraints, and acceptance criteria, and balancing scale, performance, and detail through staged iteration. You will also find a centralized configuration example, best practices for color, reflections, particles, and observability, and a four-step collaboration loop for treating the tool as a team member. The focus is on turning an idea into a runnable prototype quickly, while leaving aesthetic and engineering judgment to the developer.
1. Introduction: From One Sentence to a Walkable Rainy Night City
In 3D visualization development, the most time-consuming part is often not writing code, but translating a fuzzy image in your head into concrete geometry, material parameters, and a lighting plan. As AI coding tools mature, developers can describe scene intent in natural language, have the tool generate an initial Three.js code skeleton, and then enter a loop of communicate, generate, verify, and correct. Using the typical “rainy night convenience store” scene as an example, this article abstracts a general practice: how to break down requirements, how to organize prompts, how to handle the tension between scale and performance, and how to converge on a satisfying result through repeated iteration. It is worth stressing that these tools are not one-shot magic; they are more like a tireless pair programmer, and their value lies in turning ideas quickly into a prototype that runs and can be played with.
2. Requirement Breakdown: Translating “Rainy Night” into Engineering Language
“Rainy night city” is an emotional description. In engineering terms, it must be broken into measurable modules:
- Scene skeleton: ground, roads, building blocks, the convenience store itself, signage, doors and windows.
- Atmosphere elements: rain particles, puddles and reflections on the ground, fog, and the contrast between neon and warm interior light.
- Interaction and roaming: camera path or free view, collision constraints, toggleable lights.
- Performance budget: target frame rate, draw call ceiling, mobile fallback strategy.
The key to the breakdown is replacing adjectives with parameters. For example, “heavy rain” maps to particle count and a falling speed range; “wet ground” maps to lower roughness, higher metalness, and reflection intensity; “dark night but still readable” maps to the ratio between ambient light intensity and local light brightness. Only after this translation does communication with the tool have a stable anchor.
3. Prompt Design: Structured Description Beats Scattered Wishes
When collaborating with AI coding tools, prompt quality directly determines how usable the first version of the code is. A “role + goal + constraints + acceptance” structure is recommended:
You are a Three.js engineer. Build a rainy night convenience store scene:Goal: free camera rotation, containing the store, signage, road surface, and rain.Constraints: compose from basic geometries; no external model assets; control draw calls;handle window resize; expose a tunable parameter object.Acceptance: runs in the browser without errors, at least 45 FPS on mid-range devices.
The benefit of this approach is that constraints pull the model back from “free improvisation” into engineering boundaries, and acceptance criteria give later iterations something to measure against. In practice, generating every detail in one pass is unrealistic; a safer path is to proceed in stages: first the blocks and camera, then materials and lighting, and finally rain and reflections.
4. Iterative Tuning: Balancing Scale, Performance, and Detail
The original experience noted that results are “not always right on the first try,” which is the norm for 3D generation tasks. Common problems and countermeasures:
- Scale imbalance. Buildings too tall or signage too large usually come from a lack of reference. The fix is to state relative relationships explicitly in the prompt, for example “the store height is about 1.2 times the street width,” and to add a human figure as a reference.
- Performance degradation. Rain particles and reflections together easily drop frames. Use “layered fallback”: enable real-time reflections on desktop, and on mobile simulate wetness with a ground color gradient; tier particle counts by device class.
- Missing detail. The texture of a rainy night comes from contrast, not from piling on assets. Concentrate the budget in three places: sign self-illumination, warm interior light spilling onto the ground, and low-intensity fill from distant neon.
An illustrative way to organize parameters:
const CONFIG = {rain: { count: 4000, speed: [18, 26], area: 60 },ground: { roughness: 0.15, metalness: 0.6, reflect: true },lights: { ambient: 0.25, sign: 2.4, interior: 1.8 },quality: { desktop: 'high', mobile: 'low' }};
Centralizing tunable values makes it easy to change one place and verify quickly during iteration, instead of rewriting the whole logic every time.
5. Best Practices for Visuals and Engineering
- Color strategy: night scenes skew cool in temperature; warm light sources create a psychological hint of a “safe harbor,” and cold rain against warm light produces narrative tension.
- Reflection control: true reflections are expensive; low-resolution reflections or approximate textures can substitute, keeping the look “wet” rather than “fully mirror-like.”
- Particle optimization: use simple materials and shared geometry for rain streaks, avoiding a separate object per particle; when necessary, do the falling displacement in the vertex stage with a shader.
- Asset discipline: stick to procedural generation and reduce external asset dependencies, so the first version runs and is shareable.
- Observability: add a simple frame rate display and a parameter panel to make tuning visible.
6. Collaboration Workflow: Treat the Tool as a Team Member
An efficient approach is to fix the process into a four-step loop: describe intent, generate skeleton, correct locally, regression acceptance. Keep a revertible version at each step to avoid uncontrolled damage from one large change. For enterprise-level visualization projects, general cloud capabilities can provide support: object storage to host static assets, a container platform to run build and preview environments, and logging and monitoring with alerting to track frontend errors and performance fluctuations. These are common industry categories, and specific choices should be evaluated against the team’s existing stack.
7. Conclusion
What AI coding tools truly change is the distance from idea to runnable work. They cannot replace a developer’s aesthetic judgment on scale, lighting, and performance, but they compress mechanical labor to a minimum, letting people focus on creativity and tradeoffs. Master three things, structured prompts, staged iteration, and a performance budget, and you can reliably turn a rainy night city from one sentence into a scene you can walk into.
