Building a Rainy Night City Scene with AI Coding Tools: An Engineering Practice Guide

    This article presents a practical, engineering-focused workflow for building an interactive rainy night city 3D scene with AI coding tools. It explains how to turn a vague creative idea into executable constraints, control scene scale and proportions, match materials with lighting, implement rain effects and post-processing, and apply a three-tier performance degradation strategy. Readers will also find a checklist of common pitfalls and iteration tips for moving from a runnable prototype to a polished result.

    1. Background and Problem Definition

    In creative programming, a “rainy night city” is a highly appealing subject: wet pavement reflecting neon, fine rain forming halos under lights, and distant building silhouettes fading into fog. Such a scene may look like it is only about visual appeal, but it actually tests multiple dimensions at once, including geometric modeling, materials and lighting, particle systems, post-processing, and runtime performance.

    With AI coding tools—assisted development capabilities that generate runnable code from natural language descriptions—developers can trade a single requirement description for an initial runnable version. However, it is important to be clear about what these tools do: they are good at turning an idea into a skeleton quickly, but they do not guarantee a finished result in one pass. Whether proportions are coherent, whether performance is acceptable, and whether details are sufficient still require multiple rounds of communication and validation between the developer and the tool. Using a rainy night city 3D scene as an example, this article outlines an engineering-oriented practice method.

    2. Overall Technical Roadmap

    An interactive rainy night city can usually be broken into five layers:

    1. Scene layer: ground, roads, building blocks, and distant silhouettes;
    2. Material layer: wet ground, glass, metal, and glowing signs;
    3. Lighting layer: ambient light, directional light, local point lights, and neon fill;
    4. Effects layer: rain particles, ground ripples, fog, and volumetric feel;
    5. Interaction and performance layer: camera roaming, parameter panel, frame rate monitoring, and degradation strategy.

    The value of AI coding tools is that you only need to describe “what effect you want,” and they will produce an initial implementation of each layer above. The developer’s responsibility is to define constraints clearly and to validate the results from an engineering perspective.

    3. Requirement Description: Turning a Vague Idea into Executable Constraints

    A vague request such as “make a rainy night convenience store” often yields only a toy-level result. A high-quality prompt should include four types of information:

    • Visual goals: rainy night, wet surfaces, neon, low-saturation cool color tone;
    • Spatial scale: street width, building floor height, camera height;
    • Technical constraints: target frame rate, maximum draw calls, whether it must run on mobile;
    • Interaction requirements: roaming enabled, adjustable rain volume and fog density.

    Example prompt structure (illustrative):

    1. Build a rainy night city street corner scene:
    2. - Scale: street width 8 units, building height 12–20 units, camera height 1.6
    3. - Materials: ground with high roughness + low metalness and reflections, semi-transparent glass
    4. - Lighting: cool ambient light + warm sign point lights, adjustable fog density
    5. - Effects: 8000 rain particles, ground ripples via texture animation
    6. - Constraints: desktop target 60fps, draw calls < 150

    The more explicit the constraints, the less rework is needed. In practice, proportion and performance problems almost always stem from a lack of quantified description during the requirements stage.

    4. Scene and Proportion Control

    Disproportion is the most common problem in generated results: buildings that are too tall make the street feel like a canyon, and oversized signs create visual noise. A two-stage workflow of “blocks first, details later” is recommended:

    1. Have the tool first output a pure blockout version (Box combinations + camera), and confirm the skyline and street perspective;
    2. Then add details layer by layer, such as window grids, air conditioner units, awnings, and power lines.

    Also introduce a unified scale constant to avoid hardcoding values in multiple places:

    1. const SCALE = { street: 8, floorHeight: 3.2, cameraHeight: 1.6 };

    This way, adjusting proportions requires changing only one place, avoiding a situation where “fixing one building breaks the whole street.”

    5. Materials and Lighting: The Core of the Rainy Night Look

    The rainy night feel does not come from “adding more lights,” but from matching materials with lighting:

    • Ground: low roughness creates mirror-like reflections, combined with normal maps to produce water film undulation;
    • Buildings: high roughness and low metalness to avoid a plastic look;
    • Signs: emissive materials + local point lights to create “light spill”;
    • Glass: semi-transparent with reduced reflection intensity to prevent sorting errors.

    For lighting, a “one cool, one warm” approach is recommended: cool ambient light establishes the night tone, while warm local light creates focal points. Fog (linear fog or exponential fog) is used to compress distant contrast and make depth more realistic.

    6. Rain Effects and Post-Processing

    Rain effects are typically implemented in three parts:

    1. Rain streaks: use point or short line segment particles that fall cyclically along a fixed direction, avoiding rebuilding every frame;
    2. Ripples: ground uses texture sequences or shader animation, with controlled emission frequency;
    3. Atmosphere: lightweight Bloom makes neon produce halos, but be careful not to set the threshold too low, which can blur the whole image.

    Illustrative loop logic:

    1. positions[i * 3 + 1] -= speed * dt;
    2. if (positions[i * 3 + 1] < 0) resetDrop(i);

    The key is to reuse buffers and avoid creating objects every frame; this is the prerequisite for stable frame rates.

    7. Performance and Iteration Strategy

    The first version from generative tools is often “feature-complete but heavy.” A three-tier degradation approach is recommended:

    • Tier 1: reduce particle count and post-processing resolution;
    • Tier 2: merge static geometry to reduce draw calls;
    • Tier 3: switch to baked lighting + static reflections, sacrificing some dynamism.

    Also add a frame rate and draw call monitoring panel to turn “it feels laggy” into quantifiable metrics. During multiple rounds of communication, change only one variable at a time (proportion, rain volume, fog density) so the source of a problem can be located.

    8. Common Pitfalls Checklist

    • Hardcoded proportions scattered across the code, making adjustments extremely costly;
    • Incorrect sorting of transparent objects, causing flickering;
    • Creating new objects every frame for particles, causing periodic frame drops;
    • Bloom threshold set too low, blurring neon into a single mass;
    • Distant areas lacking fog and silhouettes, giving the image a “paper-cut” feel.

    9. Conclusion

    What AI coding tools truly change is the distance “from idea to runnable work”: they compress setup cost into one conversation and trial-and-error cost into one refresh. But proportion, performance, and details still depend on the developer’s engineering judgment. Writing requirements as constraints, structuring code into modules, and turning tuning into a checklist are the keys to moving a rainy night city from “it runs” to “it’s fun.”