Docs/MC3 Format Reference

Overview

MC3 (Mesh Craft 3D) is a human-readable XML format for 3D scenes. It describes scenes as constructive objects — primitives, extrusions, CSG booleans, groups, instances — rather than raw triangle meshes. The recommended pipeline:

.mc3.xml  →  mc3togltf  →  .glb / .gltf  →  game engine / browser

Root Element

<mc3 version="0.3"
     model="MyScene"
     unit="meter"
     coordinate_system="right_handed_y_up"
     rotation_units="degrees"
     euler_order="XYZ"
     default_camera="Main">
  …
</mc3>
AttributeValuesDefaultDescription
versionstring0.3Format version
modelstringScene/model name
unitmeter | centimeter | inchmeterWorld unit
coordinate_systemright_handed_y_up | right_handed_z_upright_handed_y_upCoordinate convention
rotation_unitsdegrees | radiansdegreesUnits for all rotation attributes
euler_orderXYZ | XZY | YXZ | …XYZEuler composition order
default_camerastringName of the default camera

Top-Level Structure

<mc3 …>
  <environment>…</environment>   <!-- background, fog -->
  <lights>…</lights>               <!-- ambient, directional, point, spot -->
  <cameras>…</cameras>             <!-- perspective, orthographic -->
  <textures>…</textures>           <!-- texture library -->
  <materials>…</materials>         <!-- PBR material library -->
  <definitions>…</definitions>     <!-- reusable prefabs -->
  <objects>…</objects>             <!-- scene graph -->
  <actions>…</actions>             <!-- keyframe animations -->
</mc3>

All sections are optional and may appear in any order.

Environment

<environment>
  <background color="0.5 0.7 1.0" texture="sky"/>
  <fog mode="linear" color="0.5 0.7 1.0" start="50" end="200" density="0.01"/>
</environment>

Lights

<lights>
  <ambient     color="0.3 0.3 0.4" brightness="0.5"/>
  <directional name="Sun" color="1 0.95 0.8" brightness="2"
               direction="-0.5 -1 -0.5" cast_shadows="true"/>
  <point       name="Lamp" color="1 0.6 0.2" brightness="5"
               position="0 3 0" range="10"/>
  <spot        name="Torch" position="0 5 0" direction="0 -1 0"
               angle="30" falloff="45" range="20"/>
</lights>

Cameras

<cameras default="Main">
  <camera name="Main" type="perspective"
          position="8 5 12" target="0 1 0"
          fov="60" near="0.1" far="500"/>
  <camera name="Ortho" type="orthographic"
          position="0 10 0" target="0 0 0" size="20"/>
</cameras>

Common Object Attributes

All object types support these attributes:

AttributeTypeDefaultDescription
namestringObject name (used by animation target)
positionvec30 0 0World position
rotationvec30 0 0Euler angles (units/order set by root attributes)
scalevec31 1 1Scale per axis
pivotvec30 0 0Rotation/scale pivot offset (local space)
materialIDREFReference to a material id
visiblebooleantrueVisibility
collisionstringnoneCollision shape hint
tagsstringSpace-separated tag list
rolecutterMarks as CSG cutter inside <difference>

Transform order: T(position + pivot) × R(rotation) × S(scale) × T(-pivot)

Value Formats

TypeFormatExample
vec2"W H""50 50"
vec3"X Y Z""0 2 -5"
vec4"R G B A""0.8 0.2 0.1 1.0"
boolean"true" or "false""true"
floatdecimal"0.5"
intpositive integer"24"
IDXML ID (unique)"brick"
IDREFXML IDREF (must match an existing ID)"brick"

Minimal Example

<?xml version="1.0" encoding="UTF-8"?>
<mc3 version="0.3" model="Minimal">

  <environment>
    <background color="0.4 0.6 0.9"/>
  </environment>

  <lights>
    <ambient     color="0.3 0.3 0.4" brightness="0.4"/>
    <directional name="Sun" color="1 0.95 0.8"
                 brightness="2.5" direction="-0.5 -1 -0.3"/>
  </lights>

  <materials>
    <material id="grey">
      <base_color>0.7 0.7 0.7 1.0</base_color>
    </material>
  </materials>

  <objects>
    <plane name="Ground" size="20 20" axis="y" material="grey"/>
    <box   name="Cube"   size="1 1 1" position="0 0.5 0" material="grey"/>
  </objects>

</mc3>

See Also