Building a 3D Rainy Night Convenience Store Prototype via LLM Collaboration

    Using Large Language Models (LLMs) to generate interactive 3D scenes offers rapid prototyping, but the output quality heavily depends on communication strategies. This article outlines a practical collaboration method using a "rainy night convenience store" as a case study. It covers how to break down vague visual concepts into verifiable technical requirements, establish checks for scale and performance, implement atmospheric details like rain and neon lighting, and optimize rendering performance. By following this structured iterative approach, developers can effectively transform LLM-generated code into functional and visually appealing 3D web prototypes.

    1. Background and Goals

    Using Large Language Models (LLMs) to generate interactive visual content is becoming a common practice in frontend and game prototype development. Developers describe an idea, the model outputs code, and the developer runs, observes, and requests modifications. This loop is fast, but the quality of the result highly depends on the communication approach. Models rarely produce a finished product with accurate proportions, acceptable performance, and proper details on the first try.

    This article uses a “rainy night convenience store” as a practice topic to illustrate a practical collaboration method. There are three main goals: first, to break down vague visual imagination into verifiable technical requirements; second, to establish inspection methods for proportions, performance, and visual details; and third, to form a reusable iteration record.

    2. Why This Scenario?

    The rainy night convenience store is an excellent test scenario because it simultaneously contains multiple typical web graphics challenges:

    • Spatial Structure: Shelves, checkout counters, freezers, and doors need to maintain reasonable size relationships.
    • Lighting and Materials: Glowing signs, warm indoor lighting contrasting with the cold outdoor rainy night, and mirror reflections from puddles on the ground.
    • Dynamic Effects: Falling raindrops, flickering neon signs, and water streaks on glass all need to run continuously.
    • Interaction: Camera movement, clicking on products, and opening/closing doors test event handling and state management.

    A single scene covering structure, lighting, animation, and interaction can comprehensively expose the weak points of model-generated code.

    3. Breaking Ideas into Verifiable Requirements

    Directly prompting the model to “create a highly atmospheric rainy night convenience store” usually results in a conceptual output lacking item-by-item verification criteria. A more effective approach is to break down the requirements first, writing each one as an observable or measurable condition.

    3.1 Module Breakdown

    It is recommended to divide the requirements into the following modules and specify them separately:

    1. Spatial Layout: Overall room dimensions, entrance position, and shelf arrangement direction.
    2. Lighting Scheme: Intensity and color of the main light source, fill light, and sign self-emission.
    3. Rain Effect and Ground: Number of raindrops, falling speed, and puddle reflection intensity.
    4. Object Details: Product types, sign text, and reflectivity of the glass windows.
    5. Interactive Behavior: Camera movement range, clickable objects, and their feedback.

    Each module should have a clear acceptance criterion. For example, “Shelves are approximately 1.8 meters high, arranged in four parallel rows, with aisle widths no less than 1.2 meters.” Such descriptions can be directly used for inspection.

    3.2 Multi-round Communication Rhythm

    In practice, effective communication generally follows these rules:

    • First, provide overall constraints, including size units, coordinate system orientation, and target runtime environment, then ask the model to generate the first version.
    • Change only one variable per round. If you adjust lighting, proportions, and rain volume simultaneously, it is difficult to locate the cause when issues arise.
    • Request complete, directly runnable single-file output to prevent errors introduced by developers manually splicing code snippets.
    • Record each output, specifying the changes made and the observed effects for easy backtracking.

    3.3 Result Verification

    Every generated version should undergo a three-step check: whether it runs without errors, whether the visuals match the acceptance criteria, and whether the frame rate is within an acceptable range. During verification, it is best to use fixed-angle screenshots and compare them with the previous version to avoid subjective judgment being affected by memory.

    4. Scale and Proportion Control

    In 3D scenes, proportion issues are the most easily overlooked. Models often mix “pixels,” “meters,” and arbitrary units, causing shelves to look like toys or doors to exceed the ceiling height.

    It is recommended to agree on a unit system in the first round of communication, such as specifying that 1 unit equals 1 meter, and provide reference sizes for key objects:

    Object Reference Size (Width × Height × Depth, Unit: meters)
    Store interior 8 × 3 × 6
    Entrance door 1.0 × 2.1 × 0.1
    Standard shelf 1.2 × 1.8 × 0.4
    Checkout counter 2.0 × 1.1 × 0.7
    Freezer 1.5 × 1.2 × 0.7

    These numbers are not mandatory standards but rather reasonable ranges common in convenience stores. By providing reference sizes, the objects generated by the model are more likely to form correct relative relationships. During verification, you can place a humanoid reference object (about 1.7 meters) in the scene to directly observe whether the proportions are coordinated.

    5. Implementation of the Rainy Night Atmosphere

    5.1 Rain Effect

    The rain effect is the most intuitive source of atmosphere but also the easiest to slow down performance. There are two common approaches: using numerous thin line segments to simulate raindrops, or using a particle system to render small textures with transparency. Both require object reuse to avoid creating and destroying objects every frame.

    Below is a schematic implementation relying only on standard web interfaces, using a 2D canvas overlaid on the 3D scene to simulate diagonal falling rain:

    1. const canvas = document.getElementById('rain');
    2. const ctx = canvas.getContext('2d');
    3. let width, height, dpr;
    4. function resize() {
    5. dpr = Math.min(window.devicePixelRatio || 1, 2);
    6. width = window.innerWidth;
    7. height = window.innerHeight;
    8. canvas.width = width * dpr;
    9. canvas.height = height * dpr;
    10. canvas.style.width = width + 'px';
    11. canvas.style.height = height + 'px';
    12. ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
    13. }
    14. window.addEventListener('resize', resize);
    15. resize();
    16. const DROP_COUNT = 400;
    17. function spawn(randomY = false) {
    18. return {
    19. x: Math.random() * width,
    20. y: randomY ? Math.random() * height : -20,
    21. len: 10 + Math.random() * 14,
    22. speed: 400 + Math.random() * 300, // pixels per second
    23. };
    24. }
    25. const drops = Array.from({ length: DROP_COUNT }, () => spawn(true));
    26. let last = performance.now();
    27. function frame(now) {
    28. // Limit single-frame time to prevent raindrops from jumping instantly when the tab is switched back
    29. const dt = Math.min((now - last) / 1000, 0.05);
    30. last = now;
    31. ctx.clearRect(0, 0, width, height);
    32. ctx.strokeStyle = 'rgba(180, 200, 255, 0.35)';
    33. ctx.lineWidth = 1;
    34. ctx.beginPath();
    35. for (let i = 0; i < drops.length; i++) {
    36. const d = drops[i];
    37. d.y += d.speed * dt;
    38. d.x -= d.speed * dt * 0.12; // slight wind direction
    39. if (d.y > height + 20) {
    40. drops[i] = spawn(false);
    41. continue;
    42. }
    43. ctx.moveTo(d.x, d.y);
    44. ctx.lineTo(d.x + d.len * 0.12, d.y + d.len);
    45. }
    46. ctx.stroke();
    47. requestAnimationFrame(frame);
    48. }
    49. requestAnimationFrame(frame);

    There are three notable points in this code. First, the raindrop objects are reused in the loop, only replacing out-of-bounds objects, resulting in no extra memory allocation. Second, the time increment has an upper limit to ensure no visual jumping occurs when the page recovers from the background. Third, the device pixel ratio is capped at 2 to control drawing overhead on high-resolution screens.

    5.2 Lighting and Reflection

    The key to a rainy night is contrast: warm indoor lighting coexists with cold outdoor ambient light, while signs and windows form local highlights. Implementation can follow these principles:

    • Use emissive materials for signs and light tubes instead of adding numerous point lights. Emissive lighting is low-cost and visually sufficient.
    • The number of point lights must be limited to a few, typically only setting real lights above the checkout counter and in the main aisle.
    • Ground puddle reflections can use environment maps or pre-rendered reflection textures, as fully real-time mirror reflection calculations are costly.
    • Window reflectivity is achieved by adjusting transparency and specular intensity, requiring no complex refraction calculations.

    5.3 Neon and Glow

    Sign flickering can be controlled using a simple sine function with a small amount of random noise to prevent all light tubes from having the exact same rhythm. Such small details significantly enhance realism at a very low implementation cost.

    6. Performance Optimization

    Performance issues in 3D web pages usually center on four aspects: draw call count, light source count, shadow computation, and particle scale.

    6.1 Reduce Draw Calls

    Similar objects should be merged as much as possible. For example, shelves with the same product can use instanced rendering to submit multiple copies at once; static walls and floors can be merged into a single geometry. Textures should also be merged into the same atlas to reduce material switches.

    6.2 Control Lights and Shadows

    Real-time shadows are expensive. In a rainy night scene, the visual contribution of shadows is usually less important than lighting color. You can enable shadows only for the main light source and reduce the shadow map resolution. The total number of light sources should be kept low; any excess should be converted to baked or faked lighting.

    6.3 Particle Count and Frame Budget

    At a target of 60 FPS, the available time per frame is about 16.6 milliseconds. Rain effects, physics updates, render submissions, and UI logic share this time. The particle count should be adjusted based on the actual device frame time rather than fixed by experience. You can record the frame time curve during development to find the bottleneck before deciding which part to cut.

    6.4 Pause Invisible Rendering

    When the page switches to the background, the render loop should be paused. Listening to the visibility change event accomplishes this and can significantly reduce laptop battery consumption and heat.

    7. Common Issues in Iteration

    Phenomenon Possible Cause Solution
    Disproportionate shelves Units or reference sizes not defined Re-provide the size table in the prompt and ask the model to label units
    Dull visuals Insufficient light intensity and contrast Adjust sign brightness and ambient light separately, changing only one item at a time
    Rain effect causes performance hit Too many particles or object recreation per frame Switch to object pooling and dynamically adjust count based on frame time
    Unnatural ground reflection Improper reflection texture resolution or blur Lower reflection intensity, add slight blur and random noise
    Other parts broken after modification Model rewrote unrelated code Request only the changed part, or specify modules that must remain unchanged

    The last item in the table deserves special attention. When modifying one area, the model often conveniently rewrites other functions, causing previously verified effects to disappear. The solution is to explicitly list unmodifiable parts in each round’s prompt and request a diff explanation.

    8. Engineering Recommendations

    The prototype stage allows for rapid iteration, but if long-term maintenance is desired, the following organization should be done:

    1. Centralize scene parameters (dimensions, light intensity, rain volume, colors) into a single configuration file to prevent them from being scattered throughout the code.
    2. Keep version records for each generated result, including prompt content, modification notes, and screenshots for easy rollback.
    3. Test in at least two mainstream browsers, paying attention to rendering results and frame rate differences.
    4. Provide degradation fallbacks for devices that lack relevant graphics capabilities, such as disabling reflections or reducing particle count.
    5. Retain performance baseline data and re-measure after every major change to prevent performance from quietly degrading while visual effects improve.

    9. Summary

    Using LLMs to generate 3D scene prototypes yields efficiency gains primarily from improved communication methods: breaking down requirements first, agreeing on units and acceptance criteria, changing only one variable per round, and performing fixed-angle comparative verification of results. Topics like the rainy night convenience store combine space, lighting, animation, and interaction, making them suitable for testing this methodology. The model’s first version is rarely perfect, but as long as verification steps and version records are maintained, a runnable and evaluable piece can be achieved in just a few iterations.