Building a Rainy-Night City Scene with AI Coding Tools: Prompts, Layout, Atmosphere, and Performance
This article shows how to turn a "rainy night city" idea into a browser scene that runs, responds to input, and keeps improving, using AI coding tools. It breaks the scene into four layers (space, atmosphere, interaction, performance), shows how to write prompts that turn a visual mood into executable constraints, and covers scale control, cold-versus-warm lighting, rain and wet-ground reflections, performance budgeting, interaction design, and an iteration loop. It also explains how to capture what worked in reusable templates, checklists, and a deployment setup. The goal is a finished result that looks right and stays maintainable.
1. From Idea to Runnable Scene: Breaking Down a Rainy-Night City
With help from AI coding tools, a “rainy night city” idea can fairly quickly become a 3D scene that runs, responds to interaction, and keeps improving. The key is not generating a perfect result in one pass. It is breaking a vague idea into engineering goals you can verify: scene layout, visual atmosphere, performance budget, interaction feedback, and room to extend later.
Take a rainy-night convenience store. You might picture a small, story-driven scene: a deep blue night, wet streets, warm light, neon signs, glass reflections, fine rain, and a blurred city skyline in the distance. If you ask a tool to generate the final image directly, you tend to run into distorted proportions, objects intersecting, weak performance, and details piled on at random. A more reliable approach is to write a structured description of the scene first, then add visual and interaction details step by step.
It helps to split the goal into four layers:
- Spatial layer: the street, the convenience store, streetlights, buildings, road signs, trash bins, and possibly vehicles or pedestrians.
- Atmosphere layer: the night, rain intensity, fog, contrast between warm and cool light, reflections on wet ground, and the faint glow of screens.
- Interaction layer: camera movement, rain intensity control, day/night switching, store lighting control, and click feedback.
- Performance layer: frame rate, number of drawn objects, particle count, material complexity, and a strategy for adapting to different devices.
Once these layers are clear, what the tool outputs is easier to verify and easier to correct over time.
2. Prompt Design: Turning a Feeling into Executable Constraints
The hard part about a rainy-night scene is that it is a visual problem and a structural problem at the same time. A prompt should not just say “make it beautiful” or “make it atmospheric.” It needs executable technical constraints. A useful structure is:
role + scene goal + visual constraints + performance constraints + output format
Here is an example prompt you can adapt:
Build a rainy-night city street-corner scene that runs in a browser, with the following requirements:1. Theme: a rainy-night convenience store and the street in front of it.2. Visual tone: deep blue, blue-grey, and warm orange in contrast, creating a sense of warmth inside a cold, wet night.3. Layout: the main building is a convenience store. In front of it are the street, streetlights, road signs, and distant buildings.4. Camera: close to pedestrian eye level, emphasizing the store's display window and signage.5. Rain: use a particle system for continuous light rain, with raindrops tilted slightly.6. Ground: wet material that reflects lights and sign colors.7. Interaction: mouse or touch to rotate the view, and controls to switch rain intensity and lighting state.8. Performance: must run in a browser on an ordinary laptop. Avoid too many high-poly models.9. Output: sample code for scene initialization, the render loop, interaction events, and parameter configuration.
This kind of prompt turns the rainy-night city idea into constraints the tool can work with. The more specific the scene, the closer the output will come to what you pictured. The clearer the constraints, the less debugging you will need later.
3. Spatial Layout and Scale Control: Avoiding “Strong Concept, Distorted Proportions”
A rainy-night city may look complex, but from an engineering point of view, it comes down to spatial relationships. Bad scale is one of the most common problems with generated scenes of this kind. A storefront entrance that is too low, streetlights at an unrealistic height, a street that is too narrow, or distant buildings that sit too close all break the sense of realism.
Start with a few key measurements:
- Storefront: the height of the sign, the height of the display window, and the width of the door should all match everyday proportions.
- Street width: keep the pedestrian space, the driving lanes, and the curb clearly separated.
- Streetlight height: streetlights should be taller than eye level and form layers with the store sign.
- Distant buildings: give them real depth. Keep them away from the viewpoint so they do not feel oppressive.
- Camera height: if you want a pedestrian’s perspective, keep the camera low. Too high, and the scene becomes a top-down view of a model.
A quick scale checklist helps:
- Is the convenience store sign within the camera's main field of view?- Does the storefront show floating, intersecting, or out-of-scale geometry?- Can the ground carry raindrops, light, and reflections?- Are the foreground, midground, and background clearly separated?- Does the scene avoid too many unrelated objects competing for attention?
If proportions are off, resist adding a lot of new detail right away. Fix the main structure first. Adjust the building dimensions, then the camera, then the lighting, and only then add rain and reflections. One change at a time makes it much easier to find the cause.
4. Shaping the Visual Atmosphere: A Cold Background with a Warm Focal Point
The appeal of a rainy-night scene usually comes from the contrast between cool and warm. The street, sky, buildings, and fog lean cool, while the store interior, signs, streetlights, and display window provide warm light. The contrast quickly draws the viewer’s eye to the convenience store.
Focus on these elements:
- Layers of rain: raindrops close to the camera stay sharp, while distant rain can be suggested with thin haze.
- Light falloff: store lights spread across the ground as soft pools, while streetlights create smaller bright spots.
- Wet reflections: the ground should not be perfectly smooth. Make it wet, slightly blurred, and locally reflective.
- Sign color: a warm sign works as the visual anchor of the frame, but avoid over-saturation.
- Background softening: distant buildings do not need much detail. Use low contrast, fog, or darker tones to push them back.
For more story, add silhouettes of shelves, a checkout counter, or a drink cooler inside the store. There is no need to chase high detail from the start. In a rainy-night scene, light, rain, fog, and reflections build atmosphere more effectively than complex geometry.
5. Rain, Fog, and Wet-Ground Reflections: From Visible to Believable
Rain is the main moving element in a rainy-night scene. It is usually handled in one of a few ways:
- Particle rain: well suited to continuous light or moderate rain.
- Line streaks: strengthen the sense of direction and speed.
- Billboard droplets: good for close-up shots and for droplets on glass.
- Sound: not the focus here, but rain audio noticeably improves immersion.
For particle rain, three things need attention: particle count, update frequency, and visual occlusion. Too many particles hurt performance; too few make the rain look sparse. An unstable update rate makes the rain speed up and slow down. Particles that fall inside buildings break the illusion.
A simple set of acceptance criteria:
- Is the rain continuous, with no visible frame skipping?- Do raindrops appear mainly in front of the camera and outside the buildings?- Does the ground show wet traces or reflections?- Is the lighting softened by the rain rather than looking harsh?- Is there an acceptable balance between rain intensity and frame rate?
You can fake wet reflections with material roughness, opacity, and reflection intensity. Physical accuracy is not the point. The ground just needs to look like it rained recently. Reflections that are too strong make it look like a mirror floor; too weak, and the scene loses its rainy-night feel. A mix of localized reflections, blurred reflections, and low-intensity highlights usually works best.
6. Performance Optimization: Making It Run, Not Just Look Good
A rainy-night city looks lightweight, but it often uses a lot of transparency, emissive materials, particles, and post-processing, all of which add to the rendering cost. Keep a performance budget in mind while you generate and iterate.
Common optimization steps:
- Control draw calls: remove individual models where you can and merge static geometry.
- Instance repeated objects: streetlights, raindrops, windows, and railings are good candidates.
- Simplify distant detail: use lower-poly geometry or simpler materials for background buildings.
- Limit particle count: adjust rain density to the device’s capabilities.
- Control light count: too many local point lights add computational cost.
- Dynamic resolution: lower render resolution when the frame rate drops.
- Layered loading: build the main structure first, then load decorative elements.
- Avoid stacked transparency: watch for rain, fog, glass, and lights overlapping at the same time.
A general tuning approach:
If average frame time is above the target:reduce raindrop count;reduce reflection intensity;reduce distant detail;lower render resolution.If average frame time is below the target and the image is stable:add more rain layers;strengthen wet-ground reflections;add local lighting detail.
Performance work is not just cutting things out. It is a visual trade-off. Keeping the elements that carry the atmosphere and reducing low-impact details usually produces a more complete result than simply pushing for higher specs.
7. Interaction Design: Let Users Join the Scene
A rainy-night city becomes interesting through interaction. A scene you can only watch easily turns into a moving image. To make it more engaging, you can add:
- Camera modes: a street view, a storefront view, and a distant overhead view.
- Rain intensity: switch between light, moderate, and heavy rain.
- Lighting control: toggle the store lights, make the sign flicker, or change the streetlight glow.
- Weather states: rain, after the rain, and a foggy night.
- Clickable details: clicking the drink cooler, counter, or sign shows a hint or plays an animation.
- Camera walkthrough: a slow automatic movement along the street to reinforce the sense of space.
Interaction should follow one principle: clear state and clear feedback. When you switch rain intensity, do not only change the particle count. Adjust sound, fog, or reflection strength to match. When you switch the lights, avoid cutting to black all at once; interpolate the change instead.
A small parameter panel lets users tune the scene themselves:
Rain intensity: 0 to 1Fog density: 0 to 1Light brightness: 0.5 to 1.5Camera height: 1.2 to 2.0
Exposing parameters makes debugging easier and helps you find the right visual balance quickly.
8. The Iteration Loop: From “Generate Once” to “Refine Continuously”
AI coding tools are good at producing a first version fast. High-quality results, though, usually come from several rounds of refinement. Work in a closed loop: generate, run, observe, fix, and check for regressions.
- Generate a first version: have the tool produce the scene structure and basic logic.
- Run and verify: check that it loads and that there are no errors.
- Review the visuals: confirm the composition, proportions, lighting, and rain effects match what you wanted.
- Check performance: watch the frame rate, load time, and how responsive the interaction feels.
- Fix one thing at a time: change one type of problem per pass. Changing too much at once makes it hard to trace what broke.
- Save versions: keep stable builds so you can roll back and compare.
If you can, put together a simple acceptance table:
- Is the first load time acceptable?- Is the main subject of the scene clear?- Does the rainy-night atmosphere hold up?- Are the proportions natural?- Are the interactions smooth?- Does performance meet the target?- Are there obvious intersections, flickering, or floating objects?
This turns “tweaking by feel” into an engineering process you can track.
9. Engineering the Reuse: Turning One Idea into a Repeatable Method
As a rainy-night city project moves from a one-off experiment to ongoing development, it pays to set up some reusable building blocks. Beyond the scene itself, you can build:
- Scene templates: a common structure for streets, buildings, lights, rain, and interaction components.
- Prompt templates: save the constraints that worked so you do not rewrite them every time.
- Parameter presets: record settings for a rainy night, early morning, dusk, and fog.
- Acceptance checklists: for automated or manual review.
- Resource management conventions: consistent naming, folder structure, file formats, and loading rules.
- A deployment pipeline: use a general-purpose build, containerization, and object storage to manage static resources and versions.
For team or enterprise-level projects, you can bring resources and logs into a general-purpose cloud stack. Object storage can hold scene assets and build artifacts, a container platform can handle deployment, a logging service can record runtime status, and monitoring with alerts can track availability. That turns a creative demo into a digital product you can maintain over time.
10. Summary: More Than an Image, a Runnable System
Building a rainy-night city with AI coding tools looks like a visual creative task on the surface. In practice, it is a full systems-engineering exercise. You need to describe the atmosphere and control the spatial proportions, design rain and lighting and manage the performance budget, and produce a first version and refine it into a stable experience.
A rainy-night city worth keeping is rarely generated in one pass. Light levels get recalibrated again and again, rain density gets reset, street proportions get corrected, interaction feedback gets refined, and performance finds its balance between detail and smoothness. That process shows what AI coding tools are actually for: they do not replace the developer’s thinking. They help turn ideas into work that runs, can be experienced, and can be improved.
