Skip to content

Latest commit

 

History

History
208 lines (160 loc) · 2.88 KB

scene_serialization_spec.md

File metadata and controls

208 lines (160 loc) · 2.88 KB

Scene serialization Specification

See also

Scene serialization uses the YAML 1.2 spec

Root

scene:
  - camera: <Camera>
    # alias 'cam', 'c'

  - shapes:
      # alias 'shape', 'objects', 'object', 'objs', 'obj', 's'
      - <Shape>

  - lights:
      # alias 'light', 'l'
      - <Light>

  - materials:
      # alias 'material', 'mats', 'mat', 'm'
      <Material id>: <Material>

  - environment_tex:
      # alias 'environment', 'env_tex', 'env', 'e'
      <Resource id> # allowed: jpg, png, hdr

resources:
  # Mapping of all resources with an identifier id and its path,
  # the id is used to refer to them
  # the path can be relative to the scene file or
  # relative to the application binary or absolute
  <Resource id>: <path>

Camera

transform: <Transform>
fov: <float degrees>
near: <float x>0 >
far: <float x>0 >

Shapes

!plane
name: "Display name"
transform: <Transform>
material: <Material id> # allowed samplers: color, texture
!sphere
name: "Display name"
transform: <Transform>
material: <Material id> # allowed samplers: color, texture
!cube
name: "Display name"
transform: <Transform>
material: <Material id> # allowed samplers: color, texture
!voxel
name: "Display name"
transform: <Transform>
material: <Material id> # allowed samplers: color, palette
voxel_grid: <Resource id> # allowed: .vox

Light

!directional
color: <Color>
intensity: <float>
direction: <Vector>
!point
color: <Color>
intensity: <float>
position: <Vector>

Material

name: "Display name"
color: <Sampler>
ambient: <float 0-1>
diffuse: <float 0-1>
specular: <float 0-1>
reflection: <float 0-1>

Sampler

!color
color: <Color>
!texture
texture: <Resource id> # allowed: png, jpg, hdr
filter: <Enum> # values: nearest, linear
wrap: <Enum> # values: repeat, mirrored_repeat, clamp
!palette
palette: <Resource id> # allowed: .vox

Transform

position: <Vector>
rotation: <Quaternion>
scale: <Vector>

Color

r: <float 0-1>
g: <float 0-1>
b: <float 0-1>

# Same as:
{r: <float 0-1>, g: <float 0-1>, b: <float 0-1>}

or

- <float 0-1> # r
- <float 0-1> # g
- <float 0-1> # b

# Same as:
[<float 0-1>, <float 0-1>, <float 0-1>]

or

<binary 3 bytes>
# example: 0x1C00FF
# example: 1835263

Vector

x: <float>
y: <float>
z: <float>

# Same as:
{ x: <float>, y: <float>, z: <float> }

or

- <float> # x
- <float> # y
- <float> # z

# Same as:
[<float>, <float>, <float>]

Quaternion

x: <float>
y: <float>
z: <float>
w: <float>

# Same as:
{ x: <float>, y: <float>, z: <float>, w: <float> }

or

- <float> # x
- <float> # y
- <float> # z
- <float> # w

# Same as:
[<float>, <float>, <float>, <float>]