Hey, I’m currently working on a glTF model viewer and have been able to get most of the parsing and rendering of glTF models quite far. One issue I’m running into is situations where a node has negative scaling along some axis. This ends up causing some inversion and my models get rendered incorrectly.
The glTF spec notes: " Implementation Note: If the determinant of the transform is a negative value, the winding order of the mesh triangle faces should be reversed. This supports negative scales for mirroring geometry."
I’m not sure how to approach this situation. I know I can control the winding order when creating my graphics pipeline, but to have another pipeline for these negative-scale meshes seems wrong and heavy handed. If I simply reverse the winding order of the indices when loading the model, then my actual model data will be stored reversed, but if I change my scale to a positive number during runtime, I’d have to update the indices as well. Any recommendations would be much appreciated!
If your implementation supports
VK_EXT_extended_dynamic_state, you can change the cull mode between your draw calls for glTF nodes with a different winding order using
That extension is pretty new though and not (yet) widely supported.
Otherwise I’d go with the separate pipeline you mentioned. It may be possible to handle this at glTF loading time, but only if the node isn’t reused with different scaling signs.
Right, so if I want to be able to change the scaling during the lifetime of the node (game entity), then I definitely shouldn’t change the winding order directly during loading time.
I’m very new to Vulkan so I’m really unsure how heavy certain features/operations are but I’m glad my original thought wasn’t far off the mark. Thank you for the reply, and I’m also super thankful for your site and github, its been very helpful when I need to make sure I’m not doing anything stupid
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.