Evaluating Spatial Reasoning in LLMs: A Guide to Code-Generated 3D Scenes
As large language models are increasingly used to generate 3D scenes and procedural animations, evaluating them requires more than checking whether the code runs or the visuals look good. This guide explains how to assess spatial reasoning through code-generated 3D scenes: from translating natural-language requirements into geometric constraints, to testing hierarchical relationships, coordinate transforms, and temporal consistency. It covers why scene scripts are well suited for automated checks, how to build layered tasks from basic spatial relations to open-ended creative work, how to standardize test conditions, and how to implement multi-level acceptance covering code, scene semantics, geometry, motion, and camera framing. You will also find practical guidance on recording results, defining metrics, and integrating generated scenes into a reliable engineering workflow.
1. From “Generating Fast” to “Are the Spatial Relations Correct?”
When evaluating the coding capabilities of the latest generation of large models, 3D scenes and procedural animations are a category of tasks worth special attention. They require not only syntactically correct code, but also the ability to translate positions, directions, sizes, motion, and occlusion relationships expressed in natural language into executable scene descriptions.
For example, “make a small ball travel along a track, pass under a support bracket, and stop at the center of a platform” sounds like a simple animation request, but it actually contains multiple constraints: the track must be continuous, there must be sufficient clearance under the bracket, the ball’s path must not penetrate solid objects, the endpoint must align with the platform center, and the camera must clearly present the key actions.
Therefore, submitting the script first, producing a picture first, and completing the task correctly are three different evaluation dimensions. A successful first run reflects a certain level of code-generation ability, but does not directly prove stronger spatial reasoning; beautiful visuals cannot substitute for correct geometric relationships.
A more reasonable evaluation goal is to observe whether the model can turn requirements into explicit constraints and maintain consistency between the code, the scene, and the final output.
2. What Abilities Do 3D Tasks Actually Test?
2.1 From Language Requirements to Geometric Constraints
Spatial descriptions are often relative. For example, “in front” might refer to a direction in world coordinates, the object’s own orientation, or the foreground as seen by the viewer. If a task does not specify a reference frame, the model may generate a runnable scene that still deviates from user intent.
Before evaluation, the following conventions should be unified:
- Which coordinate directions and length units the scene uses;
- Whether an object’s position is represented by its geometric center, bottom center, or another reference point;
- Whether relations such as “left of” and “above” are based on world coordinates or local coordinates;
- How much error is allowed for contact, clearance, and alignment;
- Which point in time a positional description in an animation corresponds to.
A model’s capability is reflected not only in generating code directly, but also in detecting ambiguity and asking for clarification. For tests where follow-up questions are not possible, the model should be required to list its assumptions explicitly rather than silently choosing one interpretation.
2.2 Hierarchical Relationships and Coordinate Transforms
Complex scenes usually consist of multiple objects with parent-child relationships. For example, the base of a mechanical structure connects to a rotating shaft, the shaft connects to a linkage, and the end of the linkage connects to a tool.
When a parent object rotates, the positions and orientations of its children change accordingly. If the model confuses local coordinates with world coordinates, common results include linkages detaching from shafts, tools rotating around the wrong center, or components scattering after an overall move.
These issues are best tested through local modifications: change the base position or adjust a linkage length, and observe whether the other parts remain correctly connected. A structure that withstands modification demonstrates spatial modeling ability better than one that merely looks correct in the initial frame.
2.3 Spatial Consistency over Time
The constraints a procedural animation must satisfy do not exist only in a single frame.
An object may be correctly positioned at the start and end points yet pass through an obstacle in between; two parts may connect well while static but visibly break apart after rotation. Keyframes, key events, and intermediate trajectories should therefore be checked together.
For path motion, position continuity must be distinguished from velocity continuity. No positional jumps does not mean the motion is natural; sudden velocity changes can cause visible stutter. If the task requires smooth start and stop, the motion curve must be examined, not just the endpoints.
3. Why Scene Scripts Are Suitable for Evaluation
Interactive 3D demonstrations are useful for checking real-time response and browsing experience, while scene scripts make it easier to control modeling, cameras, lighting, animation, and the rendering pipeline. Each approach has its purpose; neither technical route should be assumed to inherently reflect model ability better than the other.
For spatial reasoning evaluation, the main value of scene scripts is reproducibility and automated checking. Evaluators can read object dimensions, transform relationships, animation trajectories, and camera parameters, and detect certain structural errors before generating any frames.
However, the script approach introduces its own confounding factors: a model may understand the spatial relations but fail due to unfamiliarity with the execution environment’s interfaces; or it may succeed by relying on familiar code templates without actually meeting the task requirements.
It is therefore recommended to split evaluation into two layers:
The first layer uses a neutral structured scene description to check whether objects, relationships, and trajectories are reasonable. The second layer converts the description into an executable scene to check whether the scripts, assets, and rendering pipeline are complete. This makes it easier to distinguish spatial reasoning errors from engineering implementation errors.
4. Build Layered Tasks Instead of Relying on a Single Demo
4.1 Basic Spatial Relationship Tasks
Start by verifying simple, measurable relations, for example:
- Two cuboids maintain a specified gap;
- The bottom of a cylinder contacts the top surface of a platform;
- A small ball sits below the beam of a support bracket;
- Three objects are arranged along the same axis;
- One object’s orientation matches another’s.
These tasks require no complex materials; the focus is on checking dimensions, positions, alignment, and contact. Using simple geometric primitives reduces the interference of visual decoration on judgment.
4.2 Structural Assembly Tasks
Once basic relations are stable, introduce parent-child hierarchies, multiple connection points, and local rotations—for example, generating an articulated structure with a base, a rotating shaft, and linkages.
The task should specify which parts can rotate, where the rotation centers are, and which connections must remain unchanged. Verification should not only inspect the initial state; angles or dimensions should be changed to check whether the structure still holds.
4.3 Dynamic Path Tasks
Next, require objects to pass through narrow spaces, avoid obstacles, and stop accurately.
Here, check simultaneously whether the path is continuous, whether the object penetrates obstacles, whether the endpoint meets the requirements, and whether the key actions are fully presented. For trajectories close to obstacles, checking only a few frames may miss collisions; increase sampling density or use continuous collision detection.
4.4 Open-Ended Creative Tasks
Only at the end should theme design, camera choreography, and visual style be introduced.
Open-ended tasks are useful for observing how a model organizes complex requirements, but they should not be the sole basis for judgment. Evaluation should separate creativity, visual presentation, and hard constraints: added decorative detail can improve appearance but cannot compensate for an incorrect motion path or a missing object.
5. Standardize Test Conditions to Avoid Distorted Conclusions
A reliable evaluation must specify the conditions under which the model completes the task.
First, unify the prompts, including the scene goal, execution environment, available assets, output files, and acceptance criteria. Some tests should not receive extra explanations while others rely only on vague descriptions.
Second, unify the runtime conditions, including dependency versions, compute resources, output resolution, and render settings. Total elapsed time should be broken down into text generation, script execution, scene initialization, and render export, so that rendering differences are not mistaken for differences in model generation speed.
Third, define feedback and repair rules. First-attempt results and post-repair results should be recorded separately. If the model is allowed to revise based on error logs, the feedback content and the repair budget should be consistent across tests. Timeouts, missing dependencies, runtime exceptions, and unmet spatial constraints should each be labeled separately.
Finally, run multiple independent trials to observe stability. A single success may come from a lucky generation; a single failure may be caused by the environment. Besides showing representative results, report the number of successes, failure types, and result variance. Without actual test records, no performance rankings or quantitative advantages should be claimed.
6. Establish a Layered Acceptance Mechanism
6.1 Code and Delivery Checks
Check whether the script is complete, whether it runs in the specified environment, whether it depends on undeclared assets, and whether the output files exist and are readable.
For procedural video, also confirm that the frame sequence or video file covers the required duration—“script execution finished” cannot be equated with “video generation completed.”
6.2 Scene Semantics Checks
Verify that all required objects are present, that counts are correct, and that names and roles correspond, avoiding the case of “overall similar, but a key object is missing.”
It is recommended to generate a scene inventory that records each object’s role, dimensions, position, parent object, and the constraints it participates in, giving subsequent verification a clear basis.
6.3 Geometry and Motion Checks
Relations can be verified through coordinates, bounding volumes, and geometric tests. For example, the difference between an object’s bottom height and a platform’s top height can be used to determine vertical contact.
The following is illustrative pseudocode expressing the checking logic; it is not a real tool interface:
object_bottom = object_center_height - object_height / 2platform_top = platform_center_height + platform_thickness / 2if abs(object_bottom - platform_top) > contact_tolerance:log_error("Object does not maintain the specified contact with the platform")for each sampled_time along the motion trajectory:get the object's spatial extent at sampled_timecheck whether it intersects the forbidden regionif it intersects:log_error("Motion path may cause penetration")
Bounding-volume intersection is suitable for initial screening, but overlapping bounding volumes of complex shapes do not necessarily mean a real collision. For critical parts, finer geometric checks should be applied.
6.4 Framing and Camera Checks
Geometric correctness does not equal clarity of expression. The camera may fail to capture key actions, and important objects may be occluded or out of frame.
Key frames should therefore be extracted to check object visibility, framing, exposure, and motion presentation. Manual visual inspection and programmatic geometric checks should complement, not replace, each other.
7. Recording Results and Forming Technical Judgments
Use multiple metrics rather than a single overall score to summarize all capabilities.
Task completion measures whether hard requirements are met; spatial correctness covers alignment, contact, connection, and motion constraints; engineering reliability covers successful execution, delivery completeness, and repair cost; visual expression covers composition and the presentation of key events; maintainability covers code organization, centralized parameter management, and stability after modification.
Among these, severe violations of spatial constraints should be treated as critical failures that cannot be offset by a higher visual score. If scores need to be aggregated, the rules should be published in advance to avoid adjusting weights after seeing the results.
Failure analysis should also be as granular as possible. For example, “generation failed” can be broken down into syntax errors, asset path errors, missing objects, coordinate system misunderstanding, wrong rotation centers, trajectory collisions, or camera omissions. Such records are far more useful for improvement than a simple verdict of “poor results.”
8. A Practical Workflow for Real Projects
In actual development, a “requirement structuring → parametric modeling → automated verification → low-cost preview → final delivery” workflow is recommended.
First, break the natural-language description into an object list, spatial relations, motion rules, and acceptance criteria. Manage key dimensions centrally, derive positions through constraints wherever possible, and reduce hard-coded values scattered through the code. Then generate the basic geometric structure first, without rushing into materials and complex lighting.
After automated checks pass, produce a low-cost preview to verify motion trajectories and camera presentation. Only then perform the full render, and save the scripts, parameters, logs, and check results. This sequence reduces rework costs and makes it easier to trace problems to their source.
If executing model-generated scripts, use an isolated environment that restricts file read/write scope, network access, and compute resources, with timeout and output-size limits in place. Generated scripts should be treated as external input requiring review, not as inherently trusted programs.
9. Conclusion: Trustworthy Capability Comes from Reproducible Evidence
When evaluating the 3D generation and spatial reasoning capabilities of large models, the key is not whether a demo looks impressive, but whether the model can consistently turn language requirements into correct, executable, and verifiable spatial structures.
High-quality evaluation should cover code execution, scene semantics, geometric constraints, dynamic consistency, and final delivery, while reducing random factors through unified environments and repeated testing. For developers and enterprise users, the highlights truly worth attention are whether results are stable, whether errors are localizable, whether modifications are controllable, and whether generated content can enter a reliable engineering workflow.
