Manwe Work 1
Manwe Work
Bodyguardd 1
Bodyguardd
Vahsi Uzman 1
Vahsi Uzman
Reklam vermek için turkmmo@gmail.com

Cevaplandı Gr2 runtime motion to glTf/glb /bgfx renderer/

Hi Community
I have successfully implemented bgfx and since I want to develop for android/ios in the future, I need to replace granny with glb since the source of granny2.lib android/ios is not public,
Does anyone have an idea how I can make a glb from granny motion files? eg: wait.gr2 run.gr2 etc.
 
Son düzenleme:
Çözüm
Methods for Converting Granny2 (.gr2) Animations to .GLB / glTF 2.0 Format:

You can follow three different approaches to eliminate the .gr2 dependency within a BGFX and cross-platform (Android/iOS) architecture:

1. Blender + Python Automation (Most Practical and Stable Method):

Use the open-source GR2 Importer add-on for Blender.

After loading the character skeleton, import the .gr2 animations (e.g., wait.gr2, run.gr2) as additional Actions.

Export the desired .glb file using Blender's built-in glTF/GLB exporter, ensuring you select "Include > Animation" and "Transform > Y-Up."

Tip: You can automate batch conversion for all files in a folder using the `blender --background --python` command.

2. C++ Command-Line Tool (tinygltf /...
Methods for Converting Granny2 (.gr2) Animations to .GLB / glTF 2.0 Format:

You can follow three different approaches to eliminate the .gr2 dependency within a BGFX and cross-platform (Android/iOS) architecture:

1. Blender + Python Automation (Most Practical and Stable Method):

Use the open-source GR2 Importer add-on for Blender.

After loading the character skeleton, import the .gr2 animations (e.g., wait.gr2, run.gr2) as additional Actions.

Export the desired .glb file using Blender's built-in glTF/GLB exporter, ensuring you select "Include > Animation" and "Transform > Y-Up."

Tip: You can automate batch conversion for all files in a folder using the `blender --background --python` command.

2. C++ Command-Line Tool (tinygltf / cgltf + Granny SDK):

Create a C++ project in your Windows development environment and use the Granny SDK (granny2.dll) to read bone, keyframe, and transform data via `FileInfo->Animations`.

Serialize the read binary data into the .glb format in memory using the tinygltf or cgltf library and save the result.

3. Assimp Library:

Using the Assimp C++ API, read the .gr2 file with `ReadFile` and generate .glb output directly via `Assimp::Exporter` using the "glb2" format code.

Important Notes for Mobile (Android/iOS) + BGFX:

Bone Weight Limit: Normalize bone influence (bone weight) per vertex to a maximum of 4 bones.

Matrix Array Limit: Limit the total number of bones in the model to 64 or 128 to avoid exceeding mobile GPU shader uniform limits. Quaternion Normalization: Ensure that Rotation Quaternion (XYZW) values are normalized during transformation to prevent limb stretching in BGFX.
 
Çözüm

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst