PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.61k stars 1.6k forks source link

Meta: GSdx HW mipmap support #1561

Open gregory38 opened 8 years ago

gregory38 commented 8 years ago

Let's collect games that suffer from lack of mipmap. It would allow to avoid multiple bugs reports and easily see which games are impacted (and how many too).

Active issues:

Active issues, but not broken without mipmapping:

Fixed with automatic mipmapping option, but missing CRCs:

Fixed with automatic mipmapping option:

Sarania commented 8 years ago

@gregory38 Here is a vid Nobbs made of R&C 1 that shows more of the total effect:

https://www.youtube.com/watch?v=UNuhWBs8RiA

at around 35 seconds you can see that they do remain if you stop the camera on that angle.

FlatOutPS2 commented 8 years ago

Yes Need some tuning. Does the glitches remain if you stop moving on the bad angle ? I need to capture it in a gs dump to understand what going on.

They did when I tried Legacy Of Kain Soul Reaver 2.

gregory38 commented 8 years ago

Looking at the video, the rendering is quite good. Geezzz people are never happy :p it is likely a rounding issue of the lod factor. I'm pretty sure it can be improved. I'm surprised it isn't better with latest git

jcdenton2k commented 8 years ago

@gregory38 don't feel sad; people are likely playing above native resolution so these kinds of glitches are far more noticeable

If they were playing in Native Resolution on a CRT then they probably wouldn't even notice :)

I'm loving the work being done to improve this. I'll poke around my PS2 disc collection and do some testing as well.

Dokman commented 8 years ago

@gregory38 i am really happy with this changes 😄 i am waiting for more fixes like this

FlatOutPS2 commented 8 years ago

Just tried Tribes: Aerial Assault. The objects look good, but terrain textures change at the wrong distances.

Dokman commented 8 years ago

Set to OpenGL, set mipmapping and frameskp to 5 and then profit for your own Destroy All Humans 2 it has the same problem in the camera, sometimes if you have a bad camera the textures are bad

FlatOutPS2 commented 8 years ago

ICO godrays are visible in HW, but missing at certain angles. Added a GS Dump. Godrays constantly visible in SW, missing a certain angles in HW:

ICO godrays missing at certain angles with HW mipmapping.zip

Dokman commented 8 years ago

missing letters in Destroy All Humans https://mega.nz/#!ch0G2QDK!QWoK5tlD7ERClPKIRLcyWMcQKEnmbIJEuc77vpQ79ns

Second option where are you? XD gsdx_20160925234033

Namcot commented 8 years ago

@gregory38 Will this finally fix the car textures in Ridge Racer 5 in hardware mode?

They work fine in software mode.

Hardware Mode: hardware

Software Mode: software

Nobbs66 commented 8 years ago

IIRC, the cars has issues with the texture cache not mip mapping.

Sarania commented 8 years ago

Just FYI:

Fezzer, Nobbs and I all get random crashes in R&C(them in 2, me in 3) with the latest build and HW mipmapping. We haven't yet isolated if it's related to having HW mipmap enabled(need more tests) or something else. Nothing useful appears in the log and the crashes are random complete exits of the PCSX2 process. Sometimes it happens very quickly, other times it can go an hour without happening. It's super random :/

I'll try to get some additional tests to this end done tomorrow.

FlatOutPS2 commented 8 years ago

IIRC, the cars has issues with the texture cache not mip mapping.

Yes, it's a TC issue. RRV doesn't have any mipmapping issues.

FlatOutPS2 commented 8 years ago

With the latest build Ace Combat 4 still has the same texture issues close to ground I posted a GS Dump for earlier in this issue.

Legacy Of Kain is much improved.

gregory38 commented 8 years ago

Let's look first at the easy case.

Legacy Of Kain is much improved.

You still have some bad texture in some angles ? If you can capture it on a dump it will be nice, it could be a slight rounding issue.

FlatOutPS2 commented 8 years ago

It could also be a seperate not mipmapping related issue. I'll look into it later.

gregory38 commented 8 years ago

