Skip to content

added in vertex start positions to address gltf file with mixed indic… - #256

Merged
TheMostDiligent merged 2 commits into
DiligentGraphics:developmentfrom
cadams-dak:gltf_bug_fix
Nov 7, 2025
Merged

added in vertex start positions to address gltf file with mixed indic…#256
TheMostDiligent merged 2 commits into
DiligentGraphics:developmentfrom
cadams-dak:gltf_bug_fix

Conversation

@cadams-dak

Copy link
Copy Markdown
Contributor

added in vertex start positions to address GLTF files with mixed indices/no indices primitives. This is part of the loading issue. The other part will be in DiligentFX.

@TheMostDiligent

Copy link
Copy Markdown
Contributor

I don't see that the new added parameter is used anywhere in GLTF loader. How is this supposed to work?
Also, do you have a problematic GLTF file that fails to load without this change?

@cadams-dak

cadams-dak commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

I don't see that the new added parameter is used anywhere in GLTF loader. How is this supposed to work? Also, do you have a problematic GLTF file that fails to load without this change?

It would be used in here PBR/src/GLTF_PBR_Renderer.cpp. I can see if the org would let me link the GLTF file. The resource was made in cinema 4d which exported a valid GLTF file that contained primitives with Indices keys and some without. Since the PBR/src/GLTF_PBR_Renderer.cpp assumed a global start position, the primitives that came after with no indices key would have the incorrect vertices from the buffer.

Also to add it never failed to load it would just be rendered incorrectly.

@cadams-dak

Copy link
Copy Markdown
Contributor Author

exported_text_scene (9) 1 (1).zip Here is the file that didn't render properly.

Comment thread AssetLoader/interface/GLTFLoader.hpp Outdated
const Uint32 FirstIndex;
const Uint32 IndexCount;
const Uint32 VertexCount;
const Uint32 VertexStart;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest naming the variable FirstVertex to make it consistent with FirstIndex.
Also, add it before the VertexCount to make the ordering consistent as well.

IndexStart,
IndexCount,
VertexCount,
VertexStart,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since for indexed primitives, start vertex is baked into the index buffer, I suggest setting it to zero to avoid confusion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a line for this

@TheMostDiligent
TheMostDiligent changed the base branch from master to development November 7, 2025 03:36
@TheMostDiligent
TheMostDiligent merged commit 42660fe into DiligentGraphics:development Nov 7, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants