Closed m4rr5 closed 6 months ago
import Blender files is an implementation detail and the user should therefore have the same freedom as in Blender to disable the rotation
I am not convinced.
You can also rotate and apply in Blender or in godot engine with a post import script.
Open to converse with your use case.
We discussed this before on RocketChat, and I mentioned that this goes against the glTF specification because Y is always up in glTF, and the object would have the "wrong" orientation once in Godot (but correct for your use case) because it would be lopsided with its up side pointing on the Z-axis. This does not necessarily mean I will block this but I consider your use case to be a hack and I don't know if it deserves engine-level support.
Addressing the two suggestions you made @fire for my use case I really do not want to rotate and apply the transformation in Blender, as this would mean the model coordinates there would end up being different from the ones in the physics engine (and underlying ISO standard) which is really inconvenient. These models contain a lot of elements that map 1:1 to physics elements. As an example, if you look at the suspension of the car, you typically talk about "pickup points" which are coordinates where suspension arms are attached to the vehicle chassis and those obviously need to align both in physics and in graphics. So for my use case it is important that, when developing and debugging vehicles, if I read a coordinate it does not need to be transformed back "in my head" anymore.
Your second suggestion, to use a post import script, is in theory possible, but it would end up much longer, slower and more complicated than a flag which does not rotate the scene in the first place (so we don't have to rotate it back later). I don't believe it makes sense for me to write such a script given that it would never be accepted into the core of Godot, so then the question for me becomes do I want to maintain the PR attached to this proposal or a post-import script and the answer to that is simple. Now if there is consensus that the outcome of this proposal is to not accept it because my use case is too special to make this small change, I can certainly live with that.
Finally, addressing your comment @aaronfranke I certainly remember the discussion. My take on it is that a direct Blender import is unrelated to glTF. Yes it is true that Blender supports importing and exporting that standard, and it's an important standard, but the feature we are discussing here is a direct import of scenes from Blender to Godot and in that context, the fact that under the covers this leverages the glTF importer functionality is just an implementation detail.
My take on it is that a direct Blender import is unrelated to glTF. ... the fact that under the covers this leverages the glTF importer functionality is just an implementation detail.
Honestly, I agree. I think that is good enough justification. Disregarding glTF as an implementation detail, it seems like a reasonable request to allow not rotating away from the original Blender orientation. As long as we make sure to not mix this flag up with Godot's glTF support, there is not much of a reason to not add this.
My take on it is that a direct Blender import is unrelated to glTF. ... the fact that under the covers this leverages the glTF importer functionality is just an implementation detail.
Honestly, I agree. I think that is good enough justification. Disregarding glTF as an implementation detail, it seems like a reasonable request to allow not rotating away from the original Blender orientation. As long as we make sure to not mix this flag up with Godot's glTF support, there is not much of a reason to not add this.
I'm of the same opinion. If we're just talking about the GLTF import, sure. But here GLTF is just used as an intermediate and we're really talking about importing Blender files and supporting the different use cases when dealing with Blender is important.
Especially looking at the bigger picture with assets often being store bought. You do not want to be forced to edit dozens of Blender files when there is an export/import feature that solves your problem.
I raised the issue of bought assets in a similar orientation/handedness issue and was largely ignored
Chiming in here since asked for my opinion. The way I see this is I don't think its a good idea for the following reasons:
If any actionable happens from the engine, it could be to expose access to change the flags passed to blender with add-ons, but I would not go further than that. Then you can use it to make a plugin that does exactly what you want, given the asset importer has really good plugin extendability support.
Describe the project you are working on
I am working on a game which uses a bespoke physics engine for vehicle dynamics that is integrated in Godot as a GDextension. Vehicle dynamics simulations typically use a Z-up right-handed coordinate system as defined by the ISO 8855:2011 - Road vehicles — Vehicle dynamics and road-holding ability — Vocabulary standard, a draft of ISO 8855 defines this.
I model my vehicles in Blender and import them into Godot directly, but since my “physics world” is Z-up I would like to import these blender models “as is”, so with the conversion disabled. My root Node3D (my world) uses a -90 degree rotation along the X-axis to convert everything to Y-up again for Godot while maintaining the option to read local coordinates in physics coordinates.
Describe the problem or limitation you are having in your project
I am leveraging the option to directly import Blender files but that is cumbersome to use because a hardcoded conversion now takes place to rotate the model from Z-up to Y-up. I would like to optionally disable this rotation as an import option for specific files.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
This is a very small enhancement that adds a single option to disable the “Y-up” conversion. It can be added to the import dialog as an extra option in the blender section. It should be enabled by default to stay backward compatible.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I have already implemented this feature and created a pull request. It is very simple and low-risk and only a few lines long. In the Blender scene importer module it adds a boolean option and depending on the state of that option, instead of hardcoding the “export_yup” parameter to true it sets it depending on what the user chose.
This is a direct link to the PR: https://github.com/godotengine/godot/pull/90128
If this enhancement will not be used often, can it be worked around with a few lines of script?
There is currently no way to do this in a plugin as there are no hooks to do so prior to starting the import. Hooks do exist after the import but that would mean iterating over all the meshes and rotating them back, which takes a significant effort compared to the proposed pull request and is also a lot slower.
Is there a reason why this should be core and not an add-on in the asset library?
This is an option that Blender supports in its UI when exporting a scene as glTF but it is currently hardcoded in Godot. Whilst I am aware that in glTF the world should be Y-up, the fact that the Godot implementation uses glTF as an intermediate step to import Blender files is an implementation detail and the user should therefore have the same freedom as in Blender to disable the rotation.