Building a Rainy Night 3D Town with AI Coding Tools
This article explains how to use AI coding tools to build a walkable 3D rainy-night town, focusing on the engineering workflow behind the creative process. It covers breaking the scene into spatial, functional, atmospheric, interaction, and performance layers; writing structured prompts that replace vague adjectives with numbers and constraints; implementing the scene in a ground-buildings-props-atmosphere-interaction order with strict proportion control; budgeting rendering costs for particles, reflections, and draw calls; adding predictable interactions and perceptual details; fixing common failure modes; and running a three-round iteration process with a concrete acceptance checklist. The core takeaway is that quality comes from turning ideas into verifiable constraints rather than letting the model think for you.
1. Introduction: From One Idea to a Walkable Rainy Night Town
In real-time 3D creation, the hardest step is often not writing code but translating a vague mental image into a structured description a machine can execute. Expressions like “rainy night, convenience store, wet pavement, neon reflections” are intuitive for humans but nearly unusable for a program. Using AI coding tools to generate a 3D scene is essentially converting natural-language ideas into a scene graph, material parameters, a lighting plan, and a render loop. This article targets building a rainy-night 3D town and discusses how to complete the process with a more rigorous engineering method, and why proportion, performance, and detail require repeated communication.
It is worth stressing that AI coding tools are good at generating a runnable skeleton and first-pass implementations of common effects, but they do not replace the creator’s judgment about space, pacing, and aesthetics. What truly determines quality is whether requirements are decomposed clearly, constraints are explicit, and acceptance criteria are quantifiable.
2. Requirement Breakdown: Turning “Rainy Night Town” into Computable Objects
Before starting, split the scene into modules that can be described and accepted independently. A “layering plus checklist” approach works well:
- Spatial layer: street direction, block scale, building height distribution, skyline outline.
- Functional layer: recognizable elements such as convenience stores, street lamps, signs, benches, trash bins, crosswalks.
- Atmosphere layer: rain density, wind direction, ground wetness, puddles, fog density, neon color temperature.
- Interaction layer: camera roaming, view switching, light toggles, rain intensity adjustment.
- Performance layer: draw batches, triangle budget, texture size limits, target frame rate.
The value of this breakdown is that each layer can be instructed to the AI coding tool separately and accepted separately. For example, “building height distribution” can be quantified as “6 to 12 meters along both sides of the main street, 20 to 40 meters for background buildings” instead of a vague “varied heights.”
3. Prompt Design: Structured Description Instead of Piled-Up Adjectives
Inefficient prompts when talking to AI coding tools are usually piles of adjectives; efficient prompts are structured constraints. A template like this works:
Goal: generate a runnable real-time 3D rainy-night street sceneScale: street width 8 m, sidewalk width 2.5 m, main buildings 6-12 m highLighting: low-intensity cool ambient light, warm point lights as key sources, visible ground reflectionsRain: particle rain streaks, fixed wind direction, adjustable densityPerformance: target 60 fps, no more than 150 draw batchesInteraction: mouse drag to look around, scroll wheel to zoomOutput: a single runnable page with no external resource dependencies
The key is converting “feel” into numbers and constraints. When the result deviates from expectations, do not just say “it doesn’t look right”; point out the dimension of deviation: proportions too large, key light too bright, rain too dense, or draw batches too high. Actionable feedback produces actionable fixes.
4. Scene Assembly: Layered Implementation and Proportion Control
Proceed in the order “ground - buildings - props - atmosphere - interaction,” previewing immediately after each layer is done.
- Ground and roads: fix street width and grid scale first, then lay sidewalks and crosswalks. The key to wet pavement is not “brighter” but “layered reflections,” achieved by lowering roughness and adding slight normal perturbation.
- Building blocks: use simple geometry to establish volume and spacing first, then add doors, windows, awnings, and signs. Lock proportions at the block stage to avoid repeated rework later.
- Props and signage: the convenience store is the visual anchor and should sit at a junction of movement paths, using warm light and a clear sign to form a focal point.
- Atmosphere overlay: add rain streaks, fog, and puddle reflections last, so particles do not raise performance and debugging costs too early.
- Interaction binding: connect camera constraints, view presets, and light/rain toggles at the end.
The general practice for proportion control is “set eye height first, then street width, then building height.” Eye height is usually 1.6 to 1.7 meters; a street width of 6 to 10 meters easily creates an intimate alley feel; buildings that are too tall weaken the readability of rainy-night lighting.
5. Performance Budget: Where the Costs of a Rainy Scene Come From
Rendering pressure in a rainy scene comes mainly from three places: particle rain, reflections and transparent overdraw, and draw-call inflation from many independent props. Set a budget before writing the implementation:
- Draw batches: merge static props to reduce the number of independent objects.
- Particle count: implement it with an adjustable cap, defaulting to a low-to-medium setting.
- Reflection approach: prefer planar reflections or environment-map approximations; avoid real-time reflections from multiple lights.
- Texture size: keep sign and ground textures within a reasonable range to avoid wasting VRAM and bandwidth.
- Frame rate target: lock the target frame rate first, then derive the triangles and batches each frame can afford.
A practical strategy is “get it running first, then squeeze the budget.” The first version may look rough but must run; then replace high-cost implementations one by one, changing only one variable at a time so performance regressions are easy to locate.
6. Interaction and Detail Polish: Making the Scene Playable
Playability comes from predictable feedback. Three interaction types are recommended: look-around, zoom, and state switching. State switching can be rain going from light to heavy, the convenience store lights going from on to off, or the view switching between the street corner and the store interior. Detail polish should focus on “perceptible differences,” such as highlight changes in puddles under light, the visibility of rain streaks near light sources, and the falloff of signs in fog. Rather than adding more models, strengthen the contrast of a few key details.
7. Common Failure Modes and Fixes
- Distorted proportion: return to the block stage and rebuild with numeric constraints instead of patching at the detail level.
- Sudden performance drop: check whether real-time reflections, too many particles, or independent props were added.
- Weak atmosphere: adjust lighting contrast and fog density first rather than blindly increasing rainfall.
- Ineffective feedback: rewrite “it feels wrong” into a specific dimensional deviation, then issue a correction instruction.
8. Iteration Workflow and Acceptance Checklist
A “three-round iteration” approach is recommended: round one gets structure and interaction running; round two locks proportion and lighting; round three squeezes performance and fills in details. Accept each round with a checklist:
- Does it run stably and hit the target frame rate?
- Do the main street proportions match the specified numbers?
- Is the convenience store a clear visual focal point?
- Do rain and lighting toggles produce perceptible feedback?
- Are there obvious draw-batch or particle redundancies?
9. Conclusion
Building a rainy-night town with AI coding tools is not about “letting the model think for you” but about “turning ideas into verifiable constraints.” When requirements are split into layers, prompts are written as numbers, performance becomes a budget, and acceptance becomes a checklist, bringing creativity to life turns from chance into a reproducible engineering process. AI coding capabilities from Baidu AI Cloud can serve as an accelerator for this workflow, but the real quality of the work still depends on the creator’s ongoing judgment about scale, light, and pacing.
