kaosat-dev / Blenvy

Bevy Code & Blender addon for a simple workflow to add & edit Bevy components in Blender
Other
520 stars 46 forks source link

Blender's children are transferred over to bevy #182

Closed BUGO07 closed 3 weeks ago

BUGO07 commented 4 months ago

Please add the mesh data to the first parent component in blender or change the blender plugin to allow not dealing with what's shown in the first picture because otherwise there's just a lot of entities in the scene and it is costing performance, in just a small scene that would not have more than 60 entities otherwise i get 193 entities because of this, and it severely hurts performance to the point where with a 12th gen i5 and a 1080Ti i get ~300fps while doing this normally in bevy i had more than triple that

image

image

BUGO07 commented 4 months ago

this can also mess because there is no direct way to add colliders (using bevy_rapier3d) so it has to be implemented by code and for mesh colliders Handle has to be queried from the children and when the collider is appended to the child but i also want to modify the velocity component which i added through blender if i try to match it with the entity hit by a raycast it won't match since velocity belongs to the parent while the collider belongs to the child, for shape colliders this can be avoided but for mesh colliders its way more expensive performance-wise to avoid this.

BUGO07 commented 4 months ago

so basically what i'm saying is that the child entities should not exist and every component should belong to the parent

kaosat-dev commented 4 months ago

Hi @BUGO07 !

BUGO07 commented 4 months ago

Thanks for the response, I will try these in a few hours.

BUGO07 commented 4 months ago

Okay, I'm using Blender 4.0 and for me the default bevy glTF export only shows GPU Instances in the Scene Graph section, it doesn't show Flatten Object Hierarchy or the other two, which is weird... I'll try a bit more digging.

BUGO07 commented 4 months ago

I'm updating to 4.1.1 (the latest version right now) to test if it's available there

BUGO07 commented 4 months ago

4.1.1 does have the Flatten Object Hierarchy option but I don't see any difference between the auto export and blender's default glTF 2.0 export :/

BUGO07 commented 4 months ago

Actually, I had pressed Ctrl+S after exporting because I guess I'm used to it but by actually using blender's default export for some reason my current collider system doesn't work, there's no colliders to any entities, I'll look into this

BUGO07 commented 4 months ago

Normal exporting doesn't seem to include any bevy components in the actual glb file (and it still has the nested children), but for some reason the file is actually way bigger, it was 47kb with auto export but it is 5567kb now with normal export, I didn't think auto export was necessary for bevy components to work..

EDIT: I guess it is because with blender's default export it takes all the scenes in so it has normal size + the blueprint sizes

EDIT 2: After thoroughly inspecting the default export settings I found out I didn't have custom properties on, because of this bevy_components pretty much didn't work, after enabling that and trying Flatten Object Hierarchy option on and off I see no difference, I guess only thing I have left to do is flatten it myself :/

janhohenheim commented 1 month ago

Update from the Blenvy rework: we can now add children to the mesh object itself, which is extremely useful for things like Avian integration or adding NotShadowCaster/NotShadowReceiver.

I think this should address the issues you had even better than simply flattening the hierarchy :) As such, I'm voting to close this.

kaosat-dev commented 3 weeks ago

closing this one as , as @janhohenheim says this is now resolved in Blenvy, albeit not by flattening the hierarchy. Feel free to re-open if you disagreed :) (btw I am not going to add hierarchy flattening, as one of the aims of Blenvy is to match everything from Blender as close as possible, including hierarchies)