Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLB/GLTF Import Rendering Issues on both Mobile/GL Compatible renders. #92292

Open
MangoDragonHub opened this issue May 23, 2024 · 10 comments
Open

Comments

@MangoDragonHub
Copy link

MangoDragonHub commented May 23, 2024

Tested versions

  • Reproducible in Godot 4.2.2 Stable and 4.0.2 Stable

System information

Windows 10 - Godot 4.2.2 Stable - Vulkan(Mobile) and GL Compatible

Issue description

I have uploaded a small issue on Reddit about me uploading my models from Blender to Godot (GLTF).
Link to Thread
I managed to try and dig for what was the issue and it turns out I was only getting this rendering bug in every renderer except the default Forward+ mode. Below I'll attach in-editor shots where some models render properly while others aren't
RenderingBug_ForwardPlus
RenderingBug_VKMobile
RenderingBug_CMB

Steps to reproduce

As of right now, I'm using Blender 3.6 LTS
Export Mesh to GLTF 2.0 into Godot.
Set Renderer type to either Vulkan(Mobile) or GL Compatible.
Check in see in both In Editor and Import Mesh Window if the mesh is properly rendering correctly.

Minimal reproduction project (MRP)

Unfortunately, the compression of my file is too large (106 MB) in size. I tried 7Zip, but Github does not except that file format.

@Chaosus
Copy link
Member

Chaosus commented Jun 15, 2024

Textures of bugged models have size of power of 2 (e.g. 2048x2048)?

@MangoDragonHub
Copy link
Author

Yes, they are the 2048x2048. Power of two.

@clayjohn
Copy link
Member

Could you please upload an MRP to make this easier for contributors to troubleshoot?

An MRP is a project that is as small as can be while still reproducing the bug you are reporting. We include the MRP in the bug reporting template as including one greatly increases the chance that a contributor will be able to reproduce the bug you reported and be able to fix it.

If your asset is too large to upload to Github, you can use another host. Ideally though you would create a project that is as small as possible

@MangoDragonHub
Copy link
Author

I made a small project link using Proton Mail. Please take good care of it.
https://drive.proton.me/urls/KGBEKQDMGG#FQ1SovzlGTuI

@clayjohn clayjohn added this to the 4.x milestone Jun 19, 2024
@clayjohn
Copy link
Member

clayjohn commented Jun 19, 2024

I've confirmed the bug exists in both 4.2.2 and 4.3 beta 1 and is present in the compatibility and mobile backends (Forward+ works fine). Accordingly, this is likely a rendering bug, not an import bug

The problem appears to come from 3 things:

  1. The importer is importing the mesh with back face culling disabled
  2. The importer is importing the mesh with transparency (depth pre-pass mode)
  3. Depth prepass appears to be broken on the compatibility and mobile renderers so we don't get proper per-pixel depth testing

@MangoDragonHub
Copy link
Author

If I can take a wild guess, No. 3 maybe the case. The hair material renders correctly and that has transparency in its material and this mesh's normals are facing the front prior to exporting from Blender.

@clayjohn
Copy link
Member

Hmmm, for me the hair shows the same issue as the rest of the body:

image

@clayjohn
Copy link
Member

Note for whoever decides to work on this, I just confirmed in RenderDoc that depth is not being written by the body in the depth prepass (when it should)

@dhoverml
Copy link

Depth prepass appears to be broken on the compatibility and mobile renderers so we don't get proper per-pixel depth testing

Here is a MRP for testing Depth Pre-Pass on Mobile: alphaprepassmobilebug.zip

This MRP was used in this comment

@xsellier
Copy link
Contributor

xsellier commented Jul 29, 2024

I've confirmed the bug exists in both 4.2.2 and 4.3 beta 1 and is present in the compatibility and mobile backends (Forward+ works fine). Accordingly, this is likely a rendering bug, not an import bug

The problem appears to come from 3 things:

1. The importer is importing the mesh with back face culling disabled

2. The importer is importing the mesh with transparency (depth pre-pass mode)

3. Depth prepass appears to be broken on the compatibility and mobile renderers so we don't get proper per-pixel depth testing

Hey,

Many thanks for your comment because I made a workaround for this specific issue. It's not perfect but it renders OK now. For every single Material the project uses, I attach this script to it:

@tool
extends BaseMaterial3D

func _init():
  var rendering_device = RenderingServer.get_rendering_device()

  if rendering_device == null:
    transparency = Transparency.TRANSPARENCY_ALPHA_DEPTH_PRE_PASS
    cull_mode = CullMode.CULL_DISABLED

Then the mesh renders properly (with some weird stuff, but It's better than it used to)

With the script attached to the materials:
image

Without any script
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Up for grabs
Development

No branches or pull requests

6 participants