Emulator Issues #5999

Zelda Games Lens Flare depth emulation Issues on D3D11

Added by JMC4789 almost 9 years ago.

% Done:


Operating system:
Issue type:
Relates to usability:
Relates to performance:
Relates to maintainability:
Regression start:
Fixed in:


The Legends of Zelda: Twilight Princess (GC) - GZ2E01

While in recent revisions, the lens flare works in D3D9 and OpenGL without issues (previously, I remember it sometimes not working after so long) I noticed an issue when testing D3D11 that made me want to check out the game in more depth. Apparently, for some reason you can trigger the lens flare and darkening of the screen by looking at the sun, no matter where it is. Where as in the other back-ends it works fine.

To reproduce the problem, simply start a new game, and when you take control of link, walk through the south exit of the map. The guy will yell at you and force you to come back a bit. Then, C-up and go into first person and turn to your left (so you're facing the left of the map) and look at the big tree. On OpenGL and D3D9, you'll just see a tree. But in D3D11, depending on your angle a varying amount of the lens flare will kick in. This effect can be very distracting at sunrise and sundown when the sun is hidden behind objects.

I used 3.5-392 and 3.5-395(1c64b1993de02405e563c5fa13d5b4cb7818c520) for a majority of my testing, both 32bit and 64bit (for some reason I thought OpenGL was broken in 64bit, but ended up just having a setting wrong.)

As a work around, you can turn off the effect (presumably with more side-effects though...) by turning on skip efb access from CPU temporarily if the effect is causing visibility issues. Through thorough testing, the problem seems to go back all the way past version 3.0.

My CPU is core i5 760 @ 3.8 GHz with a GTX 470. Was confirmed on another computer over IRC, though, and on a Radeon card, so it's not a driver issue.

Now, one last thing, on Software rendering everything works fine except the screen seems to be distorted with black bars. Originally I thought that the effect wasn't rendering in software mode, but it turns out that it just takes a couple frames to draw, which is a long time in software rendering!

Any other relevant information or links to logs:

Darkness Effect in D3D11 -

Confirmed on 2nd Computer by big tree -

Looking in the same spot in OpenGL -

Black Bars in Software Rendering -

I do have fifo logs of each area, but, I find that using them simply doesn't work. Sometimes, even though the effect works in game, it won't show up in the log, or, in DX11's case, it'll work properly if you load from a fifo log. I'm pretty sure using the fifo logs at first confused me and made making this issue a lot harder to pinpoint.


#1 Updated by JMC4789 almost 9 years ago

Apparently the issue is exactly the same in the Wii Version as well. For some reason, I didn't think of testing it until after I made the issue report.

#2 Updated by rachelbryk almost 9 years ago

  • Status changed from New to Accepted
  • Issue type set to Bug
  • Category set to gfx
  • Operating system Windows added

#3 Updated by NeoBrainX over 8 years ago

fifo log plz? :)

#4 Updated by Armada over 8 years ago

My fifo log seems to work. Recorded at 1xIR with EFB to texture and scaled EFB copy.

Skipping EFB access from CPU will hide the flare completely.

#5 Updated by Armada over 8 years ago

It seems the flare bug is also visible in DX9, but it quickly hides itself after a few frames -

Here are two fifo logs one for each renderer of the exact same 5 frames loaded from a save state:

You can see that in the DX9 renderer the flare quickly fades while in the DX11 renderer the flare stays.

#6 Updated by Armada over 8 years ago

It seems that the reason the flare is visible in the DX9 renderer is because I loaded it from a save state made with the DX11 renderer. The fifo logs may still be interesting though.

#7 Updated by Autoran1 over 8 years ago

I think is smth wrong was in DX11 from the start, i tested this issue and it was with DX11 from the very beginning of the plugin, btw the issue with hand figure before flashlight in Silent Hill is also was here forever as well as this one.

#8 Updated by JMC4789 almost 8 years ago

  • Status changed from Accepted to Fixed

This is currently fixed in Master. I do not know exactly when it was fixed. Maybe by a D3D update even?

Either way, I've been testing this for a while and I can no longer cause it to happen. I wish I understood why it stopped happening though.

#9 Updated by JMC4789 almost 8 years ago

  • Status changed from Fixed to Accepted

It has morphed itself into something different. It still happens, but only when it feels like it. First person mode seems to work fine. Maybe it's some kind of projection hack issue?

#10 Updated by JMC4789 almost 8 years ago

Apparently Skip EFB Access to CPU mitigates the problem by disabling the lens flare. I guess this is a clue as to what D3D needs to fix?

#11 Updated by Armada almost 8 years ago

I already mentioned that in the comments above.

#12 Updated by JMC4789 almost 8 years ago

I'm slow :P. Either way, the thing that bothered me is that it was happening sporadically in D3D(11) now rather than 100% of the time. I'm not sure if it was always like that or if this is something new.

#13 Updated by Armada almost 8 years ago

I used to reproduce the bug in first person mode and it only happened when looking directly at the sun. I was able to reproduce it in the starting area 100% of the time.

#14 Updated by Autoran1 over 7 years ago

Tested this issue, the thing was broken long time ago in r6751 of SVN- rd435fd89
just reverted PixelShaderCache.cpp code in DX11, and everything seems to work fine even with recent code
Here's the right position of the sun on recent build
But since revert it not right, i'm expecting correct bugfix

#15 Updated by MayImilae over 7 years ago

Calling neobrain, you should see this.

#16 Updated by magumagu9 over 7 years ago

Duplicate of issue 7033?

#17 Updated by JMC4789 over 7 years ago

No, issue 7033 only happens on certain graphics cards, this issue happens on all graphics cards.

#18 Updated by Autoran1 over 7 years ago

Maybe, will test

#19 Updated by JMC4789 over 7 years ago

Lol, I actually think this is related to the mirrors being misaligned in Luigi's Mansion under D3D more than anything.

#20 Updated by Autoran1 over 7 years ago

issue 7033 has been merged into this issue.

#21 Updated by Autoran1 over 7 years ago

Yup ZWW is absolutely here, and suffers from this too, how can i reproduce Luigi mansion issue
Besides i think there are still few old D3D11 issues on this tracker which could be fixed by this, well except Silent Hill Shattered Memories, i tried this one, unfortunately there is smth else

#22 Updated by Autoran1 over 7 years ago

Tested Luigi's mansion mirror, still broken, nothing to do with this

#23 Updated by JMC4789 over 7 years ago

But... this is still broken too?

And I don't think the Wind Waker one is related to the Twilight Princess one because different hardware is affected. I disagree with merging 7033 into this.

#24 Updated by JMC4789 over 7 years ago

  • Status changed from Accepted to Fixed

Also available in: Atom PDF