Evaluating LLM-Generated 3D Code: Balancing Quality and Efficiency

    Large language models can now generate 3D interactive and animated code, but simply checking whether a page opens or scripts throw errors is no longer enough. This article presents a general-purpose evaluation methodology for 3D code generation tasks, covering evaluation boundaries, dual-task design (an explodable mechanical insect and a container crane simulation), six quality dimensions, case-study comparisons across three anonymized models, efficiency-versus-quality trade-offs, and automated acceptance checks. Readers will learn how to build a reliable, reproducible benchmark for comparing model outputs and making engineering-ready selection decisions.

    LLM-generated 3D interactive and animation code has moved from “can it produce a demo” to “is it ready for engineering delivery.” Judging quality solely by whether a page loads or scripts throw errors is no longer sufficient. A meaningful evaluation must answer two questions simultaneously: is task quality maintainable, demonstrable, and extensible; and can the task be completed within reasonable time with low rework cost. This article offers a general technical methodology for horizontally evaluating 3D code generation, illustrated by two typical case studies that highlight common differences and acceptance criteria. For clarity, the participating models are referred to as Plan A, Plan B, and Plan C; the numbering is used only for experiment distinction and does not point to any specific commercial product.

    1. Evaluation Boundaries: Fix Variables Before Comparing Capability

    The biggest risk in horizontal evaluation is “uncontrolled variables.” If the same prompt is run under different execution environments, dependency versions, hardware, or levels of manual intervention, the resulting time and quality are not comparable. Therefore, evaluation should at minimum fix the following conditions:

    1. Unified prompts: Use “wish-list” descriptions that resemble real business requirements, without hidden extra constraints, and observe whether the model can fill in engineering details on its own.
    2. Unified execution agent: Use the same task dispatch, file collection, run/preview, and logging pipeline to eliminate differences caused by manual operation.
    3. Unified runtime environment: Fix browser version, graphics API capability, device performance, and network conditions; record first-paint time, failed resource loads, and script errors.
    4. Unified acceptance criteria: Score functional correctness, structural realism, visual narrative, engineering robustness, maintainability, and efficiency/cost separately, instead of relying on “first-impression” effects.

    This boundary set is not complicated, but it dramatically increases the credibility of conclusions. Otherwise one model might appear more complete simply because its default camera angle is better, while another might be misjudged as “over-engineered” because it splits parts more finely.

    2. Task Design: Two Tasks Covering Interaction and Animation

    The evaluation includes two task types. The first is a “disassemblable 3D mechanical structure demonstration,” focusing on interaction logic, part organization, explosion animation, and visual narrative. The second is a “port container gantry crane,” focusing on physical structure design, kinematic chains, animation state machines, and web aesthetics. Neither task requires a complex backend, but both require a genuinely runnable frontend 3D scene.

    Core acceptance points for Task One include: whether the scene renders correctly; whether the disassembly feature is genuinely functional; whether part hierarchies are clear; whether the explosion animation has rhythm; whether the default camera angle is appropriate; whether the UI has loading states and operation hints; and whether accessibility and resource release are considered.

    Task Two goes further, examining: whether the motion relationships between the boom, rails, spreader, and containers are sensible; whether animation loops are stable; whether collisions and clipping are controlled; whether camera interaction is smooth; and whether the page layout has presentation-grade aesthetics.

    Prompts can stay concise—for example, “Create a disassemblable 3D mechanical insect with step-by-step teardown and component descriptions,” or “Create a working container crane in a port scene with camera controls and animation playback.” Concise prompts better reflect real user expression and also reveal whether a model can fill in engineering details on its own.

    3. Evaluation Metrics: Quality Is Not a Single Score

    Split evaluation into six dimensions, each backed by observable evidence:

    • Functional correctness: Zero script errors, zero failed resource loads, and genuinely effective core interactions. Note that “looks 3D but cannot be disassembled” is high-risk false delivery.
    • Structural realism: Whether part counts, hierarchy, and kinematic relationships match common sense. More parts is not automatically better, but critical structures must not be merged away.
    • Visual and narrative quality: Whether color, materials, lighting, annotation lines, camera language, and overall storytelling serve the demonstration goal. A museum-specimen narrative and a steampunk style can both work, as long as they match the task.
    • Engineering robustness: Presence of loading states, error feedback, responsive layout, accessibility attributes, reduced-motion support, deterministic randomness, and resource release.
    • Maintainability: Whether the code structure is clear; whether scene, parts, animations, and UI are decoupled and easy to modify.
    • Efficiency and cost: Time from prompt submission to a runnable deliverable, plus the manual rework time needed to fix clipping, exposure, camera, UI, and other issues.

    Among these, functional correctness is the threshold; structural realism and visual narrative determine whether it “looks right”; engineering robustness and maintainability determine whether it “can be delivered”; and efficiency/cost determines whether it is “worth it.”

    4. Case Study: Three Patterns in the Disassemblable Mechanical Structure

    In the disassemblable 3D mechanical insect task, all three deliverables ran correctly, with zero script errors and zero resource load failures; the disassembly worked and none exhibited the “looks 3D but can’t be disassembled” failure. But the differences became clear on close inspection.

    Plan A completed in about 7 minutes with the best visual quality and professionalism. It used a museum-specimen narrative, showing component annotation lines with real-time projected positioning once teardown exceeded 28%; it was the only solution to model elytra (wing cases), matching the firefly’s biological identity as a beetle. It also included three-tier responsive layout, 18 accessibility attributes, reduced-motion preference support, deterministic randomness, environment-map pre-filtering, and GPU memory release. Its weakness: only nine major parts, with the six legs merged into one component—insufficient structural granularity.

    Plan B took about 9 minutes and was the most recognizable as a firefly. It used a steampunk palette of cyan-green cold light and brass, and built the wings with Bézier membranes and wing ribs—the most refined wing surfaces of the three—while keeping four wings and six legs. However, it had three obvious problems: gear-to-thorax-side-plate clipping, underexposed default lighting, and a UI with only two buttons and no loading state. These issues didn’t prevent it from running, but they would clearly add rework before delivery.

    Plan C took about 32 minutes and pushed disassembly to the extreme. It contained 32 independent parts: the thorax had upper and lower shells plus an equatorial seam ring; opening it revealed drive wheels, secondary gears, drive shafts, and energy conduits. The abdomen’s six segments retracted one by one like a concertina, and after disassembly the parts could expand in staggered index order. Its weakness: the default camera was too far away, and the opening state was fully disassembled and then reassembled backward, which could easily make users think the scene was broken.

    This comparison shows clear trade-offs among part count, visual style, and engineering details. Finer parts can increase realism but lengthen generation time and increase camera/animation tuning costs; a stronger visual narrative can improve the demo but may come with insufficient structural granularity; a more recognizable design lacking loading states and clipping checks will still lose points at acceptance.

    5. Case Two: The Port Crane Tests Kinematics and State Management

    The container gantry crane task is more complex than static display. It requires the model to understand the motion relationships among boom, rails, spreader, and containers, and to organize the animation into an operable state machine. During acceptance, observe whether: the crane has a clear base, column, boom, and spreader hierarchy; boom rotation and trolley translation are decoupled; spreader elevation is consistent with container grab state; animation loops are stable; camera control avoids passing through walls or into the model; and the page has loading states, operation hints, and error fallbacks.

    Common failure patterns in this task include: structure that looks complete but has a broken kinematic chain; spreader-container clipping; animation states that cannot switch; default camera views that fail to show the whole scene; and UI buttons lacking disabled and loading states. Compared with the mechanical insect, the crane demands a combination of “physical structure design + web aesthetics + interaction state management.” Evaluation cannot rely on screenshots alone—you must actually click, play, switch camera views, and record anomalies.

    6. Weighing Efficiency and Quality

    Timing data is important but cannot stand alone as a conclusion. The 7-minute, 9-minute, and 32-minute differences reflect different design depths and rework risks. Fast solutions suit rapid prototyping and creative exploration, but require manual completion of default camera angles, structural granularity, and engineering details. Mid-speed solutions may be stronger visually, but must prioritize fixing clipping, exposure, and loading states. Long-running solutions may reduce structural rework, but poor default camera and opening-state design can still create comprehension costs.

    A more reasonable approach is to compute the total cost of ownership: generation time + manual repair time + subsequent maintenance cost. A 7-minute deliverable that needs 30 minutes of camera and structure fixes may not beat a 32-minute deliverable with a clear structure; a 9-minute deliverable with visible clipping and a missing UI will still consume extra time before a demonstration.

    7. Reproducibility and Automated Acceptance

    To make evaluation reproducible, archive run logs, screenshots, performance samples, and deliverables in general-purpose object storage, and use a container platform to pin the runtime environment; on Baidu AI Cloud, object storage, container platform, logging, and monitoring services can form such a traceable closed loop. Automated acceptance can be expressed in pseudocode:

    1. function validateScene(scene) {
    2. assert(scene.runtimeErrors.length === 0)
    3. assert(scene.resourceFailures.length === 0)
    4. assert(scene.parts.length > 0 && scene.parts.every(p => p.canExplode))
    5. assert(scene.ui.hasLoadingState)
    6. assert(scene.a11y.reducedMotionSupported === true)
    7. assert(scene.resources.released === true)
    8. }

    Also record first-paint time, stable frame rate, peak memory, resource request count, interaction response latency, and default camera field-of-view coverage. For teardown tasks, additionally check whether annotation-line thresholds stay in sync with teardown progress; for crane tasks, check whether animation state transitions are repeatable and free of clipping and state deadlocks.

    8. Selection Recommendations and Conclusion

    If the goal is rapid prototyping and creative validation, prefer a solution with fast generation and strong visual identity, but include loading states, exposure, clipping, and camera perspective in the acceptance checklist. If the goal is a presentation-grade deliverable, choose a solution with clear structure, complete engineering details, and good maintainability, accepting longer generation time. If the goal is long-term maintenance, focus on scene layering, animation state machines, resource release, and accessibility support, not just first-screen effects.

    The conclusion: evaluating LLM 3D code generation cannot stop at “does it run.” A more professional approach is to fix variables, design dual tasks, split metrics, record time and rework cost, and use automated checks as a safety net. Only by bringing both task quality and task efficiency into the evaluation can a team establish reliable model selection and acceptance standards.