f3d-app / f3d

Fast and minimalist 3D viewer.
https://f3d.app
BSD 3-Clause "New" or "Revised" License
2.88k stars 207 forks source link

gltf format models are not displayed correctly (and not only) #1046

Closed DearFox closed 10 months ago

DearFox commented 1 year ago

Describe the bug img It seems the polygons are not sorted in the correct order, which is why the model looks very strange.

To Reproduce Steps to reproduce the behavior:

  1. Open the file using f3d.exe
  2. Drag and drop the model in gltf format created via BlockBench there

img

  1. done

img

Expected behavior Correct display of polygons in the correct order img img

System Information:

F3D Information F3D 2.2.1

F3D - A fast and minimalist 3D viewer Version: 2.2.1. Build date: 2023-10-04 12:20:14. Build system: Windows 64-bits. Compiler: MSVC 19.35.32217.1. External rendering module: ON. Raytracing module: OFF. VTK version: 9.3.0.rc0-514-g1a5445687f (date: 20230922). Copyright (C) 2019-2021 Kitware SAS. Copyright (C) 2021-2023 Michael Migliore, Mathieu Westphal. License BSD-3-Clause. By Michael Migliore, Mathieu Westphal and Joachim Pouderoux.

Additional context I'm not exactly sure, but it looks like the shaders are wrong or something. I noticed similar behavior when setting up shaders in Blender when I needed an alpha channel on a texture, but I don't understand much about it. Typically gltf models work fine. Here are the models from the screenshots that I tried to open, but all my gltf format models have this strange display (they were all exported from Blockbench) 3D model.zip

DearFox commented 1 year ago

img It seems this happens not only with gltf (

Meakk commented 1 year ago

Can you try to press P in f3d?

DearFox commented 1 year ago

Can you try to press P in f3d?

Seems better but still has some artifacts img And can I enable this by default, and for thumbnails?

mwestphal commented 1 year ago

can I enable this by default, and for thumbnails?

Sure, using the configuration file: https://f3d.app/doc/user/CONFIGURATION_FILE.html

In short, copy the config folders from

C:/Program Files/F3D/share/f3d/configs/

to

%APPDATA%\f3d\

And modify the config.d/10_global.json and thumbnail.d/10_global.json and add the following:

"translucency-support": true, before the first option, like this:

{
  "global":
  {
   "translucency-support": true,
    "axis": true,
    "tone-mapping": true,
    "grid": true,
    "progress": true,
    "anti-aliasing": true,
    "filename": true,
    "scalars": "", 
    "camera-direction": "-1,-0.5,-1",
    "hdri-ambient": true
  }
}

Any remaining issue are probably caused by issues on your data. If you think this is not the case, please let us know!

@Meakk should we turn this on after all ? Not the first user to get surprised by this.

mwestphal commented 1 year ago

input @Meakk ?

Meakk commented 1 year ago

Depth peeling is a bit expensive and will cause a drop of fps. The issue is some gltf file exporter just flag material as BLEND instead of OPAQUE but that's the exporter fault.
However, if the materials are properly flagged as opaque, there won't be any fps drop so I think it's ok to enable depth peeling for gltf files (or even globally)

mwestphal commented 1 year ago

Indeed, I think that displaying, by default, a BLEND material without its opacity is a bug, so we should enable depth peeling globally, as long as it does not implies slow down for user not using transparent material.

Lets keep this issue open to do the change.