gonetz / GLideN64

A new generation, open-source graphics plugin for N64 emulators.
Other
773 stars 180 forks source link

Ocarina of Time: Hyrule Field trail texture disappears behind Link. #541

Open BParks21 opened 9 years ago

BParks21 commented 9 years ago

The trail texture in Hyrule Field starts to disappear behind Link as he moves. This happens with default settings. Worse in full screen mode. Similar in LLE mode but the game has even more problems. Using Project64 2.2 stable and GLideN64 PR 1.1 Here's a video demonstrating the bug. https://www.youtube.com/watch?v=wmPuDcFEGpo

Save state https://drive.google.com/file/d/0By-W8sjqLxiyZUdjRW43Z25fS1E/view?usp=sharing

purplemarshmallow commented 9 years ago

also happens with angrylion's plugin 1

ghost commented 9 years ago

Strange, I have never seen it on TV (real N64), or at least I can't recall. Anyway, I tried to reproduce and I eventually managed it, but the missing part was considerably smaller.

BParks21 commented 9 years ago

@purplemarshmallow I will test this on my wii virtual console copy tonight to see if anything similar happens.

BParks21 commented 9 years ago

Has anyone tested with glide64? I'm surprised it happens with angrylion's plugin.

BParks21 commented 9 years ago

Glide64 is fine.

purplemarshmallow commented 9 years ago

I tested with real hardware to make sure same as with angrylion's plugin So GLideN64 is correct Glide64 uses a hack for the roads

BParks21 commented 9 years ago

@purplemarshmallow It seems more severe with the plugin in fullscreen mode than actual hardware. Real hardware you're not able to turn around and see a huge chunk of road gone like in the video. What i mean is turn Link around along with the camera

purplemarshmallow commented 9 years ago

That's interesting the missing part is bigger at higher resolutions but it must be a bug in game code

SwooshyCueb commented 9 years ago

Yeah I'm fairly certain this is a bug in the game. I remember taking note of this the first time I played the game on real hardware all those years ago, though it does seem to be worse in the video provided here than I remember.

Still, it would be nice to have a fix, either with a gameshark code (if that's even doable) or a game-specific hack in the gfx plugin, or something

BParks21 commented 9 years ago

@gonetz I would really like to hear your input on this when you have the time. Thanks.

gonetz commented 9 years ago

The trail texture is so called "decal" texture. That is polygon with that texture is coplanar with underlying polygon, which represents terrain. Since Z of decal polygon and underlying polygon are very close, poke-through artifacts are possible - Z of decal polygon can became less than Z of base one at some points. N64 uses special depth compare mode to avoid poke-through artifacts. Glide3x API uses depth bias, which is added to Z value of decal polygon. Graphics hardware draws decal texture above the first polygon if difference in Z values is less than depth bias. Glide64 uses special value of depth bias for Zelda OOT to fix problem with the trail texture. That value is ten times larger than for other games. That is the trail texture is far from being coplanar with underlying terrain. OpenGL API also has function for drawing decal textures: glPolygonOffset. GLideN64 uses fixed parameters for that function for all games. Glitch64 the wrapper also uses glPolygonOffset, but it emulates Glide3x depth bias set and thus parameters of glPolygonOffset are game-dependent. Note, that increasing depth bias causes other graphics glitches - it raises decal polygon. For example, shadow texture is not on the ground but above shoes sole.

I hoped that my N64 depth compare emulation option will help to fix trail texture problem, but it does not. I did not run Zelda OOT on real hardware. If the problem really exist on N64 itself, no wonder that N64 depth compare emulation can't fix the problem too.

BParks21 commented 9 years ago

@gonetz Thanks for the thorough response. @purplemarshmallow is right it does happen on original N64. Well it seems GLideN64 is emulating the bug but not emulating it properly lol. It occurs in the same 3 areas on real hardware and on Wii virtual console but behaves much differently. On Wii and N64 it requires me to stand from a distance and face the area swinging my sword toward it. Spinning around and resetting the camera quickly to face it also triggers the bug. Both of these methods work to reveal the bug but unlike the plugin they will correct themselves fairly quick just by standing still. They're never triggered behind Link with the camera facing the same direction as he's moving on either N64 or Wii. Basically the bug is present on real hardware and plugin, they just behave differently. It's a shame because it looks a lot worse and extremely noticeable with the plugin requiring little effort to notice, but i have to work hard to see it on a real system. Is there absolutely no way to at least improve it?

gonetz commented 9 years ago

It is possible to use the same remedy as Glide64-Glitch64 uses. May be someday I'll improve my N64 depth compare shader to usable state and we will have the same behavior as on real system.

BParks21 commented 9 years ago

Glad to hear. I will continue to support this awesome plugin. Hopefulley the proper N64 depth compare can happen in the the near future. Maybe for now you could implement the remedy Glide64 uses specifically for this game as long as it has no ill effects on other titles.

purplemarshmallow commented 9 years ago

I think Glide64's method should not be added. It's known to have side effects like shadow texture will be above shoe sole

gonetz commented 9 years ago

I don't want to add special hacks right now. It is another potential source of bugs. The situation with open issues is hard without it. Let that ticket be a reminder for me.

BParks21 commented 9 years ago

Ok then i agree with a proper fix.