godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Import meshes as instanced scenes instead of duplicating them when using `.blend` import #7019

Open ywmaa opened 1 year ago

ywmaa commented 1 year ago

Describe the project you are working on

Any 3D game.

Describe the problem or limitation you are having in your project

When importing a .blend file as an example. It doesn't recognize instances, instead it treats each mesh as a separate object, even though in blender I instanced it using duplicate linked (the shortcut in blender is Alt+D).

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The asset importer should import the mesh data as one mesh And create mesh instance 3D using the same mesh data. As I imagine this should conserve hard disk space and even GPU power if the mesh is quite complex.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

N/A

If this enhancement will not be used often, can it be worked around with a few lines of script?

No it isn't possible to do it with lines of script. I have to for example import each object on its own using a separate .blend file. And then rebuild the whole level in Godot

Instead of making the level in blender and directly import it.

Which also makes tweaking the level visuals take some time or more steps.

Is there a reason why this should be core and not an add-on in the asset library?

Improving the import workflow out of the box.

Calinou commented 1 year ago

This depends on https://github.com/godotengine/godot/issues/56312, as this would require saving subscenes that can then be instanced.

AxelKulomaa commented 4 months ago

It's possible to create an instance collection in Blender, and use it to create the instances. Godot will only import the mesh in your instance collection, and the instances work as expected.

I noticed one issue with this method. Parenting the contents of the instance collection (which contains the source mesh you want to instance) to an empty in Blender will break the instances, so they will not show up in Godot, making it hard to organize the hierarchy of a large scene.

Instance collection and its instances in Blender: Screenshot 2024-06-20 123609 Source object and instances successfully imported in Godot: Screenshot 2024-06-20 123817 The scene in Godot contains only one mesh for the instances: Screenshot 2024-06-20 123809