Skip to content

Architecture Format

Angel Chang edited this page Sep 23, 2024 · 1 revision

Architecture are exported in JSON and txt format.

JSON format

In the exported JSON format:

  • Walls are segments with two endpoints with height and depth
  • Walls have holes (cutouts where windows/doors are placed). The object instance id is specified along with the bounding box of the hole.
  • Ceiling/Floor/Ground are multi-polygons with each polygons specified as array of points
  • Materials are specified for the two sides of the Wall (inside/outside surfaces) with the cross section being gray. One material is used for all sides of Ceiling/Floor/Ground.

JSON Example (include walls, ceiling, floor, ground):

{
  "version": "[email protected]",                           // Version
  "id": "11be354e8dbd5d7275c486a5037ea949",          // Scene ID
  "up": [ 0, 1, 0 ],                                 // Up vector (same as in house file)
  "front": [ 0, 0, 1 ],                              // Front vector (same as in house file)
  "scaleToMeters": 1,                                // What unit the architecture is specified in (same as in house file)
  "defaults": {                                      // Default depth for wall, ceiling, floor, ground  
    "Wall": {
      "depth": 0.1,
      "extraHeight": 0.035                           // This height is added to wall to ensure no gaps
    },
    "Ceiling": {
      "depth": 0.05
    },
    "Floor": {
      "depth": 0.05
    },
    "Ground": {
      "depth": 0.08
    }
  },
  "elements": [                                      // Array of architectural elements
    {
      "id": "0_0_0",                                 // Id of element 
      "type": "Wall",                                // Architectural type ('Wall', 'Ceiling', 'Floor', 'Ground')          
      "roomId": "0_0",                               // Room id (refers back to node id in scene)    
      "height": 2.7,                                 // Height of wall (in scene units)
      "points": [                                    // Endpoints of wall (y is the vertical)
        [ 51.92875, 0, 14.950000000000001 ],
        [ 58.79125, 0, 14.950000000000001 ]
      ],
      "holes": [],                                   // Array of cutouts for the wall
      "materials": [                                 // Array of materials for the wall (inside and outside)
        {
          "name": "inside",                          // Name of material ("inside" for inside wall)
          "texture": "wallp_0",                      // Texture
          "diffuse": "#7a0400"                       // Diffuse color in hex
        },
        {
          "name": "outside",                         // Name of material ("outside" for outside wall)
          "texture": "bricks_1",                     // Texture 
          "diffuse": "#ffffff"                       // Diffuse color in hex
        }
      ],
      "depth": 0.1                                   // Depth of wall
    },
    ...
    {
      "id": "0_2_0",
      "type": "Wall",
      "roomId": "0_2",
      "height": 2.7,
      "points": [
        [ 58.79, 0, 14.950000000000001 ],             
        [ 64.89, 0, 14.950000000000001 ]
      ],
      "holes": [
        {
          "id": "0_370",                                        // Node id of object creating hole in the wall
          "modelId": "211",                                     // modelId of object creating hole in the wall
          "type": "Door",                                       // hole type (`Door` or `Window`)
          "box": {                                              // cutout of hole as box on the wall
            "min": [ 2.181878710937499, 0.8699999967216502 ],   // minimum point 
                                                                // x is distance from points[0] (toward points[1])
                                                                // y is height from wall bottom (goes from 0 to wall height)
            "max": [ 4.241878710937499, 2.23 ]                  // maximum point
          }
        }
      ]
    },
    {
      "id": "0_0c",                                  // Id of architecture element
      "type": "Ceiling",                                        
      "roomId": "0_0",
      "offset": [ 53.68, 2.74, 13.02 ],              // Offset to apply to points 
      "points": [                                    // Array of polygons,
        [ [ -1.75125, 0, 1.93],                      // each represented as array of points
          [ 5.11125, 0, 1.93], 
          [ 5.1, 0, 4.91], ... ], 
          ... ]
      ],
       "materials": [                                // Array of materials (one for all sides)
        {                    
          "name": "surface",
          "texture": "linen_1_4",
          "diffuse": "#ffffff"
        }
      ],
      "depth": 0.05   
    },
    ...
  ]
} 

Architecture elements

The STK support the following architecture elements: "Wall", "Ceiling", "Floor", "Ground", "Landing", "Column", and "Stairs"

/**
 * Information about an architectural element.
 * @typedef ArchElement
 * @type {geo.WallDef|geo.CeilingDef|geo.FloorDef|geo.ColumnDef|geo.StairsDef}
 * @property {string} type - Type of architectural element (`Wall|Ceiling|Floor|Ground|Landing|Column|Stairs`)
 * @property {string} id - Id of the element
 * @property {string} roomId - Room the architectural element is associated with
 * @property {THREE.Vector3} offset - Amount of offset for the points
 * @memberOf geo
 */

A "Wall" is a vertical, planar architecture element with possible openings.

