Testing and Evaluating 3D Code Generation in Chinese Large Language Models

    This article examines how large language models handle text-to-3D scene generation, using a coastal cycling pelican demo as a reference. It breaks the generation pipeline into five stages, proposes a reusable quality checklist covering composition, lighting, materials, animation, interaction, and runtime metrics, and outlines performance optimizations and production practices such as validation, versioning, CDN delivery, autoscaling, observability, and content moderation. It also lists common failure modes with practical fixes. The key takeaway is that the real differentiator is not whether a model can generate a 3D scene, but whether it can do so reliably, measurably, and at scale.

    1. Why “Generate a 3D Scene from One Sentence” Has Become a New Benchmark

    Evaluating whether a model “can code” used to mean checking whether it could output runnable scripts and fix syntax errors. Once the web became a primary medium for three-dimensional content, the bar shifted: a model now has to produce code that not only runs, but also yields a scene with sound structure, believable visuals, and smooth interaction.

    The reference demo is representative: a stretch of coastal highway, a bicycle, a naturally animated pelican, plus sunset lighting, reflections on the water, a distant lighthouse, and circling seagulls. The difficulty is not any single primitive. It lies in spatial relationships among many elements, consistency of materials and lighting, and performance stability over long runtimes.

    From an engineering standpoint, a successful generation must satisfy four layers of constraints at once:

    • Syntax: HTML, scripts, and styles run standalone with no hard dependency on external assets;
    • Structure: a clear scene graph with distinct responsibilities for camera, lights, geometry, and materials;
    • Presentation: composition, color, materials, and motion that feel aesthetically complete;
    • Runtime: stable frame rate, controlled resource usage, and no interaction stutter.

    Missing any one layer explains the gap between “generate a spinning cube” and “generate a 3D short that looks like a standalone animation.”

    2. Inside the Generation Pipeline: From Natural Language to a 3D World

    Turning one sentence into an interactive scene typically takes five stages.

    2.1 Intent Parsing and Scene Planning

    The model first decomposes natural language into a structured description: the subject, the environment, time and weather, camera language, and interaction model. For “a pelican riding a bicycle,” a reasonable plan includes entries for the subject, the vehicle, the road, vegetation, the sea surface, distant islands, light direction, and the draggable viewing range.

    A structured prompt can be organized like this:

    1. Subject: a pelican in an anthropomorphic riding pose, natural expression
    2. Vehicle: bicycle with plausible spoke and frame proportions
    3. Environment: winding coastal highway, road signs, palm trees, wild grass
    4. Background: isolated island and lighthouse, dolphins leaping, seagulls in the sky
    5. Lighting: low-angle warm sunset, long shadows, highlights on the water
    6. Interaction: 360-degree drag to orbit, looping animation
    7. Constraints: single-file output, no external assets

    The value of structuring is that it converts a vague notion of “looks good” into verifiable items that can be checked and iterated one by one.

    2.2 Code Skeleton Generation

    Here the model emits the base scaffold: scene, camera, renderer, lights, and the animation loop. Quality differences show up in the details — whether a sensible initial camera position is set, whether ambient and key lights are separated, and whether animation updates are decoupled from rendering.

    2.3 Asset and Material Construction

    With no external assets allowed, all geometry and textures must be generated in code. Common approaches include composing the subject from primitives, generating terrain and vegetation distribution parametrically, and producing procedural normal perturbation for the water surface. This stage most heavily tests the model’s grasp of proportion and material language.

    2.4 Motion and Interaction Binding

    Whether motion looks natural depends on appropriate interpolation, easing, and seamless loop transitions. Whether interaction feels right depends on sensible orbit control parameters, damping, and boundary limits.

    2.5 Iterative Refinement

    Getting it right on the first pass is unlikely. The realistic approach is several rounds of targeted fixes, for example “the water reflection is blown out,” “the pelican’s legs are out of sync with the pedals,” or “the background lacks depth.”

    3. Quality Evaluation: Judging Whether a Result Holds Up Close

    Use a reusable checklist instead of scoring on overall impression.

    • Composition and camera: is the subject at the visual center of gravity, and are foreground, midground, and background layered?
    • Lighting consistency: do shadow directions agree, and does the warm sunset harmonize with ambient color?
    • Material credibility: do water, metal, and vegetation respond differently, rather than sharing one plastic look?
    • Animation quality: are loops seamless, and are limb-to-vehicle contact points locked?
    • Interaction: is dragging smooth, is zoom bounded, does the camera clip through geometry?
    • Runtime metrics: is the frame rate stable, does memory keep growing, is the single-file size controlled?

    “Contact point locking” and “seamless loops” are the two most overlooked items and the clearest markers of finish. The former determines whether the character appears to float above the vehicle; the latter determines whether long viewing breaks immersion.

    4. Performance and Resource Governance: The Step from Demo to Usable

    A demo clip can tolerate some jitter, but real applications must account for runtime cost. Practical measures include:

    1. Reuse and instance geometry to cut redundant draw calls;
    2. Cap the pixel ratio to avoid doubling render cost on high-DPI screens;
    3. Substitute low-poly models or textures for distant objects;
    4. Layer static and dynamic parts to avoid unnecessary matrix updates;
    5. Pause the render loop when the page is not visible;
    6. Define a mobile fallback, such as disabling high-precision water and shadows.

    A simplified fallback switch:

    1. const isMobile = window.matchMedia('(max-width: 768px)').matches;
    2. const renderScale = isMobile ? 1.0 : Math.min(window.devicePixelRatio, 2);
    3. renderer.setPixelRatio(renderScale);
    4. renderer.shadowMap.enabled = !isMobile;

    These engineering details never show up in a “stunning screenshot,” yet they decide whether a solution actually gets adopted.

    5. Productionization: From Single-File Demo to Online Service

    When generated output must be delivered to users reliably, a single-file demo has to grow into a full pipeline:

    • Generation and validation: syntax checks, asset reference checks, and sampled performance checks on the output;
    • Version management: log prompts, model versions, and generation parameters together for reproducibility;
    • Content delivery: serve static assets from object storage, paired with a content delivery network to reduce latency;
    • Elastic capacity: run rendering or generation services on a container platform with traffic-based autoscaling;
    • Observability: connect logging and alerting to track failure rate, latency, and frame rate distribution;
    • Security and compliance: review generated content and apply access control so unpredictable output never reaches users directly.

    Under Baidu AI Cloud’s general capability framework, these stages can be handled by standard product categories such as object storage, container platforms, logging, and monitoring and alerting, forming a closed loop of “generate — validate — deliver — observe” without binding to any proprietary interface.

    6. Common Failure Modes and Fixes

    • Subject proportion imbalance: lock key size ratios first, then add detail;
    • Converging materials: assign independent roughness and metalness ranges per category;
    • Animation drift: set loop periods to whole frames or a unified time base;
    • Camera clipping: set minimum distance and polar angle limits on orbit controls;
    • Hollow background: add fog layering and low-poly distant elements;
    • Single-file bloat: replace large textures with procedural generation, and degrade on demand when necessary.

    7. Conclusion

    The significance of “generating an interactive 3D scene from one sentence” is that it turns code into a common interface connecting images, video, games, and spatial computing. For developers, the real dividing line is not whether generation is possible, but whether it can be done reliably, evaluably, and operably. Structuring prompts, turning evaluation into a checklist, and moving performance and governance upstream are what carry this capability from demo to production.