stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.32k stars 917 forks source link

fix: Remove signed blend indices due to dropping OpenGL ES 2 support #2323

Closed Basewq closed 1 week ago

Basewq commented 2 weeks ago

PR Details

Primary aim is to fix TransformationSkinning.sdsl shader where skinning wasn't working on Android, due to mismatched data type being passed from app to shader. Due to dropping OpenGL ES 2, blend indices can now just behave like non-ES 2 versions (ie. just use uint data type, instead of using float).

Related Issue

Fixes #2284 where the background info/problem arose from.

Here's my understanding of the original intention/code: OpenGL ES 2 did not support passing int/uint data types, so needed a workaround to use float instead. https://github.com/stride3d/stride/blob/1fc0d5137750a8c3d8acd5f89e3b63c75b6bea7f/sources/engine/Stride.Rendering/Rendering/Skinning/TransformationSkinning.sdsl#L28-L33 As seen in this code (and the comments I removed from the TransformationSkinning.sdsl file), the workaround for ES 2 was supposed to be to use float4.

However, it turns out the importer only passed signed or unsigned integer types: https://github.com/stride3d/stride/blob/1fc0d5137750a8c3d8acd5f89e3b63c75b6bea7f/sources/tools/Stride.Importer.3D/MeshConverter.cs#L724-L753 This was still incorrect and should have been passing a float type. Side note: even though this file is the new importer, this bug goes all the way back to the original importer.

Anyway, OpenGL ES3+ now supports int/uint data types, so the above no longer needs a workaround. I have tested this on an Android project and the model is skinned properly now.

Types of changes

Checklist