Building a Rainy Night City Scene with AI Coding Tools: A Practical Guide
This article walks through building a rainy night city scene with AI coding tools, focusing on how to turn vague visual ideas into measurable parameters. It covers organizing requirements by scale, weather, lighting, and interaction, building the scene in layers, fixing proportion issues with reference objects and camera settings, implementing rain effects and performance quality tiers, and using structured feedback to keep iteration costs low. Developers will find a reusable workflow for creating runnable, extensible real-time graphics scenes.
1. Why a Rainy Night Town Is an Ideal Test for AI Coding Tools
In real-time graphics, a rainy night scene is close to a stress test. It combines large numbers of semi-transparent particles, reflections on wet pavement, layered light sources under low illumination, volumetric fog, and depth-of-field control. If any one of these is handled roughly, the image immediately looks “plastic.”
So the value of using AI coding tools to generate a rainy night town is not “one-click output.” It is about verifying one thing: whether a natural language description can be reliably translated into graphics code that is well-structured, runnable, and extensible. In practice, it does not always work in a single pass—proportions, performance, and details often take several rounds of discussion—but the overall efficiency is still clearly higher than writing everything from scratch.
2. Requirements: Turning “Feel” into Parameters
Most people describe a scene as “it should have atmosphere” or “it should look good,” which code cannot consume directly. The effective approach is to break vague impressions into measurable constraints.
Organize requirements along four dimensions:
- Spatial scale: street width, number of building floors, convenience store door and window height, all in meters;
- Time and weather: rainfall intensity, wind direction, how wet the ground is;
- Lighting structure: key light position, warm-cool color temperature contrast, number of neon signs;
- Interaction goals: whether the user can walk around, switch viewpoints, or pick objects with the mouse.
A reusable prompt skeleton:
Scene: city street corner at night, a convenience store, wet asphalt roadScale: street 8m wide, 3-floor building, 3.2m floor height, 2.4m door heightWeather: moderate rain, wind direction 15°, visible puddle reflectionsLighting: cool blue ambient light + warm white store ceiling light + two colored signsInteraction: free roaming, scroll-wheel zoom, click signs to toggle brightnessConstraints: must run on mobile, keep draw calls within a reasonable range
The key is to ground “atmosphere” in the numeric relationship between scale, lighting, and weather. Only then does the model have a stable basis for generation.
3. Scene Breakdown: Build in Layers, Not in One Shot
Asking for a complete town in a single request usually produces a messy structure. A more reliable approach is to proceed in layers, confirming each one before stacking the next.
Recommended layer order:
- Terrain and roads: ground plane, curbs, crosswalks, to establish the perspective baseline first;
- Main building: the store box, glass facade, sign placement;
- Street props: streetlights, guardrails, air conditioner units, trash bins;
- Weather system: rain curtain particles, ground ripples, splashes;
- Atmosphere rendering: fog, tone mapping, bloom, vignette;
- Interaction layer: controller, collision, viewpoint switching.
The benefit of layering is that problems become locatable. When proportions are off, you can immediately tell whether the issue is in the building layer or the camera layer, instead of throwing out all the code.
4. Proportions and Details: The Core Friction in Iteration
What takes the most time in practice is often not the rain, but proportions. Common deviations include doors that look too short, streets so narrow that the camera feels cramped, and signs whose size does not match the building volume.
Three correction strategies:
- Add a reference object: place a simple 1.75m human figure or a standard door frame in the scene as a visual ruler;
- Specify camera parameters: write the field of view and initial camera position into the requirements, avoiding subjective judgments like “it looks wrong”;
- Read values back numerically: have the tool output a list of key dimensions and check them one by one instead of relying on screenshots.
Illustrative code:
const REF_HEIGHT = 1.75; // human referenceconst DOOR_HEIGHT = 2.4; // door heightconst camera = new THREE.PerspectiveCamera(55, aspect, 0.1, 200);camera.position.set(6, 1.65, 9); // close to a real eye-level viewpoint
At the detail level, the credibility of a rainy night comes mainly from “imperfection”: a sign flickering slightly, water streaks on glass, reflections broken up by pedestrians. These small disturbances are more effective than adding more polygons.
5. Engineering the Rainy Night Atmosphere
The rain effect is a stack of three parts, none of which can be missing:
- Rain streaks: usually many thin line segments or Points with a custom shader, displaced in a loop along the wind direction;
- Ground feedback: ripples via a sequence of decals or a procedural texture, reflections via planar reflection or an approximate environment map;
- Air: fog density matched with light attenuation so distant signs blur naturally.
For performance, note that too many semi-transparent objects create a fill-rate bottleneck, so particle count and screen resolution must be adjusted together. A workable approach is to provide quality tiers and downgrade automatically on mobile devices:
const isMobile = window.innerWidth < 768;const rainCount = isMobile ? 4000 : 12000;renderer.setPixelRatio(Math.min(devicePixelRatio, isMobile ? 1.5 : 2));
In addition, merging static geometry and reusing materials and geometries can significantly reduce draw calls, which is the foundation for a real-time scene to run stably.
6. Iteration: Keeping Communication Costs Under Control
Efficient iteration depends on “verifiable intermediate states.” Change only one variable per round, and ask for a runnable single-file result for immediate preview. When something is off, replace emotional descriptions with structured feedback:
Problem: the street looks too narrowExpected: about 8m wide, with sidewalks on both sidesConstraint: do not change the confirmed camera position
This three-part “problem + expected + constraint” feedback clearly reduces the number of back-and-forth rounds.
7. Reusable Takeaways
Building a rainy night town with AI coding tools is essentially a process of converting aesthetic judgment into engineering constraints. The experience boils down to four points: quantify requirements first, layer the structure first, set a scale reference first, and define quality tiers first. With these four in place, even if it does not come together in one pass, you can get a genuinely runnable and playable result within a few rounds. For developers who want to validate ideas quickly, this method transfers directly to other subjects such as indoor scenes, sci-fi corridors, and rainy harbors, with high reuse value.
