Skip to content

Latest commit

 

History

History
84 lines (69 loc) · 1.89 KB

Graphic Assets.md

File metadata and controls

84 lines (69 loc) · 1.89 KB

Graphic Assets

한국어

Otherengine divides the graphic elements into four main parts.

  • Mesh: Vertex data and default material
  • Material: Shader and its uniform parameters, and default texture
  • Shader: Code written with GLSL
  • Texture: png, jpg, ...

Each element has the following format:

Mesh

  • Extension: .omesh
  • Format: JSON
  • Vertex normal must not be zero vector
{
    "material": "../Assets/Plane.omat",
    "vertices": [
        // [vx, vy, vz, nx, ny, nz, u, v],
        [-0.5, -0.5, -0.5, 0, 0, -1, 0, 0],
        // ...
    ],
    "indices": [
        [2,1,0],
        // ...
    ]
}

NOTE: All paths must be relative to Binaries. ex) ../Assets/Plane.omat

Material

  • Extension: .omat
  • Format: JSON
  • Supported uniform types: bool, int, float, vecn, ivecn, bvecn, matn, matnxn
  • Types are automatically deduced.
  • All elements of vec must be the same type
  • All rows of mat must be the same length
  • All elements of mat are considered float.
{
    "shader": "../Engine/Shaders/Phong",
    "texture": "../Assets/Plane.png",
    "uniforms": {
        "variable_name": /*value*/,
        "bool": false,
        "int": 0,
        "float": 0.0,
        "vec2": [0.0, 0.0],
        "ivec3": [0, 0, 0],
        "bvec4": [false, false, false, false],
        "mat3": [
            [0, 0, 0],
            [0, 0, 0],
            [0, 0, 0]
        ],
        "mat2x4": [
            [0, 0, 0, 0],
            [0, 0, 0, 0]
        ],
        // ...
    }
}
  • Extension: .frag, .vert
  • Language: GLSL
  • One shader must have a fragment shader (.frag) and a vertex shader (.vert) of the same name.
  • Exclude extensions from file paths when referencing shaders.

Texture

  • Extension: .png, .jpg, ... (Supports most image formats)
  • Channels: Only RGB(3) and RGBA(4) are supported yet.
  • Max size: 65535 x 65535