virtual-puppet-project / vpuppr

VTuber application made with Godot 4
Mozilla Public License 2.0
735 stars 61 forks source link

Flickering/Z-Fighting #95

Open fmorgner opened 2 years ago

fmorgner commented 2 years ago

Description

Platform: Linux (Arch) Version: 0.8.0 Python (tracking): 3.9

When using different models, I often encounter flickering in many areas of the models. This is independent of whether or not the tracking is running, and also changes in intensity depending on the angle the model is in. This makes me believe, that it is z-fighting going on there.

Examples

Tracking completely disabled (not listening for data)

https://user-images.githubusercontent.com/196091/151824062-166aa057-f272-4f66-b303-59158384b52f.mp4

Tracking enabled (tracker not running)

https://user-images.githubusercontent.com/196091/151824098-4a830ce8-c9d3-4992-ac64-f1e497e08a99.mp4

Tracking enabled (tracker running

https://user-images.githubusercontent.com/196091/151824084-be2bc73d-fdf5-4cc0-acbb-70490e5b8aac.mp4

you-win commented 2 years ago

Thanks for the report! Is an example model available so I can reproduce this? This is likely a bug in the VRM shader ported to Godot from Unity.

I've tested with the following models and haven't observed any z-fighting:

  1. The reference Alicia model
  2. Various VRoid Studio models
  3. A custom modeled vrm model (sent to me)

Mostly tested on Windows 10 (bundled facetracker exe) and Fedora 32 (via python 3.8)

fmorgner commented 2 years ago

I could share the model with you (it's a free model from booth). Do you have a way I could send it to you?

you-win commented 2 years ago

If it's a free model from booth, you can just paste the link here and I'll download it.

Otherwise if the compressed size is less than 8mb, you can also send me the file directly over Discord and that file will be tested via vm.

fmorgner commented 2 years ago

I just checked with the Alicia model and i get the same effect. This is the link to the booth model: https://booth.pm/en/items/3003329

you-win commented 2 years ago

Thanks for the link, will give it a test later after work.

A few other questions:

fmorgner commented 2 years ago
fmorgner commented 2 years ago

I can now confirm, that the same effect happens for me on X11 as well (also using the Alicia model).

you-win commented 2 years ago

I'm unable to reproduce with the model you linked:

https://user-images.githubusercontent.com/7788341/152010130-6d8ceb9d-ef95-47ad-bf86-2ddd19480717.mp4

Tested using the Windows build of openseeface-gd 0.8.0, so we can rule out the model causing issues.

Further questions

Does the default Duck model display correctly for you?

I want to see if any 3D models will render correctly on your machine.

If you're willing to do some debugging, can you open the upstream godot-vrm project and see if those render correctly for you?

The upstream project is meant for in-editor use, so theoretically there should be more safety checks or at least better error logging.

Can you post the most recent located at ~/.local/share/godot/ + app name + logs ?

I'm wondering if something important is breaking although, unfortunately, the current state of logging isn't great for catching errors.

ItsRogueRen commented 2 years ago

I can test this on my Linux system tonight (Pop!_OS 20.10 Nvidia Xorg11) and see if it happens to me as well. My personal model works fine though so I'm inclined to believe its something with this specific system (maybe bad GPU drivers?)

fmorgner commented 2 years ago

Thanks for your investigations! I checked with standard duck, and it renders perfectly fine. However, the godot-vrm example project also exhibits the same flickering. I am starting to believe, that there might be an issue in Godot.

Logfile:

godot.log

you-win commented 2 years ago

The log file looks fine to me, thanks for sending it!

I've talked to the godot-vrm maintainers, and they're of the opinion it's driver bug as they can't reproduce it either.

You could try downgrading your drivers and see if that helps, although this probably isn't a great solution. I'm not sure what else to suggest since I can't reproduce the issue. Sorry for not being of more help.

crabdancing commented 2 years ago

Something like this shows up on my system too. Linux MGF1 5.15.28-1-lts #1 SMP Fri, 11 Mar 2022 14:38:35 +0000 x86_64 GNU/Linux, using NVIDIA 1660Ti.

https://user-images.githubusercontent.com/28266167/159101222-bb451c7d-b5c0-48c6-b7db-9e5c9bace161.mp4

you-win commented 2 years ago

A few questions:

  1. Which distro are you using?
  2. Which nvidia drivers are you using (Nouveau or proprietary)?
  3. How was your model created? Vroid studio only? Vroid studio + UniVRM? Blender + UniVRM?
  4. Can you paste the log located at $HOME/.local/share/OpenSeeFaceGD/logs/godot.log
crabdancing commented 2 years ago

@you-win Oh, me? Arch Linux. Proprietary drivers, 510.54. Shows up on both LTS and non-LTS builds. I believe the model was from only Vroid Studio. I also don't see a log at that path. For reference, I am running openseeface-gd directly from the Godot IDE.

Edit: I found the log you were talking about. It's located at ~/.local/share/godot/app_userdata/OpenSeeFaceGD/logs/godot.log, on my system.

See here.

My money is on some complication with octahedral compression failing. I am pretty comfortable editing GDScript... any workarounds/patches I should try?

you-win commented 2 years ago

@alxpettit Are you able to load in the alicia model located in assets/vrm-models/alicia/AliciaSolid_vrm-0.51.vrm ?

I'm trying to narrow down what might be the problem, but all I can tell right now is that the z-fighting issue only occurs on Arch Linux. I wonder if it's distro-based (since Arch is the only major distro I haven't personally tested).

crabdancing commented 2 years ago

https://user-images.githubusercontent.com/28266167/159140421-d42391d7-c14a-4c7a-806d-5c7b411cc662.mp4

Yep... it happens on Alicia. I'm willing to install a Flatpak version of Godot for a more consistent build to test against, or somesuch, if that's helpful.

you-win commented 2 years ago

Thanks for trying it out and providing a video. I don't think a more official version of Godot will help.

My working theory is that there's a display bug that only exists on Arch for both Nvidia and AMD gpus (as @fmorgner was also running Arch but using an AMD gpu). The hard part about this is that I am unable to reproduce the issue on Windows, Mac, Debian, Ubuntu, PopOS, RHEL, and Fedora.

Further testing steps

  1. Can you force intel integrated graphics to run openseeface-gd ?
  2. Something that will help narrow this down is if your machine running Ubuntu via live cd, can it display the model without flickering. I'm not sure if that's a valid test or not, but it might eliminate hardware being at fault.

What I'll do is install Arch in a vm and see if I can reproduce the issue. If not, I'll need to install Arch on another real machine and see if the issue shows up.

crabdancing commented 2 years ago

I can report that it happens using the Flatpak Godot build, Godot Engine v3.4.3.stable.flathub.242c05d12.

It also happens whether I'm using the NVIDIA renderer or the Mesa one (Mesa Intel(R) UHD Graphics (CML GT2)).

crabdancing commented 2 years ago

Oh, sorry, you posted that while I was testing :P

Sure, I can try to spin up a Ubuntu system to test it. I'm not sure when I'll have time, but I'll get back to you on that one :)

26fiftysix commented 2 years ago

Arch (X11, Radeon RX 6800, Mesa 22.0.1). I am also getting flickering when rendering with the GPU.

Tested with software rendering (llvmpipe), and it doesn't produce any flickering.

LIBGL_ALWAYS_SOFTWARE=1 ./OpenSeeFaceGD.x86_64

godot-llvmpipe.log godot-mesa.log

Edit: Tested with the proprietary driver also. AMDGPU PRO 21.50 OpenGL renders the Alicia model without any flickering.

you-win commented 2 years ago

Thanks for testing with 3 different drivers! Unfortunately, it's really starting to look like a driver bug. I'll still keep this issue open though since more data points can't hurt

orowith2os commented 2 years ago

Could you try and see if this issue is fixed on newer Mesa versions, and with the latest Alpha build? Since it was rewritten since this issue was encountered, it might either introduce some new issues or fix it, who knows?

jneurotica commented 2 years ago

It seems as though I'm having the same issue with my model created in Vroid. Tried both the Flatpak and the zip, Flatpak has MAJOR eye and eyebrow flickering. zip fixed the eye flickering, but still had flickering eyebrows.

OS: Nobara 36 (Fedora-based) Kernel: 5.19.4-201.fsync.fc36.x86_64 Drivers: Mesa 22.3.0-git.20220827.71ace23.fc36 Display Server: X11

jneurotica commented 2 years ago

log from zip: godot_2022-09-02_20.35.59.log

log from flatpak: godot_2022-09-02_20.37.50.log

jneurotica commented 2 years ago

here's a link to my model if you wish to test it out yourself: https://drive.google.com/file/d/1uQcr4EnSI5jQZV1ov-L3wrnfPi8YIcuZ/view?usp=sharing

Supermagnum commented 1 year ago

I have the same issue on Linux mint, but it only appears if my model looks down. It's Linux mint 20.3 with a Nvidia 3070 card. The model has no issues if used with VSeeFace.

ItsRogueRen commented 1 year ago

I have swapped my system from Nvidia GTX 980 Ti to an AMD RX 6650 XT and now also have this flickering/zfighting issue. This may be an AMD/Mesa issue. I have only seen this on Wayland however and have not tested X11

UPDATE: This does happen in X11 as well, so it is not a Wayland exclusive issue.

https://user-images.githubusercontent.com/75085610/201490184-d4006ec7-55bf-47df-9dc7-82b65accf435.mp4

orowith2os commented 1 year ago

Reproducible on my Radeon RX 570 with the Flatpak

note to self, might be with how models are loaded

exodrifter commented 1 year ago

Downloading vpuppr, loading a model, and turning on tracking results in this:

https://user-images.githubusercontent.com/1592386/209867052-b5fbd4da-01b9-4745-a44b-5eeee986091e.mp4

System:

$ pacman -Qs 'mesa'
local/glu 9.0.2-3
    Mesa OpenGL utility library
local/lib32-glu 9.0.2-3
    Mesa OpenGL utility library (32 bits)
local/lib32-mesa 22.3.1-1
    An open-source implementation of the OpenGL specification (32-bit)
local/lib32-vulkan-intel 22.3.1-1
    Intel's Vulkan mesa driver (32-bit)
local/lib32-vulkan-radeon 22.3.1-1
    Radeon's Vulkan mesa driver (32-bit)
local/libva-mesa-driver 22.3.1-1
    VA-API implementation for gallium
local/mesa 22.3.1-1
    An open-source implementation of the OpenGL specification
local/mesa-utils 8.5.0-2
    Essential Mesa utilities
local/mesa-vdpau 22.3.1-1
    Mesa VDPAU drivers
local/opencl-mesa 22.3.1-1
    OpenCL support with clover and rusticl for mesa drivers
local/vulkan-intel 22.3.1-1
    Intel's Vulkan mesa driver
local/vulkan-radeon 22.3.1-1
    Radeon's Vulkan mesa driver

If there's any more information or troubleshooting I can do to help determine the cause, I would be happy to know.

The1AndMany commented 1 year ago

Having this issue as well. Confirmed present on my personal avatar I use for ChilloutVR, as well as the Alicia reference. Forcing software rendering with LIBGL_ALWAYS_SOFTWARE=1 ./vpuppr.x86_64 seems to resolve the issue.

Hope this gets fixed soon. This is my first experience with vTubing and even with this bug present, it's honestly kinda incredible.

salatine commented 8 months ago

since opengl drivers are the issue, using Zink seems to fix the flickering. this can accomplished by running env __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink vpuppr.