X Tutup
Skip to content

Add checkbox for blender's "GPU Instances" option for exporting GLTF#107672

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
2frac:gpu_instances_blender_option
Oct 27, 2025
Merged

Add checkbox for blender's "GPU Instances" option for exporting GLTF#107672
Repiteo merged 1 commit intogodotengine:masterfrom
2frac:gpu_instances_blender_option

Conversation

@2frac
Copy link
Contributor

@2frac 2frac commented Jun 18, 2025

Bugsquad edit: Depends on #108853, #109103, and #107866.

exposes "export_gpu_instances" option: https://docs.blender.org/api/4.0/bpy.ops.export_scene.html#bpy.ops.export_scene.gltf

Enabling it will export instances and particle systems as GLTF's buffer/accessor data instead of numerous singular Mesh3D object. This does not include Geometry Nodes instancing.

Small project to test export with/without option: https://github.com/2frac/godot-gpu-instances-test
It also has small addon which actually creates and fills MultiMeshInstance3D using GLTFDocumentExtension. I might check if it is easy to add MultiMeshInstance3D creation to engine itself, but that seems like a separate task.

@2frac 2frac requested a review from a team as a code owner June 18, 2025 16:40
@AThousandShips AThousandShips changed the title Added checkbox for blender's "GPU Instances" option for exporting GLTF Add checkbox for blender's "GPU Instances" option for exporting GLTF Jun 18, 2025
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also ok with it on by default.

@passivestar
Copy link
Contributor

I might check if it is easy to add MultiMeshInstance3D creation to engine itself, but that seems like a separate task.

That will actually be useful to have considering blender groups them by common parent so they will be culled by the same clusters they were created in. This workflow seems like a good candidate for core because there's nothing to configure in there, it just works

@2frac
Copy link
Contributor Author

2frac commented Jun 18, 2025

I'm also ok with it on by default.

I think checkbox being disabled by default slightly better, since this is default in blender, and introducing it like this will not change import in any existing project. Also without using any additional scripts it will just create single MeshInstance3D node(instead of several hundreds - which is bad overall, but less confusing)

@2frac
Copy link
Contributor Author

2frac commented Jun 22, 2025

This does not include Geometry Nodes instancing.

I was wrong, it does. Older blender(4.2.1) throws exception while trying to export GN to instances, however. On 4.4.3 it works fine.

@2frac
Copy link
Contributor Author

2frac commented Aug 4, 2025

Since #107866 having 4.6 milestone now, will it make sense to add same one here? Though not direct, but this one is basically requirement.

Or maybe it will be simpler to just move code to other PR and close that one?

@Repiteo Repiteo modified the milestones: 4.x, 4.6 Oct 24, 2025
@Repiteo
Copy link
Contributor

Repiteo commented Oct 24, 2025

Could you squash your commits? See our pull request guidelines for more information

@2frac 2frac force-pushed the gpu_instances_blender_option branch from 9ba4a2f to 40fcf5e Compare October 25, 2025 12:10
@Repiteo Repiteo merged commit 40e3ac8 into godotengine:master Oct 27, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 27, 2025

Thanks! Congratulations on your first merged contribution! 🎉

@aaronfranke
Copy link
Member

aaronfranke commented Oct 27, 2025

@Repiteo I'm confused as to why this PR was merged, surely it was a mistake? This PR adds a checkbox to tell Blender to export with EXT_mesh_gpu_instancing, but Godot can't read EXT_mesh_gpu_instancing yet. So if users enable this checkbox, Godot will instruct Blender to make a file that Godot can't read.

This PR should've been marked as draft, with PR #107866 as a prerequisite, and that PR itself has other prerequisites, notably #108853 and #109103.

@fire
Copy link
Member

fire commented Oct 27, 2025

@aaronfranke we can amend or revert. My bad.

@2frac
Copy link
Contributor Author

2frac commented Oct 27, 2025

This change shouldn't break any files by itself - it just adds fields current import will ignore(or should, at least)

I initially planned to just use this for plugins(which is worked). It is now looking kinda useless by itself, however, considering actual imports/exports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

X Tutup