Skip to content

GLTF: Write integer min/max for integer accessors#111612

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
aaronfranke:gltf-accessor-min-max-int
Nov 14, 2025
Merged

GLTF: Write integer min/max for integer accessors#111612
Repiteo merged 1 commit into
godotengine:masterfrom
aaronfranke:gltf-accessor-min-max-int

Conversation

@aaronfranke
Copy link
Copy Markdown
Member

@aaronfranke aaronfranke commented Oct 13, 2025

Currently, when exporting a file from Godot with an integer accessor type, it looks like this:

{ "bufferView": 3, "componentType": 5126, "count": 24, "max": [1.0, 1.0], "min": [0.0, 0.0], "normalized": false, "type": "VEC2" },
{ "bufferView": 4, "componentType": 5121, "count": 36, "max": [23.0], "min": [0.0], "normalized": false, "type": "SCALAR" },
{ "bufferView": 5, "componentType": 5126, "count": 11, "max": [5.0], "min": [0.0], "normalized": false, "type": "SCALAR" },
{ "bufferView": 6, "componentType": 5121, "count": 11, "max": [1.0], "min": [0.0], "normalized": false, "type": "SCALAR" }

5126 means single-precision float (32-bit float), and 5121 means unsigned byte (8-bit integer). The "max": [23.0], "min": [0.0] values are not technically wrong, since JSON just has "number", but they are misleading. This PR changes the serialization of accessors with integer data types to use integer min/max values, so it would look like this:

{ "bufferView": 3, "componentType": 5126, "count": 24, "max": [1.0, 1.0], "min": [0.0, 0.0], "normalized": false, "type": "VEC2" },
{ "bufferView": 4, "componentType": 5121, "count": 36, "max": [23], "min": [0], "normalized": false, "type": "SCALAR" },
{ "bufferView": 5, "componentType": 5126, "count": 11, "max": [5.0], "min": [0.0], "normalized": false, "type": "SCALAR" },
{ "bufferView": 6, "componentType": 5121, "count": 11, "max": [1], "min": [0], "normalized": false, "type": "SCALAR" }

This helps with KHR_node_visibility, because it needs to encode accessors as unsigned byte (8-bit unsigned integers).

@fire
Copy link
Copy Markdown
Member

fire commented Nov 13, 2025

Dependencies have been merged.

@aaronfranke aaronfranke force-pushed the gltf-accessor-min-max-int branch from d8375a8 to 23ed730 Compare November 14, 2025 02:16
@aaronfranke aaronfranke marked this pull request as ready for review November 14, 2025 03:05
@aaronfranke aaronfranke requested a review from a team as a code owner November 14, 2025 03:05
@aaronfranke aaronfranke moved this from Work in progress to Ready for review in Asset Pipeline Issue Triage Nov 14, 2025
@aaronfranke aaronfranke modified the milestones: 4.x, 4.6 Nov 14, 2025
@Repiteo Repiteo merged commit aa248bf into godotengine:master Nov 14, 2025
20 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for review to Done in Asset Pipeline Issue Triage Nov 14, 2025
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented Nov 14, 2025

Thanks!

@aaronfranke aaronfranke deleted the gltf-accessor-min-max-int branch November 15, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants