FBX Export: Spot Light Rotation and Position Differ from Camera Position and Rotation #97634
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#97634
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows 10
Graphics card: RX 580 (4GB)
Blender Version
Broken: 3.1
Worked: Haven't tested
Spot Light exported to FBX has a seemingly random rotation, and location is offset from source. I am using Three.js to export cameras, and lights to Terragen , which doesn't support these features in it's FBX reader. I have checked the source code for Three.JS and it is not modulating these values, and I am even using the raw FBX Tree attributes. This variance between camera position/rotation and spot light position/rotation are being baked into the file by Blender.
This may be something I am just unaware of, but it seems like random behavior. I ensured the euler for the cameras and spot light was correct.
Exact steps for others to reproduce the error
Export a scene with cameras and spot lights to convert them to a TGC (Terragen Clip File) or observe the data in the console.
FBX Converter
https://nwdagroup.com/terragen-tools/fbx2terragen/
Test FBX File
4-axis-cameras-plus-lights.fbx
Blend File
4-axis-cameras-plus-lights.blend
Terragen Conversion Settings for Blender XYZ Euler
Euler Order: YXZ
Offset:0 90 0
Swap X with Z: Checked
Added subscriber: @WASasquatch
Added subscriber: @PratikPB2123
Added subscriber: @OmarEmaraDev
Changed status from 'Needs Triage' to: 'Needs User Info'
The converter expects
+Y is UP and +Z is FORWARD
which is not the default. Did you make sure to account for that?The lights also import fine in other programs, so this is probably an axis incompatibility. So can you try different configurations and see if any of the works?
As already noted, the offset in both position, and rotation is baked into the FBX file itself, from Blender, even when it's in the exact same location, and rotation of a camera in the same spot.
The converter is written by me, and that is just how to get the correct orientation within the target software, not Blender. It also doesn't change any value, these are raw values from the FBXNodeTree within the FBX file baked by Blender.
Obviously something is wrong if a spot light at the same location, rotation (literally copied within Blender) comes out with a random location and rotation within the FBX file created by Blender.
Have you looked at the supplied file, and exported a FBX from it in 3.1? Y+ is set UP, and Z+ forward is required for Terragen, but this doesn't modulate any values to be saved in the file, so why is a different type of object getting different location and rotation values?
I am converting Camera, Point Light, and Spot Light, and the only object that has an issue, all while utilizing the same settings, and even in the same location and rotation as a camera for exact reference, is the Spot Light. The same rules applied to every other object in the converter are applied to the Spot Light, so it should yield the same location and rotation as the camera at that location. But it's floating off from that location, and looking in a totally random direction.
Additionally, I have tried all the Eulers within Blender, and Z/Y settings, but naturally, this just messes up the entire converter, as it's working fine, save for one specific type of object, the Spot LIght.
Well the FBX file can't really contain random values because it can be correctly imported back. So it must be a compatibility issue, possibly due to the exported.
But looking at a dump of the exported FBX file, I find:
With rotations and translations matching those of Blender after axis conversion. It should be noted that cameras and lights are exported with different transformations as far as I can see, to transform into FBX space. Lights are rotated 90 degrees around x and cameras around y. So I wound't expect them to be the same.
What random values do you see in the exported file?
The default data before the exporter touches anything is:
Camera
Spotlight
For Camera and Spotlight in the same location/rotation. For me it seems random. As for the camera offset, I did discover that, and it is applied for the final export for the cameras on Y. I hadn't realized lights would need one on X (which also seems arbitrarily random and makes little sense, is there a reason? That doesn't seem to match any logic for any end-program's euler order and coordinate system, and would inherently conflict with them)
At the same same, it doesn't appear a simple offset on X is the issue here.
The exporter at https://nwdagroup.com/terragen-tools/fbx2terragen/ will spit out all the data it uses regarding objects in the Developer Tools Console if you want to see it live or see about a file you created (maybe my Blender is bugged?)
Firefox/Chrome Console: Ctrl + Shift + J
camera-spotlight-light.fbx
camera-spotlight-light.blend
Dumping this same file using the FBX SDK gives me:
Which is consistent with the values in Blender, so are we really sure that online converter is parsing things correctly?
Did you try any other software and check how it reads that FBX file?
Off-Topic: I suddenly can't reply by email, it says the server is misconfigured.
I don't have any other DCC that can read FBX, besides blender. I mean, Terragen can, but only for objects. For some reason, it can't do cameras, and lights. Which is why I am developing this with Three.js.
I have made a report about it with Three.JS but they said the values are not be modulated, and couldn't offer me anymore support. I did dig through the code, and couldn't find anything be modulated. It loads the data from the FBXNodeTree, and just applies the data raw to the creation of a camera/light/object. And they have gone silent on the issue which has brought me here.
However, it being consistent with Blender doesn't mean it's right? Especially when I am applying a different coordinate system? Y+ Up, and Z+ Forward? Shouldn't it then NOT relate to Blender and relate to the coordinate system I am targeting?
If I can find the exact reason for why this is happening, or what sort of offset is happening here I could probably provide Three.js info on how to fix this issue. They have admitted not much time was spent on the FBX importer.
I meant consistent in the sense that they are identical to the values in blender after the transformation to the FBX space.
I don't have time this week to look into this further, so I will pick it up later. Since you are on Windows, can you try to download the FBX Review application and check the FBX file there? Maybe this will give us some insights.
Oh, I didn't know about that software. I download FBX SDK (Since it apparently replaces FBX Converter, which contained FBX Explorerer) but hadn't opened it up yet. I'll check out FBX Review. I also made a fresh post with Three.js regarding observations here, and that something somewhere may be modulating these values when reading the FBX files (maybe one of them math utilities). Maybe this will narrow down where someone looks there.
Did you get the time to investigate the issue in FBX Explorer?
I did, and I saw the same thing you saw. So the change must be coming from Three.js, but they are not helping me. I tried looking all over but couldn't specifically find any alterations to rotation or centre. I am at a loss right now.
Changed status from 'Needs User Info' to: 'Archived'
FBX is a rather hard format to get right, so if you can use an alternative format, that would be best. Maybe GLTF.
Since we can't confirm that this is an issue in Blender itself, I will archive this for now. If you have new information, feel free to add them here and we can reopen and investigate then.