Skip to content

madjin/lightmap-tests

Repository files navigation

lightmap-tests

testing glTF lightmaps

NEEDLE_lightmaps

This is a root extension defining a set of lightmaps for the glTF file.

"NEEDLE_lightmaps": {
  "textures": [
    {
      "pointer": "textures/20",
      "type": 1,
      "index": 0
    }
  ]
}

Note: At the moment this extension also contains environment texture references. We're planning to change that in a future release.

Texture Type Value
Lightmap 0
Environment Map 1
Reflection Map 2

How lightmaps are applied is defined in the MeshRenderer component inside the NEEDLE_components extension per node:

"NEEDLE_components": {
  "builtin_components": [
    {
      "name": "MeshRenderer",
      ...
      "lightmapIndex": 0,
      "lightmapScaleOffset": {
        "x": 1.00579774,
        "y": 1.00579774,
        "z": -0.00392889744,
        "w": -0.00392889744
      },
      ...
    }
  ]
}

Note: We may change that in a future release and move lightmap-related data to a NEEDLE_lightmap extension entry per node.

How it looks in Unity image

How it looks with Needle Engine (threejs) image

How it looks in gltf-viewer image

How it looks in hyperfy.io

image