When Coding Models Learn to See Space: A Hands-On Test of 3D Scene Generation

    This article explores how multimodal coding models can generate navigable 3D spaces, using a roughly 450-square-meter vacant commercial space as the test case. It explains why spatial generation is harder than web generation, covering hard and coupled constraints, the limits of static code checks, and cross-view consistency. The core workflow is a three-stage pipeline: build a shared spatial skeleton, layer rough and fitted states on one coordinate system, and run a render-screenshot-compare-fix self-check loop. An acceptance checklist and transferable engineering recommendations are included.

    1. From Writing Code to “Broad Coding”: Shifting Capability Boundaries

    A coding model used to be judged mainly on whether it could produce runnable functions, interpret error messages, and make local changes inside an existing project. Once a model combines stable code generation with basic visual understanding, however, its output is no longer limited to web pages and APIs. It can extend to 3D geometry, material appearance, interaction logic, and even physical rules. The industry summarizes this trend as “broad coding”: anything that can be described formally becomes a target for code generation.

    For engineering practice, the shift means deliverables move from “fragments” to “runnable space.” This article takes a vacant commercial space of about 450 square meters as input and asks the model to build a freely navigable restaurant from scratch using only a general-purpose 3D rendering library, with support for switching between “bare shell” and “fitted” states from the same camera position. Rather than focusing on any specific product, the discussion abstracts the task into a reusable technical methodology.

    2. Task Breakdown: Why Spatial Generation Is Harder Than Web Generation

    1. Constraints Are Hard and Interdependent

    Web layouts tolerate error; a few pixels of misalignment usually does not break usability. Spatial scenes are different. Load-bearing columns, door and window openings, and main aisle width are immovable constraints, while functional zoning (storefront, open dining area, private rooms, kitchen circulation) constrains one another. Any deviation in a coordinate or proportion will expose clipping, occlusion, or distorted scale when the view changes.

    2. Correctness Cannot Be Judged from Static Code Alone

    Traditional code can rely on type checks and unit tests as a safety net, but whether a 3D scene is “right” has to be seen on screen. Whether a wood grille blocks a private-room doorway, or whether the divider inside a pot is misaligned with the two soup bases, is nearly invisible at the source-code level and depends on visual regression from rendered screenshots.

    3. Consistency Must Hold Across Views

    Switching between two states from the same camera position means both sets of scene data must share the same coordinate system and scale baseline. Modeling them separately and then stitching them together easily produces subtle mismatches in wall thickness, floor height, and furniture dimensions.

    3. Implementation Path: Modular Modeling Plus a Visual Self-Check Loop

    Organize generation as a three-stage flow: skeleton first, then fill, then verify.

    1. Establish a Unified Spatial Skeleton

    First output a scale convention that serves as the contract for every later module:

    1. // Units are meters; origin is at the ground center of the street-facing entrance
    2. const SPACE = { width: 30, depth: 15, height: 3.2 };
    3. const KEEP_OUT = [
    4. { type: 'column', x: -4, z: 0, r: 0.35 }, // load-bearing column, immovable
    5. { type: 'door', x: 0, z: 7.5, w: 2.4 } // main entrance opening
    6. ];

    Once the skeleton is fixed, walls, floors, ceilings, and circulation are generated as independent modules. Functional zones only “fill in” within the skeleton, which prevents them from overwriting one another.

    2. Share One Coordinate System Across Both States

    “Bare shell / fitted” should not be two scenes but two layers of the same scene: the structural layer stays resident, and the decorative layer is switchable. Camera positions, camera parameters, and lighting baselines are then consistent by construction.

    1. const structure = buildStructure(SPACE, KEEP_OUT); // resident
    2. const decor = { rough: buildRough(), fitted: buildFitted() };
    3. function applyState(state) {
    4. scene.remove(decor.rough, decor.fitted);
    5. scene.add(decor[state]);
    6. }

    3. Add a Self-Check Loop Based on Rendered Screenshots

    Having the model repeatedly run a “render, screenshot, compare, fix” loop before submitting is the key to success on this kind of task. The checkpoints can be fixed as a checklist:

    • Whether the clear width of the main aisle meets passage requirements and is not encroached by furniture;
    • Whether every doorway is blocked by grilles, partitions, or light fixtures;
    • Whether the orientation of small components such as tabletops and pots is logically consistent with adjacent components;
    • Whether floor elevation and wall positions drift after switching states.

    4. Acceptance Checklist: How to Tell Whether the Result Is Really Usable

    Dimension Check Method Pass Criterion
    Spatial compliance Verify no-build zones by coordinates No component intrudes on load-bearing columns or openings
    Visual correctness Screenshots from multiple camera positions No clipping, occlusion, or floating objects
    Interaction completeness Free dragging and navigation Camera is controllable; state switching takes effect instantly
    Engineering maintainability Module separation Structural layer decoupled from decorative layer

    5. Transferable Engineering Recommendations

    First, express constraints as data rather than natural language, so the model can follow them reliably. Second, always keep a visual feedback channel; pure text reasoning cannot cover spatial defects. Third, validate on a small scene before scaling up, because increasing area amplifies the probability of clipping non-linearly. Fourth, turn the checklist into a team asset so different projects reuse the same acceptance standard.

    6. Conclusion

    The real value of “broad coding” is not that a model can write a few more languages, but that vision and space become generatable, verifiable engineering objects. For developers, the focus should shift from “can the model generate it” to “how to use constraints, layering, and a visual loop to keep generated results above a deliverable quality line.” In related engineering practice at Baidu AI Cloud, this dual-loop structure of “generation plus verification” also applies to 3D content production, digital twins, and visualization delivery.