mupen64plus / mupen64plus-video-glide64mk2

Video plugin for Mupen64Plus 2.0 based on 10th anniversary release code from gonetz
28 stars 37 forks source link

GLES graphical glitches in OoT and SM64 #21

Open krnlyng opened 9 years ago

krnlyng commented 9 years ago

these issues might be in other games too, but i have only tested OoT and SM64 so far.

i am wondering if these are adreno only glitches?

floor textures flicker: in both OoT and SM64 textures which are directly above the ground flicker (it looks like parts of them go under the ground) this happens in OoT for example on the path from mido to the deku tree and in SM64 with shadows for example of trees or of mario himself.

shadows(?): in SM64 on the start screen (most obvious there) where you see marios head, his left eye appears normal colored and his right one appears too dark, also on double doors the left one appears normal and the right one appears too dark, happens on other characters faces too (left ok, but right too much shadow). In OoT links face seems to have too much/dark shadow.

moving ground: in SM64 right after loading a game and starting on the castles courtyard the ground appears to be moving (shaking as if there were an earthquake ;)), this happens in other places too. I don't remember if this happens in OoT too, but i think i saw it it once (can't reproduce it currently).

textboxes in SM64: In SM64 textboxes are broken (OoT textboxes work fine) only the last line of text is visible (the one where the arrow down is), if there is no last line nothing is visible. But one exception, wondrously dots are displayed correctly.

i would test if the glitches happen on desktop with GLES too but for some reason the GLES build on my desktop only displays a black screen (yes i have USE_GLES set for both core and video-glide64mk2)

none of these glitches appear in the OpenGL codepath on my desktop

littleguy77 commented 9 years ago

Much of this sounds like the same polygon offset issue we have in the Android edition. It is a standard way to fix "stitching" and other artifacts when you render two coplanar surfaces with different textures/colors (e.g. shadow under mario, decals on walls). It seems that unlike the desktop platforms, the mobile hardware developers are inconsistent with their implementation of this. We had to add a hack to all the video plugins to permit us to change the polygon offsets depending on hardware. It's the only thing that differs between mupen64plus-ae's Rice video and the upstream version. https://github.com/mupen64plus-ae/mupen64plus-video-rice/commit/c7e10c487470bee0de32588366e4a375477529e4

It's a really inelegant and unmaintainable solution, but we haven't come up with anything better to date. Here is where we do it in glide: https://github.com/mupen64plus-ae/mupen64plus-ae/blob/45b0399132cb1c02a08b154d4a00fd767ca489ee/jni/mupen64plus-video-glide64mk2/src/Glitch64/geometry.cpp#L340

krnlyng commented 9 years ago

i actually stumbled over that code just now :) anyways thanks for the hints :), i haven't tested it on my device yet but will certainly do so, i hope some developer here has an idea what we could do about it in GLES codepaths of the upstream graphic plugins

krnlyng commented 9 years ago

i have adapted some code from mupen64plus-ae, see: https://github.com/mupen64plus/mupen64plus-video-glide64mk2/pull/23 it fixes the flickering floor textures but the other issues remain

inactive123 commented 9 years ago

@krnlyng Regarding the ground wobbling/texture perspective correction issues - I found a fix for that quite some time ago for my libretro fork but it involves setting depth bias manually in your config file for specific games to get the right Z bias per game.

https://github.com/libretro/mupen64plus-libretro/commit/66574450b0bdcd1870ffa4f4cc93bda7a1440298

This will require that we add back the depth bias settings to the Glide64mk2.ini config file. Previously this file had different depth bias settings in it per game but it got taken out at some point - maybe I guess because all these issues were fixed for the OpenGL codepath but it's only just now becoming an issue again with GLES.

Here is a C version of Glide64mk2.ini as code - based on this you could readd similar 'depth bias' values in the config file per game.

https://github.com/libretro/mupen64plus-libretro/blob/master/mupen64plus-video-glide64mk2/src/Glide64/Glide64_Ini.cpp

krnlyng commented 9 years ago

@twinaphex first of all, thanks :), second, do you know how i can implement this change in upstream glide64mk2? the change i've imported from mupen64plus-ae modifies the same call to glPolygonOffset (which fixes flickering floor textures), see: https://github.com/krnlyng/mupen64plus-video-glide64mk2/commit/59ced977329a7780de76ab4498afd6407fb549dc probably i need to read up on this matter

AlessandroPorcelli91 commented 8 years ago

This very much looks like what I am experiencing on different laptops so far. Did anybody figure out how to properly configure the plugin to avoid the earthquakes eventually?