bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.7k stars 3.53k forks source link

Support FBX file loading #15705

Open tbillington opened 5 days ago

tbillington commented 5 days ago

What problem does this solve or what need does it fill?

FBX is a commonly used file format for 3d models. Many 3d models & asset packs from asset stores, eg the popular Unity AssetStore, only supply models & materials in .fbx format.

By not supporting FBX, Bevy users must convert assets manually which is especially painful as some asset packs can have hundreds of model files. This hinders teams trying to leverage commercial assets to speed up their development.

What solution would you like?

Support FBX file import through a loader/processor.

A loader like bevy_mod_fbx could be upstreamed.

Alternatively, like Godot, leverage fbx2gltf or ufbx(current Godot default) within the engine to perform the conversion seamlessly for users

What alternative(s) have you considered?

Relying on 3rd party crates (none seem up to date), or manually converting via Blender.

Add fbx -> gltf conversion into the bevy cli tool.

Additional context

I searched for "fbx" issues previously, but couldn't find one in the repo. I assume this has been thought of before, but I wanted to formalise it.

mrchantey commented 3 days ago

Great idea centralizing discussion on additional 3d model formats. I think it makes sense to have a clear path for how to do this in bevy, and for efforts to be consolidated.

I guess conversion to gltf is the discussion here, deep conversionless integration would add quite a bit of complexity both in implementation and maintenance.

Seeing as godot has picked up the reigns of FBX2glTF, us not having our own one might be more of a 'feature than a bug', as in being able to share maintenance of engine agnostic tools allows both communities to focus on other things.

Regarding batch conversion I'd personally prefer to use a cli with a simple recursive script instead of something deeply integrated and automatic, particularly because the process is lossy, but of course thats easy to say for people who write scripts and use cli tools every day.

I suppose the exact workflow for non-technical people might be easier to visualize once we have an editor, like some kind of extension that runs FBX2glTF whenever an FBX file is dragged and dropped into the asset section.

tbillington commented 3 days ago

I guess conversion to gltf is the discussion here

Yes. Bevy seems quite gltf-centric so converting to gltf is probably the most feasible option that also avoids increasing the logic in bevy "core".

I suppose the exact workflow for non-technical people might be easier to visualize once we have an editor, like some kind of extension that runs FBX2glTF whenever an FBX file is dragged and dropped into the asset section.

This is what Godot does, and is likely like the most user friendly solution, especially if you include teams with people who may not be CLI fluent. In my opinion, the original file should still be kept in assets, but the resulting gltf would end up in the directory from asset_processor.

VitalyAnkh commented 1 day ago

Seeing as godot has picked up the reigns of FBX2glTF

Godot 4.3 introduced a native FBX importer, ufbx, and enabled it by default. This change is more user-friendly and greatly improves the overall experience.

Since glTF and FBX are inherently different formats, direct conversion often results in information inconsistencies and other undesirable outcomes. The best solution for FBX support is to implement a native importer. Upstreaming bevy_mod_fbx is a positive step.