Building a Rainy Night 3D City with AI Coding Tools

    This article presents a practical, tool-agnostic workflow for using AI coding tools to turn an atmospheric idea—a rainy night 3D city—into a runnable, explorable, and extensible real-time 3D scene. It covers translating mood descriptions into an engineering requirements table, writing structured prompts with verifiable constraints, locking human and street scale plus camera parameters, layering wet-ground reflections, light sources, and fog, setting a performance budget, and running a four-round iteration loop. The key takeaway is that quality depends on converting aesthetic judgment into measurable engineering constraints and feeding them back to the tool.

    1. Introduction: From One Idea to a Walkable Rainy Night City

    In real-time 3D content creation, the most time-consuming part is often not writing code, but translating a vague image in your mind into a clear structure: street scale, building proportions, lighting layers, rain and fog density, camera movement, and interaction feedback. As AI coding tools have improved, developers can now describe a target scene in natural language, have the tool generate initial code, and then enter a loop of “generate—run—observe—fix.” This article takes “building a rainy night 3D city” as the goal and abstracts a general, product-neutral method: how to use AI coding tools to move an atmosphere-driven idea steadily into a runnable, playable, and extensible real-time 3D work.

    It is worth stressing that this kind of collaboration is not “describe once and get a finished product.” Disrupted proportions, performance bottlenecks, and missing details are the norm. What really determines output quality is whether the developer can turn aesthetic judgment into verifiable engineering constraints and keep feeding those constraints back to the tool.

    2. Requirement Breakdown: Translating “Rainy Night City” into Engineering Language

    An atmospheric description must be broken down into an executable scene checklist; otherwise the generated result is uncontrollable. A requirements table built across five dimensions is recommended:

    • Spatial structure: one main street, several side streets, and a corner convenience store as a visual anchor, with clear block scale and passage width.
    • Visual tone: low illumination, a cool dominant palette, local warm light accents, and wet ground that produces reflections and trailing highlights.
    • Weather system: rain streak density, wind direction, ground splashes, water marks on glass, and fog attenuation in the distance.
    • Interaction goals: free roaming, the ability to push open a door and enter the store, switch viewpoints, and adjust rain volume and lighting.
    • Performance budget: target frame rate, draw call ceiling, triangle count, and texture and post-processing cost.

    When handing this table to an AI coding tool, provide both “must-haves” and “optionals” so the model does not freely improvise in ambiguous areas and cause structural drift.

    3. Prompt Design: Structured Descriptions Beat Literary Ones

    The core of a high-quality prompt is verifiability. A four-part structure of “role—goal—constraints—acceptance criteria” is recommended:

    1. Role: Senior real-time 3D graphics developer
    2. Goal: Generate a directly runnable rainy night block scene with a main street, a convenience store, street lights, and rain effects
    3. Constraints:
    4. 1. Use a perspective camera with an initial height of about 1.6 meters to simulate a pedestrian viewpoint
    5. 2. Buildings are 2 to 4 floors, floor height about 3 meters, street clear width 6 to 8 meters
    6. 3. Ground material has low roughness, with reflections and normal detail
    7. 4. Rain effects use a particle system, with count controlled by a parameter, default medium
    8. 5. Draw calls per frame do not exceed 200, total triangles kept within 300,000
    9. Acceptance: The page can be explored immediately after loading, frame rate is stable, and rain volume and lighting can be adjusted in real time

    This turns aesthetic preferences into numeric ranges and observable metrics, which noticeably improves the usability of generated results. For hard-to-quantify parts such as lighting and fog, give a reference range and require “output adjustable parameters” instead of hard-coded constants.

    4. Proportion and Camera: Where Atmosphere Collapses First

    The most common failure in rainy night scenes is distorted proportion: streets that are too wide feel empty, buildings that are too tall feel oppressive, and mismatched signage, door, and window sizes make the scene feel overly “model-like.” In engineering terms, lock three baselines first:

    1. Human baseline: eye height, door opening height, step height;
    2. Street baseline: lane and pedestrian area width, curb height;
    3. Building baseline: floor height, bay width, window-to-wall ratio.

    The camera needs constraints too. A small field of view with slight head bob enhances immersion for pedestrian roaming, while an overhead shot is used to show the overall block layout. Centralizing camera parameters in code makes repeated fine-tuning easier:

    1. const cameraRig = {
    2. eyeHeight: 1.6,
    3. fov: 60,
    4. near: 0.1,
    5. far: 200,
    6. walkSpeed: 3.2,
    7. headBob: 0.02
    8. };

    Making “adjustable” a hard requirement significantly reduces back-and-forth rounds of communication.

    5. Rainy Night Texture: Wet Ground, Light Layers, and Fog Attenuation

    The rainy night atmosphere is built from three stacked layers. The first is ground reflection: low-roughness materials combined with normal perturbation create a mirror-like wet look. The second is light layering: a cool ambient light as the base, warm light from street lamps and inside the store for contrast, and neon or signage as the visual focus. The third is atmospheric attenuation: distant buildings lose contrast with distance, avoiding “paper-cut” edges.

    For the rain effect, a particle system handles rain streaks and splashes, while screen-space water marks and slight blur create the feeling of “seeing the world through glass.” The key is parameterization: rain volume, wind direction, wind strength, and splash intensity should all be exposed as adjustable items so they can be tiered by device performance.

    6. Performance Budget: Making the Work “Playable,” Not Just “Viewable”

    A real-time 3D work must interact stably on the target device. Set a budget during the design phase and check it item by item after generation:

    • Geometry: merge static meshes to reduce draw calls; use instanced rendering for repeated components.
    • Materials: limit the number of materials and avoid too many independent shader branches.
    • Lighting: cap the number of real-time lights; bake static parts or use approximate lighting.
    • Post-processing: toggle blur, depth of field, and tone mapping by tier.
    • Assets: tier texture sizes and load only essential assets for the first screen.

    If a generated result exceeds the budget, feed back “the specific over-budget item + the target value” to the tool rather than vaguely asking to “optimize it.” Verifiable feedback is the key to fast convergence.

    7. Interaction and Iteration: Turning Repeated Communication into a Process

    The stable rhythm of human-AI collaboration is “small steps, fast pace”: change only one dimension at a time, observe immediately after running, then decide whether to move on. Four iteration rounds are recommended:

    1. Structure round: confirm block layout and camera path;
    2. Atmosphere round: adjust lighting, fog, and rain intensity;
    3. Performance round: trim and merge according to the budget;
    4. Detail round: add narrative elements such as signage, water marks, and pedestrian silhouettes.

    Also keep rollback-able parameter snapshots to avoid one change breaking the overall balance. Writing each change as a verifiable acceptance condition greatly reduces communication cost.

    8. From Demo to Deliverable: Engineering Wrap-Up

    Once the scene runs, delivery elements still need to be completed: loading progress and failure fallback, a parameter panel, a mobile degradation strategy, and basic logging and error messages. If cloud resources are integrated later, general-purpose capabilities can be used, such as object storage for static assets, a content delivery network to accelerate loading, logging services and monitoring alerts to track runtime status, and a container platform to handle build and deployment. These are all industry-standard approaches and do not involve any vendor-specific proprietary interfaces.

    9. Conclusion

    Building a rainy night city with AI coding tools is essentially engineering aesthetic judgment: break it down first, then constrain, then iterate, and finally close with budget and acceptance criteria. The tool turns descriptions into code; the developer defines what “correct” means. When proportion, performance, and detail are all written as verifiable metrics, bringing an idea to life is no longer a matter of chance, but a reproducible, maintainable, and continuously extensible production process.