Yes it could be a YATCI (yet another cache issue). Hopefully moving around can help to see if it is likely mipmap related or not.

FlatOutPS2 commented 8 years ago

The ICO godrays missing at certain angles GS Dump I posted earlier has gotten worse with the latest mipmapping builds. Now it doesn't shine properly at any angle.

EDIT: It got worse with https://github.com/PCSX2/pcsx2/commit/04d82d81278c564080cc116655e7ad415f90f637

Dreadmoth commented 8 years ago

Found a couple of remaining bad textures / camera positions: Ratchet & Clank Ratchet & Clank 3

Jak 3 has patterns and shimmering noise on some terrain textures at a particular distance from the camera, which only occurs with mipmapping enabled: Jak 3 - mipmapping enabled Jak 3 - mipmapping disabled Jak X has similar shimmering around the vehicle turntable on the main menu: Jak X - mipmapping enabled I guess texture cache issues might be affecting certain mip levels?

gregory38 commented 8 years ago

@FlatOutPS2 I suspect that ICO will require a full mipmap implementation. And even with it, it might not work well with upscaling.

FlatOutPS2 commented 8 years ago

Jak & Daxter: The Precursor Legacy isn't correct yet either: The sea still has squares in it. Jak & Daxter sea mipmapping.zip

FlatOutPS2 commented 8 years ago

I checked up on Soul Reaver 2 and couldn't find the issue with the latest build. I assume it was a fluke. I did see a rare flicker but it too was a one off that couldn't be reproduced.

gregory38 commented 8 years ago

@Dreadmoth I'm looking at your R&C dump. So for the R&C 3, I update a bit the rounding to take care of the issue. I'm still looking at the first one. I try to debug the left "tower" but I think there is a bug in the SW renderer. Here the SW renderer texure 00581_f5001_itex2_03463_p_8 Sw rendering is kind of flat... HW is much nicer. I will look the right tower now.

@FlatOutPS2 Ok. Anyway, it would never be perfect. Due to cache issue and various rounding upscaling. Another tester told me a similar report. Basically he notices a rare flicker of a couple of pixels.

gregory38 commented 8 years ago

@Dreadmoth actually what is the issue of the first dump ? HW renderer: 00401_f5001_rt1_01000_c_32

SW renderer: 00401_f5001_rt1_01000_c_32

Zoom the 2, you can see that HW properly map the texture. You have nice windows, bricks, tiles. Whereas you have a lego look on the SW renderer.

Dreadmoth commented 8 years ago

In the screen I included in the zip with the GS dump (captured at the same time with shift-F8), the dirt path texture near the centre of the screen is offset: R&C texture It only occurs in that camera position (with a small range in any direction). If I disable mipmapping it looks the same. In software it looks correct, as in the images you posted.

gregory38 commented 8 years ago

Ok. My lastest update fix it. I will test it a bit on my side, if it is good, I will push it.

FlatOutPS2 commented 8 years ago

Latest changes seem to have fixed the bad textures at certain angles in Ace Combat as well. Still has the gaps between textures when close to the ground at certain locations/angles.

Sarania commented 8 years ago

❤Gregory is amazing❤

Thanks so much for your hard work!

gregory38 commented 8 years ago

I did a quick look at the J&D sea testcase. As APE2, it is clearly a limitation of my implementation. A texture mipmap is composed of several layers. In some situation, you want to interpolate between layers (it is called tri-linear filtering). It allow to have a smooth shading when you apply a texture on a "long distance" (often ground or sea).

However my implementation only picks a single layer for mipmap which solves 90% of mipmap issues. Unfortunately it doesn't allow proper tri-linear filtering.

gregory38 commented 8 years ago

@FlatOutPS2 I fail to see the gap issue on your ace dump. But by gap, you mean that you kinds of saw 2 layers side by side instead of a smooth pattern. In this case, it is likely the same issue as my previous post. It would require more work.

FlatOutPS2 commented 8 years ago

Oh, I see, it's a mipmap scaling issue. I didn't see it either with native resolution.

BTW: You could've seen what I meant in the image that came with the dump. ;)

