> For the complete documentation index, see [llms.txt](https://robodex.gitbook.io/robodex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://robodex.gitbook.io/robodex-docs/pipeline/rendering-compilation.md).

# Rendering And Compilation

Generated bodies have multiple visual and compilation forms.

## Concept render

The fastest path is frontend concept rendering from product candidate fields. This lives in:

```
apps/web/components/MorphologyViewer.tsx
```

It is useful for immediate review, but it is not a full mechanical export.

## Engineering render

Engineering render helpers live in:

```
packages/pipeline/engineering_render.py
```

They build richer scene payloads with geometry intent, materials, nodes, and engineering-oriented metadata.

## MJCF compilation

MJCF compilation lives in:

```
packages/pipeline/compilers/mjcf_compiler.py
```

The key public shape is:

```python
compile_to_mjcf(ir) -> str
```

The compiler expects canonical `RobotDesignIR`, not a raw frontend candidate.

## Export route bridge

`apps/api/routes/exports.py` converts stored design data to IR with `_design_to_ir()` and then calls the compiler.

That bridge is a practical product adapter. If generated candidates start carrying richer component or IR data, this conversion should become less default-heavy.

## UI scene data

UI scene data can be saved alongside MJCF artifacts so the frontend can render engineering details without reparsing every export.

## Important distinction

| Thing             | Purpose                                  |
| ----------------- | ---------------------------------------- |
| Concept candidate | Fast visual review in UI                 |
| Grammar HITL      | Explain generated structure and validity |
| Component program | Lowered generated body structure         |
| `RobotDesignIR`   | Canonical robotics representation        |
| MJCF              | Simulator/export artifact                |
| UI scene          | Frontend engineering visualization       |

Do not assume all generated candidates have all forms at all times.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://robodex.gitbook.io/robodex-docs/pipeline/rendering-compilation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
