Building a Rainy Night 3D City with AI Coding Tools: A Practical Workflow

    This article presents a practical methodology for collaborating with generative AI coding tools to build a rainy night 3D city scene. It explains how to translate a vague creative idea into measurable engineering constraints, how to converge on usable results through three focused iteration rounds covering scale, performance, and detail, and how to approach lighting, wet reflections, rain particles, and post-processing. It also covers low-cost interactivity, a delivery checklist, and how cloud capabilities can turn a one-off prototype into a long-term project. All technical descriptions remain product-neutral.

    1. Introduction: From an Idea to a Runnable Scene

    “I want a small city on a rainy night, with a convenience store glowing on the corner.” A description like this can barely enter a development schedule during a requirements review, because it lacks scale, constraints, and acceptance criteria. But once a generative AI coding tool has strong code comprehension and generation capabilities, this sentence can become a starting point: the tool first produces a runnable 3D scene skeleton, and the developer then converges it step by step through engineering practices.

    It is worth emphasizing that AI coding tools are not magic that produces a finished draft in one shot. The real experience is closer to communicating with a fast-reacting collaborator who lacks project context: proportions drift, performance gets out of control, and details stay vague. Using the “rainy night city scene” as an example, this article abstracts a methodology for working with AI coding tools. All technical descriptions stay neutral and do not involve any specific product or brand.

    2. Translating the Idea into Engineering Constraints

    The biggest problem with natural-language ideas is that they are not verifiable. To keep generated results controllable, the first step is to translate the idea into a measurable set of constraints. It is recommended to cover at least the following dimensions:

    • Scene scale: define street width, building floor height, and the storefront dimensions of the convenience store in meters, to avoid results that “look right but have distorted proportions.”
    • Camera and viewpoint: specify the initial camera height, field of view, and whether free roaming is allowed, since this determines all later composition decisions.
    • Time and environment: a rainy night means low illumination, high contrast, and wet reflections, so the maximum number of light sources and the shadow strategy need to be agreed on in advance.
    • Performance budget: target frame rate, acceptable number of draw calls, and maximum texture size. This is the most easily overlooked item and the one that most affects the experience.
    • Interaction scope: whether playable elements such as keyboard movement, mouse look, wipers, or light switches are needed.

    Writing these into a structured prompt is far more effective than “make it look realistic.” Example (illustrative text, not any product interface):

    1. Build a 3D rainy night street scene with the following technical requirements:
    2. 1) Use meters as the unit; street width 8 m, single-floor height 3.2 m;
    3. 2) The scene includes 1 convenience store, 2 residential buildings, and 1 set of street lights;
    4. 3) No more than 6 light sources, with only the main light casting shadows;
    5. 4) Support WASD movement and mouse look;
    6. 5) Target frame rate 60, with draw calls kept under 150.

    3. Iteration: Three Rounds of Convergence on Scale, Performance, and Detail

    Practical experience shows that generated results usually need more than three rounds of conversation to become usable, and each round should focus on a single concern.

    The first round addresses the “skeleton and proportions.” At this point, do not discuss materials or effects; only confirm the massing relationships. Common problems are buildings that are too tall, streets that are too narrow, and a distorted convenience store sign size. The fix is to replace abstract evaluations with numeric instructions, for example, “change the residential height to 9.6 m, three floors in total.”

    The second round addresses “performance.” The killers of a rainy night scene are large numbers of transparent raindrops and real-time shadows from multiple light sources. You can ask the tool to do three things: switch raindrops to instanced rendering, merge distant buildings into static batches, and change non-critical light sources to baked or approximated lighting. Illustrative decision logic:

    1. // Illustrative: dynamically downgrade based on device capability
    2. const isLowEnd = renderer.capabilities.maxTextureSize < 8192;
    3. const rainCount = isLowEnd ? 1500 : 6000;
    4. const enableShadow = !isLowEnd;
    5. renderer.shadowMap.enabled = enableShadow;

    The third round addresses “detail and narrative.” The value of the convenience store lies in traces that “someone just left”: a half-open door, reflections on the ground, and the color-temperature clash between the warm light on the shelves and the cool light of the street. At this stage, the tool should be asked to add local geometry and emissive materials, rather than continuing to pile on global effects.

    4. Breaking Down the Rainy Night Aesthetic

    A rainy night is hard to build because it tests three capabilities at once: lighting, reflection, and particles.

    • Lighting layers: use cool ambient light as the base and a few warm point lights as visual anchors, avoiding flat, uniform global illumination that makes the image look “washed out.”
    • Wet reflections: the ground needs a low-roughness material combined with environment reflection. The reflected content can be approximated with a simplified scene or a pre-generated environment map, at a much lower cost than real-time reflection.
    • Rain rendering: render rain streaks with instanced geometry or camera-facing quads, with a small number of “splash” particles triggered at ground level. Rain density should be linked to visibility; excessive density loses both performance and atmosphere.
    • Post-processing: lightweight tone mapping, vignetting, and slight blur are enough. Heavy post-processing is one of the main sources of frame rate drops.

    5. Playability: From “Viewable” to “Playable”

    The gap between a static scene and a finished work lies in interaction feedback. Low-cost, high-return approaches include: giving the convenience store door an open/close state machine, fading street light illumination in and out based on distance, adding toggles for footstep and rain sounds, and providing a debug panel that switches “rain intensity” with one click. In implementation, these interactions are all local state management, which is well suited to being generated by an AI coding tool and then manually checked for boundary conditions, such as preventing the camera from passing through walls and preventing the door rotation angle from exceeding its limits.

    6. Acceptance Checklist and Collaboration Tips

    Before delivery, it is recommended to run a fixed checklist:

    1) Scale: use a door height of about 2.1 m as the human-scale reference, with no exaggerated massing across the scene;
    2) Performance: the frame rate is stable on the target device, and draw calls and memory usage stay within budget;
    3) Visuals: shadows still have depth, and light sources have a clear primary and secondary hierarchy;
    4) Interaction: all interactive objects give feedback, with no freezes or clipping;
    5) Maintainability: scene elements are clearly named and parameters are centrally configured, making future extension easy.

    The key to working with AI coding tools is to translate “aesthetic judgment” into “verifiable metrics” and to split large tasks into small, verifiable single-round tasks. On this basis, introducing general cloud capabilities from Baidu AI Cloud, such as object storage for static asset distribution, a container platform to host the build pipeline, and logging services with monitoring alerts to track online rendering performance, can move a one-off creative prototype forward into a long-term project that can be iterated on continuously.