Building a Rainy Night Town with AI Coding Tools and Web 3D Technology

    This article explores how AI-assisted programming tools and Web 3D technologies can turn a visual concept into an interactive, runnable prototype. Using a rainy-night convenience store scene as an example, it covers scene design, technology selection, iterative development, performance optimization, lighting, and cloud deployment. It also explains why human judgment remains essential for achieving accurate proportions, smooth performance, and a convincing atmosphere.

    In digital content creation, turning a fleeting idea into an interactive, runnable application often requires developers to cross a long and complex coding gap. As large language models and AI-assisted programming tools continue to evolve, this process is undergoing a major transformation.

    This article uses a 3D interactive “rainy night town” scene as an example to explore how AI coding tools can be combined with Web 3D technologies to move quickly from a concept to a working prototype. Although scene proportions, performance tuning, and visual details still require repeated communication and debugging, this development model can significantly shorten the time needed to validate creative ideas.

    1. Scene Design and Technology Selection

    Building an immersive rainy-night town requires a balance between visual atmosphere and interactive performance.

    Visual Elements

    • Building structure: The main geometry is a convenience store. It should convey the transparency of nighttime glass windows while maintaining believable architectural proportions.
    • Environmental atmosphere: The scene should include a raindrop particle system, subtle reflections on wet ground, and a dark night-sky background.
    • Lighting system: Point lights along the street, soft ambient lighting, and bloom effects from neon signs help establish the scene’s visual mood.

    Technology Stack

    For convenient cross-platform previews, the Web is an effective delivery platform. A modern 3D rendering engine based on the WebGL standard can provide essential capabilities such as scene-graph management, materials, lighting models, and camera controls.

    These engines are capable of rendering complex scenes in real time while offering broad compatibility across different devices and platforms.

    2. A Workflow for AI-Assisted Development

    Traditional 3D scene development requires developers to manually write large amounts of initialization, material-binding, and animation-loop code. AI coding tools can simplify much of this process.

    Communicating Requirements and Generating the Architecture

    The first step is to describe the target scene to the AI coding tool in natural language:

    “Build a Web 3D rainy-night convenience store with a glowing sign, falling raindrops, and reflections on wet ground.”

    Based on this description, the tool can generate the basic project structure, including renderer initialization, camera configuration, and the main rendering loop.

    Iterative Modules and Interaction

    Once the initial framework is available, developers can continue instructing the tool to add specific modules. For example:

    “Add an orbit camera that can be controlled with the mouse so users can inspect the convenience store from different angles.”

    The AI coding tool can then generate the corresponding controller logic and integrate it into the main rendering loop, providing an initial interactive experience.

    3. Core Technical Challenges and Solutions

    Although AI coding tools can quickly produce functional code, a complex 3D scene rarely works perfectly on the first attempt. Several aspects require repeated refinement.

    Calibrating Scene Proportions and Spatial Layout

    The initial geometry generated by an AI coding tool may have inaccurate proportions. For example, the convenience store sign may be too large, or the street may be too narrow, making the space feel unnatural.

    A practical solution is to provide explicit numerical constraints. Developers can use instructions such as:

    “Set the main convenience store dimensions to 10 units wide, 4 units high, and 8 units deep. Move the camera to (0, 5, 15) and set the field of view to 60 degrees.”

    Clear constraints help calibrate the spatial relationships and produce a more effective composition.

    Balancing Rendering Performance

    A large number of raindrop particles can cause frame rates to drop on lower-end devices. Complex reflection effects can also consume substantial computing resources and make the scene feel sluggish.

    To improve performance, developers can guide the tool toward more efficient implementations. For example, GPU instancing can be used to render raindrops while keeping the total particle count within a reasonable range.

    For wet-ground reflections, a physically based rendering (PBR) material using roughness and metallic properties, combined with an environment map, can simulate reflections without relying on expensive real-time planar reflections.

    Refining Lighting and Particle Details

    The atmosphere of a rainy night depends heavily on lighting. Automatically generated lights may initially appear flat and lack visual depth.

    Developers can ask the AI tool to add volumetric lighting or a bloom post-processing effect, then adjust the color and intensity of individual light sources. The following is a conceptual example of an optimized lighting setup:

    1. // Conceptual example of key lighting and bloom
    2. const ambientLight = new AmbientLight(0x1a1a2e, 0.5); // Subtle cool ambient light for the night scene
    3. const streetLight = new PointLight(0xffaa44, 2, 20); // Warm street light for local illumination
    4. streetLight.position.set(5, 5, 5);
    5. scene.add(ambientLight, streetLight);
    6. // Enable bloom post-processing to enhance the neon sign
    7. const bloomPass = new UnrealBloomPass(new Vector2(width, height), 1.2, 0.4, 0.85);
    8. composer.addPass(bloomPass);

    This code is provided as a general conceptual example. The specific class names and APIs depend on the underlying rendering engine.

    4. Cloud Deployment and Online Preview

    After local development and debugging are complete, quickly sharing the scene for online testing is an important part of validating the concept. General-purpose cloud infrastructure, such as services provided by Baidu AI Cloud, can support this process.

    Application Hosting

    A Web 3D application’s frontend static resources can be deployed through a cloud application-hosting platform or container service. These services can simplify deployment and provide an accessible domain, reducing the need for manual server configuration.

    Asset Acceleration

    3D scenes often include relatively large models and texture files. Hosting these assets in an object storage service and delivering them through a content delivery network (CDN) can reduce the initial loading delay and improve the smoothness of the online preview experience.

    5. Conclusion and Outlook

    This project demonstrates that AI coding tools can serve as powerful assistants in 3D scene development. They can reduce the amount of repetitive boilerplate code developers need to write and help turn visual ideas into runnable, interactive prototypes more quickly.

    However, high-quality 3D work still depends on professional visual judgment and technical decision-making. Fine-tuning proportions, optimizing performance, and creating a convincing atmosphere all require repeated collaboration between the developer and the tool.

    As AI coding tools gain a deeper understanding of computer graphics, the path from an initial concept to a high-fidelity 3D application is likely to become increasingly efficient.