Building an Interactive Rainy Night Street Scene with AI-Assisted Coding
A practical guide to building an interactive rainy night street scene in the browser with AI-assisted coding — covering scene scoping, layered architecture, scale and camera setup, lighting and rain particles, performance budgets, and effective iteration with LLM assistants.
From Idea to a Runnable Piece
“Building a rainy night town” sounds like a purely visual idea, but turning it into a working piece of engineering breaks it down into many interlocking problems: How wide should the street be? How big is the convenience store? What camera focal length? How dense are the rain streaks? How strong should the wet-ground reflections be? Can it run stably on mobile? Is the interaction actually fun to play with?
AI coding assistants dramatically shorten the path from idea to prototype, but they are not a magic “generate once, ship it” solution. A more reliable workflow is: first translate your aesthetic goals into verifiable technical parameters, then generate, run, observe, and fix in stages.
The value of this hands-on exercise lies in validating a way of working: with LLM-assisted programming, you can quickly build a browser-based 3D scene skeleton and rapidly experiment with materials, lighting, and particle effects. But proportions, performance, and fine details still require repeated back-and-forth. This article generalizes that experience into a reusable method for turning scenes like a “rainy night town” into something that genuinely runs and plays well.
Define Scene Boundaries and Acceptance Criteria First
Before asking an AI assistant to write code, define the scene boundaries. A good approach is to split goals into three categories: visual goals, interaction goals, and technical constraints.
Visual goals include: a low-light night environment, warm local lighting on the convenience store, neon or signboard light on the street, rain streaks and fog, wet ground reflections, and occasional splashes. Interaction goals include: camera roaming, adjustable rain intensity, time or exposure adjustment, and quality presets. Technical constraints include: running in the browser, acceptable first-load time, stable target frame rate on desktop, automatic degradation on mobile, and no reliance on uncontrollable external resources.
Acceptance criteria should be observable and quantifiable. For example: the convenience store’s storefront is about 3 meters tall, the street is about 12 meters wide, the camera field of view is around 55 degrees; rain particle counts can reach the tens of thousands on desktop and are automatically halved on mobile based on frame rate; wet-ground reflections approximate only the main light sources and signboards rather than pursuing full-scene accurate reflections; the control panel offers at least rain intensity, exposure, and quality settings. Write these into your prompts so the AI assistant outputs code closer to your target, rather than just a demo that “looks like a rainy night.”
Use a Layered Architecture to Avoid Runaway One-Shot Generation
A rainy night street scene suits a layered implementation: scene layer, materials and lighting layer, weather particle layer, reflection and post-processing layer, and interaction and performance layer. The benefit of layering is that each layer can be debugged independently, so a problem in one place doesn’t ripple through everything.
The scene layer handles the street, shops, streetlights, distant buildings, and the camera. The materials and lighting layer handles ambient night light, local point lights, glowing signboards, and fog. The weather particle layer handles rain streaks, splash on impact, and wind-driven offset. The reflection and post-processing layer handles wet-ground highlights, exposure, tone, and slight blur. The interaction and performance layer handles the parameter panel, frame rate monitoring, resolution scaling, and mobile degradation.
A schematic structure:
Scene configuration├─ Camera and controls├─ Street and buildings├─ Convenience store and signboard├─ Streetlights and local light sources├─ Rain particle system├─ Wet-ground reflection approximation├─ Post-processing and exposure└─ Performance monitoring and quality degradation
When working with the assistant, ask it to generate only a “runnable skeleton” first. Confirm that the camera, proportions, and basic lighting are correct before adding rain, reflections, and post-processing layer by layer. This is far more controllable than requesting a “complete rainy night town” in one shot.
Scale, Camera, and Composition Come First
The most common failure in 3D scenes isn’t code errors — it’s distorted proportions. A convenience store that looks like a toy, a street that’s too narrow, oversized raindrops, or a wrong camera height all destroy realism. Standardize units in your configuration — meters, for example — and specify the store’s width, height, and depth, street width, streetlight height, and camera height.
// Scene parameters (pseudocode, not tied to any rendering library)const config = {unit: "meter",camera: { fov: 55, near: 0.1, far: 260, height: 1.65 },street: { width: 12, length: 80 },store: { width: 6, height: 3.2, depth: 8 },rain: { count: 12000, area: [36, 18, 36], speed: 16 },quality: "auto"};
For the camera, start with a fixed “eye-level” roaming view before adding overhead or low-angle shots. Keep the field of view moderate — too wide and edge distortion breaks the sense of scale. During composition, use a known-size reference object such as a doorframe, curb, or streetlight to check whether the store-to-street proportions look right. AI assistants are good at generating parameters from descriptions, but whether those parameters make sense still requires the developer to judge from screenshots and run results.
The Key to Rainy Night Atmosphere: Local Lights, Wet Surfaces, and Particles
A rainy night isn’t just a darkened environment. What really drives the atmosphere is the relationship between local lights and wet-surface reflections: warm light from the convenience store, cool light from streetlights, and highly saturated signboard light stretch into elongated highlights on the wet ground; rain streaks are more visible near light sources; fog reduces contrast on distant buildings.
Use an “approximation first” strategy: keep ambient light dim, use local light sources for the store and streetlights, and emissive materials for signboards. For the ground, use varying roughness with screen-space approximate reflections, or reflection maps only for the main light sources. Use a particle system for rain — streaks closer to the camera are longer and more transparent, and distant raindrops are reduced in number. Post-processing can slightly boost exposure and contrast, but avoid excessive bloom, or the night scene turns into a blurry wash.
// Rain and wet-ground coordination (pseudocode)function updateWeather(dt, cameraPos, rainIntensity) {rainSystem.update(dt, cameraPos, rainIntensity);wetGround.setReflectionStrength(0.25 + rainIntensity * 0.35);fog.setDensity(0.012 + rainIntensity * 0.01);post.setExposure(nightExposure * (1.0 + rainIntensity * 0.08));}
Rain particles should avoid a “white noise” look: streaks need directionality, with velocity consistent with the wind; splashes on impact can be approximated with short-lived particles or ring-shaped patches; when rain intensity changes, don’t rebuild the whole particle system — adjust the active count and opacity instead to reduce stuttering.
Performance Budgets and Automatic Degradation
In browser-based 3D scenes, performance bottlenecks usually come from particle counts, real-time reflections, overdraw, and post-processing effects. Set a frame rate budget up front: 60 fps target on desktop, 30+ fps on mobile. When the frame rate stays below a threshold, automatically reduce particle count, disable or downgrade reflections, and shrink render resolution.
// Simplified performance degradation (pseudocode)function adaptQuality(fps, quality) {if (fps < 28 && quality !== "low") return "low";if (fps < 45 && quality === "high") return "medium";if (fps > 56 && quality === "low") return "medium";return quality;}function applyQuality(q) {rainSystem.setCount(q === "high" ? 12000 : q === "medium" ? 6000 : 2500);reflection.setEnabled(q !== "low");renderer.setPixelRatio(q === "high" ? Math.min(devicePixelRatio, 2) : 1);}
Also control first-load: load textures on demand and avoid large numbers of high-resolution maps; use instancing or batch merging for buildings and raindrops; toggle post-processing effects by quality tier. AI assistants can quickly produce optimization code, but performance data must be measured on real devices — never judge from the generated result alone.
Make the Interaction Doubles as a Debugging Tool
An interactive piece isn’t just for display — it’s also a debugging tool. Provide a parameter panel for rain intensity, exposure, fog density, quality tier, and camera speed so you can quickly compare different looks. Parameter changes should take effect immediately and support resetting to defaults. For a rainy night scene, rain intensity should ideally be linked to ground reflection strength, fog density, and exposure rather than adjusted independently.
Communicating Effectively with an AI Coding Assistant
The key to productive communication is “stage the work, bring evidence, give constraints.” Round one: request a minimal runnable skeleton. Round two: share screenshots or observed behavior and point out proportion, lighting, or performance issues. Round three: request localized changes, such as tweaking only the raindrop material or optimizing only the particle update loop. Round four: run a regression check. Your prompts should include units, target frame rates, mobile degradation strategy, and any prohibited resource types. Don’t ask the assistant to rewrite all the code at once — that easily introduces uncontrollable regressions.
Acceptance and Iteration Checklist
During acceptance, check: whether the camera height and field of view feel natural; whether the store-to-street proportions are plausible; whether rain streaks show directionality; whether wet-ground reflections concentrate near the main light sources; whether mobile devices trigger degradation; whether the parameter panel takes effect instantly; and whether the frame rate stays stable. Keep a runnable version at every iteration and record what changed, to avoid descending into “the more you fix, the worse it gets.”
Conclusion
The value of AI-assisted coding is turning ideas in your head into runnable prototypes quickly, with support for repeated debugging. But the polish of a scene like a rainy night town depends on the developer’s systematic command of proportion, lighting, particles, performance, and interaction. Translate aesthetic goals into parameters, split one-shot generation into layered iterations, and use run results as evidence for communication — that’s how a “rainy night town” goes from a demo clip to a genuinely playable, extensible browser-based 3D piece.
