FBX/OBJ Import - Show Backfaces makes object look wrong and is ON by default. #89630

Closed
opened 2021-07-03 12:32:50 +02:00 by Ramil Roosileht · 29 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 466.11

Blender Version
Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-06-20 22:39, hash: 6afafc46f6
Worked: never

Short description of error
When importing an fbx (especially from external programs), which has a texture connected to the alpha channel, blender automatically does two things:

  1. Changes Blend mode to Alpha Blend
  2. Enables "Show Backface" option
    This in turn always looks like something is wrong with the mesh (see #86661 (Material setting "show_transparent_back" (Show Backface) gives weird results)) and you have to disable "Show Backface" option manually
    for all materials every time you import something that uses textures

Exact steps for others to reproduce the error

  • Add a model
  • Add a material
  • Add a texture
  • Save the texture
  • Export an FBX
  • Import an FBX

See video for example ILOTlJyCf9.mp4

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 466.11 **Blender Version** Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-06-20 22:39, hash: `6afafc46f6` Worked: never **Short description of error** When importing an fbx (especially from external programs), which has a texture connected to the alpha channel, blender automatically does two things: 1. Changes Blend mode to Alpha Blend 2. Enables "Show Backface" option This in turn always looks like something is wrong with the mesh (see #86661 (Material setting "show_transparent_back" (Show Backface) gives weird results)) and you have to disable "Show Backface" option manually for all materials every time you import something that uses textures **Exact steps for others to reproduce the error** - Add a model - Add a material - Add a texture - Save the texture - Export an FBX - Import an FBX See video for example [ILOTlJyCf9.mp4](https://archive.blender.org/developer/F10210362/ILOTlJyCf9.mp4)
Author
Member

Added subscriber: @Limarest

Added subscriber: @Limarest

#97588 was marked as duplicate of this issue

#97588 was marked as duplicate of this issue

blender/blender-addons#88955 was marked as duplicate of this issue

blender/blender-addons#88955 was marked as duplicate of this issue

#94966 was marked as duplicate of this issue

#94966 was marked as duplicate of this issue

#91206 was marked as duplicate of this issue

#91206 was marked as duplicate of this issue
Contributor

Added subscriber: @scurest

Added subscriber: @scurest
Member

Added subscriber: @HDMaster84

Added subscriber: @HDMaster84
Member

Don't you usually get transparent textures on models like grass etc? There is would be indeed correct to use alpha blend and show backfaces. The problem with rendering the transparent objects with solid geometry is that the faces in an object are not ordered back to front. You can change the order by using Randomize for example or using Sort Elements > View Z Axis to get correct order for rendering.

The default could also be changed to Alpha Hashed, because that mode does not have the same issues (but other issues like noise). Show Backfaces should be probably kept though, because of the grass example.

Don't you usually get transparent textures on models like grass etc? There is would be indeed correct to use alpha blend and show backfaces. The problem with rendering the transparent objects with solid geometry is that the faces in an object are not ordered back to front. You can change the order by using Randomize for example or using *Sort Elements > View Z Axis* to get correct order for rendering. The default could also be changed to Alpha Hashed, because that mode does not have the same issues (but other issues like noise). Show Backfaces should be probably kept though, because of the grass example.
Author
Member

In #89630#1186505, @HDMaster84 wrote:
Don't you usually get transparent textures on models like grass etc? There is would be indeed correct to use alpha blend and show backfaces. The problem with rendering the transparent objects with solid geometry is that the faces in an object are not ordered back to front. You can change the order by using Randomize for example or using Sort Elements > View Z Axis to get correct order for rendering.

The default could also be changed to Alpha Hashed, because that mode does not have the same issues (but other issues like noise). Show Backfaces should be probably kept though, because of the grass example.

Transparent textures are used for everything, and there are times when you export something from other softwares and Blender just connects default texture's alpha by default.
I am not talking about removing the setting, but adjusting defaults so artists wouldn't need to change them manually. Be it Alpha Blend with Show Backfaces turned off or Alpha Hashed by default is not for me to decide, both work for me.
I asked Clement before in Blender Chat, if they are any reasons for these defaults. He told me that Show Backfaces turned on by default was to keep compatibility with Blender Internal, but that's not a deal breaker
Since we got rid of Blender Internal ages ago and it is time for 3.0, it should be fine to adjust defaults

> In #89630#1186505, @HDMaster84 wrote: > Don't you usually get transparent textures on models like grass etc? There is would be indeed correct to use alpha blend and show backfaces. The problem with rendering the transparent objects with solid geometry is that the faces in an object are not ordered back to front. You can change the order by using Randomize for example or using *Sort Elements > View Z Axis* to get correct order for rendering. > > The default could also be changed to Alpha Hashed, because that mode does not have the same issues (but other issues like noise). Show Backfaces should be probably kept though, because of the grass example. Transparent textures are used for everything, and there are times when you export something from other softwares and Blender just connects default texture's alpha by default. I am not talking about removing the setting, but adjusting defaults so artists wouldn't need to change them manually. Be it Alpha Blend with Show Backfaces turned off or Alpha Hashed by default is not for me to decide, both work for me. I asked Clement before in Blender Chat, if they are any reasons for these defaults. He told me that Show Backfaces turned on by default was to keep compatibility with Blender Internal, but that's not a deal breaker Since we got rid of Blender Internal ages ago and it is time for 3.0, it should be fine to adjust defaults
Member

Added subscriber: @zanqdo

Added subscriber: @zanqdo
Member
  • 1

Alpha hashed, even if reliable, is incredibly noisy. I'd suggest copying what the GLTF IO does.

GLTF will leave it as Alpha Opaque if unused or Alpha Blend if used.

What could work is an importer option to set the type of Alpha

- 1 Alpha hashed, even if reliable, is incredibly noisy. I'd suggest copying what the GLTF IO does. GLTF will leave it as Alpha Opaque if unused or Alpha Blend if used. What could work is an importer option to set the type of Alpha
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

For reference, that drawing behavior is also reported in #86661 (Material setting "show_transparent_back" (Show Backface) gives weird results)

For reference, that drawing behavior is also reported in #86661 (Material setting "show_transparent_back" (Show Backface) gives weird results)
Member

Added subscriber: @mrlooi

Added subscriber: @mrlooi
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

Dont think this can be called a bug.

Note there has been some discussion in blender/blender-addons#83749 / ae82410329.
Note also that expectations regarding used / unused Alpha might differ (some might expect this to be hooked up by default, some may not).
Same for Show Backfaces (some might want this ON, some might want this OFF).
Personally, I wouldnt mind having options for these, but still, we'd need to define what the defaults should be.

This probably just needs a design decission.

Dont think this can be called a bug. Note there has been some discussion in blender/blender-addons#83749 / ae82410329. Note also that expectations regarding used / unused Alpha might differ (some might expect this to be hooked up by default, some may not). Same for `Show Backfaces` (some might want this ON, some might want this OFF). Personally, I wouldnt mind having options for these, but still, we'd need to define what the defaults should be. This probably just needs a design decission.
Member

Added subscribers: @vuttywrld, @Alaska, @Jeroen-Bakker, @fclem

Added subscribers: @vuttywrld, @Alaska, @Jeroen-Bakker, @fclem
Author
Member

Any traction regarding this behavior? It's the same for OBJ as we now know.
As Jeroen mentioned in a linked closed task, "Show Backfaces" being ON by default means that Eevee and Cycles also look more different by default, which should be something to avoid.
I think we really need a new import setting for handling alpha in textures.

To add insult to injury, you can't use ALT+Click or "Copy To Selected" to turn "Show Backfaces" off or change Blend mode for all selected objects.
This means that unless user is willing to dabble into scripting, this behavior makes unnecessary assumptions that result in tedious monkey-work of fixing the imported models one-by one.

Any traction regarding this behavior? It's the same for OBJ as we now know. As Jeroen mentioned in a linked closed task, "Show Backfaces" being ON by default means that Eevee and Cycles also look more different by default, which should be something to avoid. I think we really need a new import setting for handling alpha in textures. To add insult to injury, you can't use ALT+Click or "Copy To Selected" to turn "Show Backfaces" off or change Blend mode for all selected objects. This means that unless user is willing to dabble into scripting, this behavior makes unnecessary assumptions that result in tedious monkey-work of fixing the imported models one-by one.
Member

Added subscriber: @HRbna

Added subscriber: @HRbna
Philipp Oeser changed title from FBX Import - Show Backfaces makes object look wrong and is on by default. to FBX/OBJ Import - Show Backfaces makes object look wrong and is ON by default. 2022-04-26 14:12:12 +02:00
Member

Added subscribers: @wingdi, @PratikPB2123, @aras_p

Added subscribers: @wingdi, @PratikPB2123, @aras_p
Author
Member

This is still a problem. After importing anything that uses textures, I need to launch a script that would unset Blend Mode of all objects back to Opaque, because most of them don't need alpha.
I would really prefer to not have addons make guesses about textures alphas, or at least have a dropdown for disabling this behaviour

This is still a problem. After importing anything that uses textures, I need to launch a script that would unset Blend Mode of all objects back to Opaque, because most of them don't need alpha. I would really prefer to not have addons make guesses about textures alphas, or at least have a dropdown for disabling this behaviour

Added subscriber: @Clemens

Added subscriber: @Clemens

Until this issue gets fixed here is a python one-liner to turn off the show_transparent_back for all materials.

for material in bpy.data.materials: material.show_transparent_back=False 

just open a python console inside blender and hit enter twice

Bildschirmaufnahme 2022-06-14 um 11.41.26.mov

Until this issue gets fixed here is a python one-liner to turn off the `show_transparent_back` for all materials. ``` for material in bpy.data.materials: material.show_transparent_back=False ``` just open a python console inside blender and hit enter twice [Bildschirmaufnahme 2022-06-14 um 11.41.26.mov](https://archive.blender.org/developer/F13161570/Bildschirmaufnahme_2022-06-14_um_11.41.26.mov)

Added subscriber: @ChrisMac

Added subscriber: @ChrisMac

I hit this issue while importing some old meshes archived in trueSpace COB files. Managed to get a correct export to import in OBJ but the materials were inside out.
Each of these meshes had around 500-1000 materials, I sure wasn't going toggle this setting one at a time.

The python one liner is much appreciated but this really needs to be fixed or addressed in some way. Most users who hit this issue probably won't find this easy to deal with.

I hit this issue while importing some old meshes archived in trueSpace COB files. Managed to get a correct export to import in OBJ but the materials were inside out. Each of these meshes had around 500-1000 materials, I sure wasn't going toggle this setting one at a time. The python one liner is much appreciated but this really needs to be fixed or addressed in some way. Most users who hit this issue probably won't find this easy to deal with.
Philipp Oeser removed the
Interest
EEVEE & Viewport
label 2023-02-09 15:13:25 +01:00

Hmm, looks like I also lost time investigating and filing the duplicate issue listed above today.

I guess there's two issues here?

  1. Scene importers don't know if they should hook something up to the material Alpha or not. So to be "safe" they hook it up which ends up triggering 2...
  2. They use Alpha 'blend' but with show backfaces enabled

Item 1 may be unavoidable if the scene description doesn't convey the actual material parameters correctly. Unsure if FBX and co. support something as fine-grained like that.

As for 2, this yields incorrect results and goes against what's documented in the manual: https://docs.blender.org/manual/en/dev/render/eevee/materials/settings.html#blend-mode

Show Backface
If enabled, all transparent fragments will be rendered. If disabled, only the front-most surface fragments will be rendered. Disable this option to ensure correct appearance of transparency from any point of view.

When using Alpha Blending this option should be disabled because with Alpha Blending, the order in which triangles are sorted is important.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

So we're kind of stuck. As long as it uses the 'BLEND' method, the results will likely be incorrect.

The fix in question is a 1-liner in the Blender-provided node_shader_utils.py script:

diff --git a/scripts/modules/bpy_extras/node_shader_utils.py b/scripts/modules/bpy_extras/node_shader_utils.py
index 0c349084220..c5b1b1d4499 100644
--- a/scripts/modules/bpy_extras/node_shader_utils.py
+++ b/scripts/modules/bpy_extras/node_shader_utils.py
@@ -671,6 +671,7 @@ class ShaderImageTextureWrapper():
             tree.links.new(node_image.outputs["Alpha" if self.use_alpha else "Color"], self.socket_dst)
             if self.use_alpha:
                 self.owner_shader.material.blend_method = 'BLEND'
+                self.owner_shader.material.show_transparent_back = False

             self._node_image = node_image
         return self._node_image
Before After proposed change
Zero-Day_before.png Zero-Day_after.png
Hmm, looks like I also lost time investigating and filing the duplicate issue listed above today. I guess there's two issues here? 1. Scene importers don't know if they should hook something up to the material Alpha or not. So to be "safe" they hook it up which ends up triggering 2... 2. They use Alpha 'blend' but with show backfaces enabled Item 1 may be unavoidable if the scene description doesn't convey the actual material parameters correctly. Unsure if FBX and co. support something as fine-grained like that. As for 2, this yields incorrect results and goes against what's documented in the manual: https://docs.blender.org/manual/en/dev/render/eevee/materials/settings.html#blend-mode ``` Show Backface If enabled, all transparent fragments will be rendered. If disabled, only the front-most surface fragments will be rendered. Disable this option to ensure correct appearance of transparency from any point of view. When using Alpha Blending this option should be disabled because with Alpha Blending, the order in which triangles are sorted is important. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` So we're kind of stuck. As long as it uses the 'BLEND' method, the results will likely be incorrect. The fix in question is a 1-liner in the Blender-provided `node_shader_utils.py` script: ```diff diff --git a/scripts/modules/bpy_extras/node_shader_utils.py b/scripts/modules/bpy_extras/node_shader_utils.py index 0c349084220..c5b1b1d4499 100644 --- a/scripts/modules/bpy_extras/node_shader_utils.py +++ b/scripts/modules/bpy_extras/node_shader_utils.py @@ -671,6 +671,7 @@ class ShaderImageTextureWrapper(): tree.links.new(node_image.outputs["Alpha" if self.use_alpha else "Color"], self.socket_dst) if self.use_alpha: self.owner_shader.material.blend_method = 'BLEND' + self.owner_shader.material.show_transparent_back = False self._node_image = node_image return self._node_image ``` | Before | After proposed change | | -- | -- | | ![Zero-Day_before.png](/attachments/b5cedab1-5e6c-4113-8142-4696b055fefd) | ![Zero-Day_after.png](/attachments/20a5da4a-f036-4efe-b5c6-fed316fdce18) |
Member

can you create a pull request. solution seems fine.

can you create a pull request. solution seems fine.

I made PR #105585 which addresses the mentioned python script as well as the new OBJ importer. USD has the same "bug" but is being worked on as part of a different PR still under discussion.

I don't have many "real" assets here myself to try so I left the PR as a WIP. I'd appreciate any and all testing folks can do with their own files to see if this is good and safe.

I made PR #105585 which addresses the mentioned python script as well as the new OBJ importer. USD has the same "bug" but is being worked on as part of a different PR still under discussion. I don't have many "real" assets here myself to try so I left the PR as a WIP. I'd appreciate any and all testing folks can do with their own files to see if this is good and safe.
Contributor

That solves the most important case, which is when the alpha texture is all 1 so the material is morally opaque, which happens a lot with OBJ/FBX.

The downside is there are times when multiple layers are supposed to be visible. For example:

Three layers of cutoff images, each one partially covering the ones behind it.

The other alternative, Alpha Hashed, always gives (an approximation to) the correct result. The downside is it's noisy.

That solves the most important case, which is when the alpha texture is all 1 so the material is morally opaque, which happens a lot with OBJ/FBX. The downside is there are times when multiple layers are supposed to be visible. For example: ![Three layers of cutoff images, each one partially covering the ones behind it.](/attachments/85fa7464-1c87-4a80-a007-5bee53deb190) The other alternative, Alpha Hashed, always gives (an approximation to) the correct result. The downside is it's noisy.
Blender Bot added
Status
Resolved
and removed
Status
Needs Info from Developers
labels 2023-03-16 00:10:41 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
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
11 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#89630
No description provided.