gregory38 commented 8 years ago

I will look at it. I didn't test upscaling. I don't know why but there is a hack that split differently the number of draw call when it is upscaled https://github.com/PCSX2/pcsx2/blob/master/plugins/GSdx/GSState.cpp#L2596

FlatOutPS2 commented 8 years ago

I tried the FIFA games with mipmapping and they look great too, but they seem to suffer from the same interpolation issue that Ape Escape 2 and J&D have.

gregory38 commented 8 years ago

Hum, all games that really uses mipmap for filtering instead of a memory optimization (like R&C) will suffer of this issue. Potentially instead to always select the top level, I could do a mean of min_lod/max_lod, it could be less bad (or could be worst).

The real solution will be to really handle mipmap. But this part won't be free. I'm afraid it will generate a lots of texture cache miss.

Dokman commented 8 years ago

@gregory38 and how you can handle the texture cache? it's from the graphics driver or it's from the gpu?

gregory38 commented 8 years ago

I mean GSdx texure cache. In short, it is complicated. I always said that current implementation is limited. Honestly it is far better than expected.

Dokman commented 8 years ago

i am studying ++ but i don't know how it works 3D, i want to learn dx and opengl but if i don't know the basis i cannot help sorry :( i don't have any book for it :(

refractionpcsx2 commented 8 years ago

You should google tutorials, there are many on the web :)

Dokman commented 8 years ago

okay i will see in google i will try to work a little bit with dx and ogl before to start here

Sarania commented 8 years ago

Can definitely confirm that Hardware mode with mipmapping is faster than hardware mode without mipmapping by a good 30%.

FlatOutPS2 commented 8 years ago

Can definitely confirm that Hardware mode with mipmapping is faster than hardware mode without mipmapping by a good 30%.

Was someone doubting that? :p This only goes for R&C obviously, as other games are not/hardly any faster.

Sarania commented 8 years ago

Interesting. How many have you tested that way? Why would R&C in particular get such a phat speed boost?

FlatOutPS2 commented 8 years ago

Because it affects way more textures in that game that flicker/switch around a lot. In other games there are usually just a few wrong textures, and most show one wrong layer instead of flickering between several.

Sarania commented 8 years ago

Ahh, makes sense. Thanks.

So where are we on this? Are there still improvements to be made? Just trying to get things back on topic :P

gregory38 commented 8 years ago

R&C is faster because of Vulkan. Oh wait, no ;)

Actually I think I understand why. When the layer isn't used the texture pointer is random and often 0. However 0 is also the address of a frame buffer. So before you could use the texture, you need to convert it from the frame buffer. It is slow whatever the number after Dx.

gregory38 commented 8 years ago

On the implementation I think we are pretty good (i.e. I can't really do better in a short term).

Sarania commented 8 years ago

@gregory38 Vulkan is so powerful that even without an implementation of it we are seeing speed boosts! XD

I personally think it should be tied to the SW renderer option. My reasoning is that no one will really be using both HW and SW renderers at the same time(they might sometimes switch back and forth but obviously you can't use both simultaneously) and that less GUI clutter and sneaky options to remember is always a good thing.

The trick is where to put it in the UI if we do that. Currently it's divided into HW and SW sections. Having it specifically in either kind of doesn't make sense if it does both. There is also the problem that it's sort of a "hack" as gregory has said. But putting it in HW hacks makes no sense if it's for both modes. Hmm. But having separate options seems unnecessarily over complicated IMO. I still think combining it is best. Just the how of the UI I'm not sure. Maybe at the very bottom outside of either section?

There is still also the question of whether to enable it by default or not. Unless it badly breaks more than one or two games I think we should. Well I mean if it breaks them like crashes then that's different but I mean like graphically.

refractionpcsx2 commented 8 years ago

The trick is where to put it in the UI if we do that.

Default full mipmap implementation enabled, hw hacks - > Fast Mipmap

gregory38 commented 8 years ago

Wait, what do you call full and fast mipmap ?

refractionpcsx2 commented 8 years ago

full = slow implementation with interpolation of layers etc fast = what we got now :P