/**
 * Information about a wall.
 * @typedef WallDef
 * @type {object}
 * @property {THREE.Vector3[]} points - List of points associated with the wall
 * @property {Object} parent - Parent of the wall
 * @property {OpeningSpec[]} holes - Array with information about the holes in the wall (include box)
 * @property {number[][]} ceiling - Array of points defining the ceiling profile
 * @property {number} height - Height of the wall
 * @property {number} depth - Thickness of the wall
 * @property {Object} json - Original json object from which the wall is parsed
 * @memberOf geo
 */

/**
 * Information about an opening.
 * @typedef OpeningSpec
 * @type {object}
 * @property {string} type - Opening type (Opening|Door|Doorway|Window|Glass)
 * @property {{min: number[], max: number[]}} box - Opening is a box with coordinates specified relative to wall lower left
 * @property {number[][]} poly - Opening is polygon with coordinates specified relative to wall lower left
 * @memberOf geo
 */

A "Ceiling" is a horizontal, planar architecture element that goes on top

/**
 * Information about a ceiling.
 * @typedef CeilingDef
 * @type {object}
 * @property {THREE.Vector3[]} points - List of points associated with the ceiling
 * @property {number} depth - Thickness of the ceiling
 * @memberOf geo
 */

A "Floor", "Ground", "Landing" are all horizontal, planar architecture elements on which other objects can be placed.

  • "Floor" is used for surfaces typically found inside the house
  • "Landing" is used for surfaces connecting one flight of stairs to another
  • "Ground" is used for exterior surfaces
/**
 * Information about a floor (used for Floor, Ground, Landing)
 * @typedef FloorDef
 * @type {object}
 * @property {THREE.Vector3[]} points - List of points associated with the floor
 * @property {number} depth - Thickness of the floor
 * @memberOf geo
 */

A "Column" is a vertical support found in houses

/**
 * Information about a column / pillar that consists of a base shape that is extended vertically upwards
 * @typedef ColumnDef
 * @type {object}
 * @property {string} baseShape - Shape (circle|square|poly)
 * @property {THREE.Vector[]} basePoint - Center of circle or square
 * @property {THREE.Vector[]} basePoints - Points for poly outline
 * @property {number} height - Height of column
 * @property {number} width - Radius of column for circle and square
 * @memberOf geo
 */

"Stairs" is a set of steps that make up a stairway

/**
 * Information about a set of stairs.
 * @typedef StairsDef
 * @type {object}
 * @property {geo.StepSpec[]} steps - Specification of steps making up the stair
 * @property {geo.RailingSpec[]} railing - Specification of railings associated with the stair
 * @memberOf geo
 */


/**
 * Information about a step.  The step width is automatically computed from the number of steps and base and end points
 *  (currently assuming no gap)
 * @typedef StepSpec
 * @type {object}
 * @property {int} nSteps - Number of steps
 * @property {THREE.Vector3[]} basePoints - Array of two points at the bottom of the stairs
 * @property {THREE.Vector3[]} endPoints - Array of two points at the top of the stairs
 * @property {number} stepHeight - Height of each step
 * @property {number} treadDepth - How thick is the tread (the top surface of each step)
 * @property {boolean} hasRiser - Whether there is riser (the vertical part between steps).  Most stairs have risers.
 * @property {number} riserDepth - How thick is the riser
 * @property {boolean} hasStringer - Whether there is a side surface to the steps
 * @memberOf geo
 */

/**
 * Information about a railing.
 * @typedef RailingSpec
 * @type {object}
 * @property {THREE.Vector3[]} points - Base points for railing
 * @property {number[]} base - Relative offset from start of wall
 * @property {number} height - Railing height
 * @property {number} depth - Railing depth
 * @memberOf geo
 */

Material specification

For textured materials, we follow THREE.js's material definitions. Use images, textures, and materials` as the example to specify materials and their respective textures and images.

Then in the architecture element, use the materialId to specify the uuid of the material to reference.

 ...
 "elements": [
    {
      "id": "0_2_0",
      "type": "Wall",
      ... 
      "materials": [                                 // Array of materials for the wall (inside and outside)
        {
          "name": "inside",                          // Name of material ("inside" for inside wall)
          "materialId": "mat1"                       // Reference to material with uuid "mat1"
        },
        {
          "name": "outside",                         // Name of material ("outside" for outside wall)
          "materialId": "mat2"                       // Reference to material with uuid "mat2"
        }
      ],
    }
    ...
  ],
  ...
  "materials": [
     { 
        "uuid": "mat1",
        ...
     },
     {
        "uuid": "mat2",
        ...
     }
  ]

ASCII format

ASCII format (walls only):

Each line represents a wall segment (with doors cut out)

wall [index] [x0] [y0] [z0] [x1] [y1] [z1] 0 0

ASCII example:

filetype wall
wall 0 51.92875 14.950000000000001 0 58.79125 14.950000000000001 2.7 0 0
wall 1 58.79125 14.950000000000001 0 58.78 17.93 2.7 0 0
wall 2 58.78 17.93 0 57.0865625 17.93 2.7 0 0
wall 3 57.0865625 17.93 0 57.0865625 17.62 2.7 0 0
...
Clone this wiki locally