Add inverse model matrix to Mesh uniform buffer#6608
Add inverse model matrix to Mesh uniform buffer#6608pbaja wants to merge 2 commits intobevyengine:mainfrom
Conversation
|
I'd like to see some performance numbers here. |
|
I have run many_cubes test with
Not great. In this case, I guess to get a model inverse matrix, one should do I guess this PR can be closed. |
|
It may have worth to move the transpose explicitly to the GPU. If it's "free" on the GPU and has a cost on the CPU, makes more sense to just provide the inverse and transpose it in the shader. It's also a simpler mental model for developers. |
|
@pbaja do you mind trying the alternative I proposed above? If it shows that it's as performant, we can probably merge the change. |
|
Now that #12773 is merged, this can be closed. The model inverse transpose is computed on the GPU anyways due to bandwidth savings. Getting inverse model is just a different unpacking of it and should be pretty cheap. |
|
I wouldn't say that it can be closed only because of #12773 because that is only addresses platforms with compute. That said, the inverse transpose is available and can be transposed back and reconstructed into the full inverse model matrix on all platforms, and various performance optimisations have and continue to be done to make performance as good as it reasonably can be. |
Objective
unity_WorldToObjectfunctionality from UnitySolution
model_inversefield to Mesh and Mesh2d structsinverse_transpose_modelfield.transformtomodelin the MeshUniform and Mesh2dUniform structs, to match structs in shaders and reduce confusion. I can revert it if this is unwanted.