Skip to content

Allow for extension-defined attribute names #252

@javagl

Description

@javagl

Right now, the validator is checking whether an attribute name starts with _ (underscore) and performs a strict validation of the "known" attribute names if this is not the case. In the future, attribute names can also be prefixed with an extension name. The specification update is still pending via KhronosGroup/glTF#2514 . But there already is an extension that uses the new semantics structure (and it is currently declared as "Release Candidate"), namely, KHR_gaussian_splatting.

The following is a supposedly valid asset that is using this extension (in embedded representation):

{
  "extensionsUsed" : [ "KHR_gaussian_splatting" ],
  "accessors" : [ {
    "bufferView" : 0,
    "byteOffset" : 0,
    "componentType" : 5126,
    "count" : 8,
    "type" : "VEC3",
    "max" : [ 100.0, 100.0, 100.0 ],
    "min" : [ 0.0, 0.0, 0.0 ]
  }, {
    "bufferView" : 0,
    "byteOffset" : 128,
    "componentType" : 5126,
    "count" : 8,
    "type" : "VEC3",
    "max" : [ 1.0, 1.0, 1.0 ],
    "min" : [ 1.0, 1.0, 1.0 ]
  }, {
    "bufferView" : 0,
    "byteOffset" : 256,
    "componentType" : 5126,
    "count" : 8,
    "type" : "VEC4",
    "max" : [ 0.0, 0.0, 0.0, 1.0 ],
    "min" : [ 0.0, 0.0, 0.0, 1.0 ]
  }, {
    "bufferView" : 0,
    "byteOffset" : 384,
    "componentType" : 5126,
    "count" : 8,
    "type" : "SCALAR",
    "max" : [ 20.0 ],
    "min" : [ 20.0 ]
  }, {
    "bufferView" : 0,
    "byteOffset" : 512,
    "componentType" : 5126,
    "count" : 8,
    "type" : "VEC3",
    "max" : [ 1.7724539, 1.7724539, 1.7724539 ],
    "min" : [ 1.7724539, 1.7724539, 1.7724539 ]
  } ],
  "asset" : {
    "generator" : "JglTF from https://github.com/javagl/JglTF",
    "version" : "2.0"
  },
  "buffers" : [ {
    "uri" : "data:application/gltf-buffer;base64,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADIQgAAAAAAAAAAAADIQgAAAAAAAAAAAAAAAAAAyEIAAMhCAAAAAAAAyEIAAAAAAAAAAAAAAAAAAMhCAAAAAAAAyEIAAAAAAADIQgAAyEIAAAAAAAAAAAAAyEIAAMhCAADIQgAAAAAAAIA/AACAPwAAgD8AAAAAAACAPwAAgD8AAIA/AAAAAAAAgD8AAIA/AACAPwAAAAAAAIA/AACAPwAAgD8AAAAAAACAPwAAgD8AAIA/AAAAAAAAgD8AAIA/AACAPwAAAAAAAIA/AACAPwAAgD8AAAAAAACAPwAAgD8AAIA/AAAAAAAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AACgQQAAAAAAAAAAAAAAAAAAoEEAAAAAAAAAAAAAAAAAAKBBAAAAAAAAAAAAAAAAAACgQQAAAAAAAAAAAAAAAAAAoEEAAAAAAAAAAAAAAAAAAKBBAAAAAAAAAAAAAAAAAACgQQAAAAAAAAAAAAAAAAAAoEEAAAAAAAAAAAAAAADF3+I/xd/iP8Xf4j8AAAAAxd/iP8Xf4j/F3+I/AAAAAMXf4j/F3+I/xd/iPwAAAADF3+I/xd/iP8Xf4j8AAAAAxd/iP8Xf4j/F3+I/AAAAAMXf4j/F3+I/xd/iPwAAAADF3+I/xd/iP8Xf4j8AAAAAxd/iP8Xf4j/F3+I/AAAAAA==",
    "byteLength" : 640
  } ],
  "bufferViews" : [ {
    "buffer" : 0,
    "byteOffset" : 0,
    "byteLength" : 640,
    "byteStride" : 16,
    "target" : 34962
  } ],
  "meshes" : [ {
    "primitives" : [ {
      "extensions" : {
        "KHR_gaussian_splatting" : {
          "kernel" : "ellipse",
          "colorSpace" : "BT.709-sRGB",
          "sortingMethod" : "cameraDistance",
          "projection" : "perspective"
        }
      },
      "attributes" : {
        "POSITION" : 0,
        "KHR_gaussian_splatting:SCALE" : 1,
        "KHR_gaussian_splatting:ROTATION" : 2,
        "KHR_gaussian_splatting:OPACITY" : 3,
        "KHR_gaussian_splatting:SH_DEGREE_0_COEF_0" : 4
      },
      "mode" : 0
    } ]
  } ],
  "nodes" : [ {
    "mesh" : 0
  } ],
  "scene" : 0,
  "scenes" : [ {
    "nodes" : [ 0 ]
  } ]
}

It is currently generating multiple errors of the form

          {
                "code": "MESH_PRIMITIVE_INVALID_ATTRIBUTE",
                "message": "Invalid attribute name.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/attributes/KHR_gaussian_splatting:SCALE"
            },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions