FBX Exporter: Incorrect 'Type' field in material 'Mapping' node #96858

Open
opened 2022-03-29 17:20:03 +02:00 by Felix Herbst · 6 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.15

Blender Version
Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash: blender/blender@c77597cd0e

Short description of error
Export and import a FBX with a simple material with a texture mapping results in incorrect tiling as the Mapping type is set to "Texture" instead of "Point" (the default).

After importing the FBX:

Expected: Result:
image.png image.png

NOTE: Analyzing other softwares, the same result of the texture mapping is verified after importing the file. This indicates that the problem is in the exporter.

NOTE: Switching type to "Texture" and adjusting the values to 0.1,0.1,0.1 is a workaround but should not be required.

If I'm not mistaken this needs to be fixed in export_fbx_bin.py:fbx_data_texture_file_elements:1432,
elem_props_template_set(tmpl, props, "p_vector_3d", b"Scaling", (((1.0 / s) if s != 0.0 else 1.0) for s in tex.scale))
might need to take the mapping type into account.

For reference, glTF seems to do that in gltf2_blender_get.py:get_texture_transform_from_mapping_node and takes TEXTURE, POINT and VECTOR into account for calculating the texture transform.

Exact steps for others to reproduce the error

  • Open attached file or:
    • Create a cube
    • Add a material
    • Add a texture to Base Color
    • Add a UV Map node and a Mapping node, note the default type is "Point"
    • Set Scale to 10,10,10
  • Export as FBX with embedded textures
  • Open a separate Blender instance
  • Import the FBX
    Note that the resulting texture tiling is effectively "inverted"

For reference:

  • Export as GLB
  • import the glTF
    Note that the result is correct

Attached files:
close-up-of-walking-cat-flip-2019_cc-by-20.jpg
CubeWithTiling.blend

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.15 **Blender Version** Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash: `blender/blender@c77597cd0e` **Short description of error** Export and import a FBX with a simple material with a texture mapping results in incorrect tiling as the Mapping type is set to "Texture" instead of "Point" (the default). After importing the FBX: |Expected:|Result: | -- | -- | |![image.png](https://archive.blender.org/developer/F12954172/image.png)|![image.png](https://archive.blender.org/developer/F12954184/image.png) NOTE: Analyzing other softwares, the same result of the texture mapping is verified after importing the file. This indicates that the problem is in the exporter. NOTE: Switching type to "Texture" and adjusting the values to 0.1,0.1,0.1 is a workaround but should not be required. If I'm not mistaken this needs to be fixed in `export_fbx_bin.py:fbx_data_texture_file_elements:1432`, `elem_props_template_set(tmpl, props, "p_vector_3d", b"Scaling", (((1.0 / s) if s != 0.0 else 1.0) for s in tex.scale))` might need to take the mapping type into account. For reference, glTF seems to do that in `gltf2_blender_get.py:get_texture_transform_from_mapping_node` and takes TEXTURE, POINT and VECTOR into account for calculating the texture transform. **Exact steps for others to reproduce the error** - Open attached file or: - Create a cube - Add a material - Add a texture to Base Color - Add a UV Map node and a Mapping node, note the default type is "Point" - Set Scale to 10,10,10 - Export as FBX with embedded textures - Open a separate Blender instance - Import the FBX Note that the resulting texture tiling is effectively "inverted" For reference: - Export as GLB - import the glTF Note that the result is correct **Attached files:** ![close-up-of-walking-cat-flip-2019_cc-by-20.jpg](https://archive.blender.org/developer/F12954175/close-up-of-walking-cat-flip-2019_cc-by-20.jpg) [CubeWithTiling.blend](https://archive.blender.org/developer/F12954176/CubeWithTiling.blend)
Author

Added subscriber: @herbst

Added subscriber: @herbst
Germano Cavalcante changed title from Exporting FBX with Mapping node set to "Point" exports incorrect texture tiling to Importing an exported FBX with 'Vector Mapping' node set to "Point" results in incorrect texture Mapping 2022-03-30 20:27:04 +02:00

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Thanks for the report. I edited the description to be a little clearer.

Thanks for the report. I edited the description to be a little clearer.
Author

In #96858#1332488, @mano-wii wrote:
Thanks for the report. I edited the description to be a little clearer.

Thank you. Out of curiosity, why did you remove my remarks about this being an export bug (instead of an import bug)?

> In #96858#1332488, @mano-wii wrote: > Thanks for the report. I edited the description to be a little clearer. Thank you. Out of curiosity, why did you remove my remarks about this being an export bug (instead of an import bug)?

In #96858#1332540, @herbst wrote:
Thank you. Out of curiosity, why did you remove my remarks about this being an export bug (instead of an import bug)?

The message was a little confusing. I read that it was "verified that the import is correct ... in external softwares", but now looking back I see that I got it wrong. I will edit.

> In #96858#1332540, @herbst wrote: > Thank you. Out of curiosity, why did you remove my remarks about this being an export bug (instead of an import bug)? The message was a little confusing. I read that it was "verified that the _import_ is correct ... in external softwares", but now looking back I see that I got it wrong. I will edit.
Germano Cavalcante changed title from Importing an exported FBX with 'Vector Mapping' node set to "Point" results in incorrect texture Mapping to FBX Exporter: Incorrect 'Type' field in material 'Mapping' node 2022-03-30 21:16:59 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#96858
No description provided.