Using LLMs to Build a Rainy-Night Convenience Store 3D Scene
This article presents a practical workflow for using large language models to build a rainy-night convenience store 3D scene, covering requirement breakdown, scale calibration, rain particles, lighting and materials, performance optimization, iterative prompting, and pre-delivery checks.
1. Why a Rainy-Night Convenience Store Is a Good Practice Scene
A rainy-night convenience store is a practical scene for 3D practice. Its elements are limited: a storefront facade, several rows of shelves, a glowing sign, puddle reflections on the ground, and continuous rain. These elements map directly to foundational skills such as geometry modeling, lighting, materials, particle systems, and post-processing. The scene is small enough to validate ideas quickly, yet detailed enough to expose common problems such as incorrect proportions and performance bottlenecks.
2. Breaking the Idea into Executable Requirements
Large language models respond poorly to vague descriptions. If you only ask for “a good-looking rainy-night convenience store,” the result is often runnable but hard to control. A more effective approach is to break the requirements into four layers:
- Spatial structure: room dimensions, door and window positions, and the relative placement of the counter and shelves. Use the same unit system for all dimensions.
- Visual style: color temperature, neon palette, rain intensity, and how wet the ground should look.
- Interaction: whether the camera can move, and whether users need to click products to view information.
- Performance budget: target frame rate, target device types, and the maximum number of objects on screen.
Write each layer as an explicit constraint so the model can produce an implementation you can check against. For example, “shelves are 2 meters high, have 4 tiers, and are spaced 0.45 meters apart” is easier to verify than “make the shelves a bit taller.”
3. Calibrating Proportions and Dimensions
When generating 3D code, large language models often choose units arbitrarily, which can cause doors, windows, and human figures to be out of proportion. The solution is to define unified size constants at the start of the project and agree that 1 unit equals 1 meter:
// Unified size constants: 1 unit = 1 meterconst SIZE = {storeWidth: 6, // Storefront widthstoreDepth: 8, // Store depthceilingHeight: 3, // Ceiling heightshelfHeight: 2, // Shelf heightcounterHeight: 1.1, // Counter heighthumanHeight: 1.7, // Reference human height};
After modeling, place a 1.7-meter reference cube in the scene. Put it at the entrance and next to the counter, then observe how the door frame, shelves, and counter relate to the reference object. Most proportion issues can be found at this stage rather than being exposed later when adjusting lighting and shadows.
4. Implementing Rain Effects
Rain is the visual core of this scene, and it is also the part most likely to consume performance. A common approach is to represent raindrops with thin line segments or stretched points. Each particle has a fall speed and returns to the top after falling below the ground, creating a loop.
const RAIN_COUNT = 5000;const rainPositions = new Float32Array(RAIN_COUNT * 3);// Initialization: randomly distribute particles in the space above the storefor (let i = 0; i < RAIN_COUNT; i++) {rainPositions[i * 3] = (Math.random() - 0.5) * 20; // xrainPositions[i * 3 + 1] = Math.random() * 15; // yrainPositions[i * 3 + 2] = (Math.random() - 0.5) * 20; // z}// Per-frame update: fall and loopfunction updateRain(dt) {for (let i = 0; i < RAIN_COUNT; i++) {rainPositions[i * 3 + 1] -= 12 * dt;if (rainPositions[i * 3 + 1] < 0) {rainPositions[i * 3 + 1] = 15;}}markBufferDirty(rainGeometry); // Notify the rendering layer that the buffer has been updated; the exact API depends on the project}
This code updates each particle on the CPU. When the particle count is high, move position calculations to the vertex shader and pass only time and initial seeds to the shader. This can significantly reduce per-frame data uploads. The tradeoff is that the CPU approach is easier to debug, while the GPU approach is better suited to large-scale particles.
The appearance of rain also depends on transparency and an approximation of motion blur. Raindrop opacity can be adjusted based on distance from the camera: clear in the foreground and faded in the distance, creating a sense of depth.
5. Lighting and Materials: Creating the Rainy-Night Mood
The rainy-night atmosphere comes mainly from the interaction between light and wet surfaces. Organize lighting according to the following principles:
- Warm-cool contrast: interior fluorescent lights are closer to white, the neon sign leans warm or magenta, and streetlights lean orange-yellow. This contrast gives the image depth.
- Controlled light count: let only one or two main lights cast shadows. Simulate other lights with emissive materials or textures to avoid excessive shadow computation costs.
- Ground reflection: set puddle roughness low and use an environment reflection map to produce clear reflections. If roughness is too high, the water surface will look like ordinary concrete.
- Point light attenuation: limit the neon light range to the area near the store entrance and set the falloff distance properly so the entire street is not lit.
For materials, use medium roughness for metal shelf parts, low roughness with slight transparency for glass doors, and normal-mapped textures for floor tiles to convey a wet, slippery feel. These parameters need repeated adjustment in the actual rendered image; the values generated on the first pass are usually off.
6. Common Performance Optimizations
After the basic functionality is complete, run a systematic performance review. Common optimizations include:
- Merge geometry: combine static objects with the same material into one mesh to reduce draw calls.
- Instanced rendering: render large numbers of identical product boxes on shelves with instancing, storing only their individual transform matrices.
- Shadow budget: keep shadow map resolution within a reasonable range and limit the shadow camera to the store interior instead of covering the entire scene.
- Particle quality tiers: provide low, medium, and high rain settings based on device performance, with medium as the default.
- Texture size and format: choose texture resolution based on actual on-screen display size and use compressed formats.
- Pixel ratio cap: limit the rendering pixel ratio on high-resolution screens. On mobile, rendering at the native pixel ratio is not recommended.
Measure before optimizing. Check frame time and draw call counts in developer tools, identify the bottleneck, and then make changes instead of modifying code blindly.
7. Working Through Multiple Iterations
LLM-assisted development usually requires multiple rounds of iteration, and the quality of communication in each round directly affects the result. The following practices help reduce rework:
- Change only one category of issue per round. For example, adjust proportions in one round and lighting in the next. Avoid changing several areas at once, which makes problems hard to isolate.
- Describe specific symptoms when reporting issues. “The neon light at the entrance is too bright, and the floor light patch extends beyond the storefront” is easier to act on than “the lighting looks bad.”
- Ask the model to explain its plan before changing code. Confirming the approach first reduces wasted code.
- Keep every runnable version. Back up or tag each successful version so you can roll back quickly if something breaks.
- Use references rather than subjective feelings. Proportions, brightness, and frame rate should all be judged against measurable or visual references.
During multi-round communication, the model may accidentally change other parts while fixing one issue. When you find such a regression, point it out explicitly and require the model to modify only the specified location.
8. Pre-Delivery Checklist
Before delivery, confirm each item on the following checklist:
- Proportions: the reference object’s size relative to doors, windows, shelves, and the counter matches expectations.
- Performance: test frame rate on target devices and confirm that low-end devices can still run the scene.
- Loading: if textures or models fail to load, the scene has a fallback and does not go blank or stop with an error.
- Interaction: camera controls and click events work on different input devices, with keyboard alternatives provided.
- Resources: release geometries, materials, and textures when switching pages or destroying the scene to avoid memory leaks.
- Compatibility: open the scene in mainstream browsers on desktop and mobile and confirm that rendering results are consistent.
This workflow is not complex, but it determines whether an LLM-assisted 3D scene can move from a runnable sample to a stable, usable piece of work.
