PCSX2 / pcsx2

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

Graphics issue: Jak 3 (USA) - SCUS97330 - Corrupted textures and excessive player shadow #168

Closed Byrkoet closed 2 years ago

Byrkoet commented 10 years ago

1 2 3

-PCSX2 version: 1.2.1.r5873 - compiled on Feb 3 2014

-PCSX2 options: Defaults, no settings modifications affect the issue.

-Plugins used:

-Plugin settings: Tested GSdx DX9/11 hardware; DX11 seems to make things worse by having more of an impact. SkipDraw 1 used to remove player shadow altogether.

-Description: Basically, most textures are corrupted. One great example is the right eye of most characters (also an issue in previous installments of the game).

-How to replicate: Boot the game and enjoy the black-textured landscape and corrupted eyes and miscellaneous objects.

-Last known version to work: Unknown, probably never worked.

-PC specifications: CPU:

-Other comments: The graphical corruption, including the missing eye(s), is also present in previous installments, including, but not limited to Jak and Daxter (SCUS97558 & SCUS97124).

refractionpcsx2 commented 10 years ago

DX11 mode making things worse is due to the newer Nvidia drivers not working correctly with PCSX2, downgrading your driver to the 327 series or lower will fix those issues.

as for the missing eyes, i believe this is a known issue, i believe putting GSDX in software mode fixes it.

ghost commented 10 years ago

This is this unfamous mipmapping bug.

sudonim1 commented 10 years ago

The cause of the shadow volumes being displayed is unknown for this engine, previous attempts to debug it have not been productive. The GS does not support actual stencil buffers so game engines have to simulate their functionality in various ways.

gregory38 commented 9 years ago

Could you test the shadows issue on the openGL renderer?

charliebruce commented 9 years ago

Latest version 1.3.1 20150813215402 from git, using OpenGL, all default settings except 4x scaling, i7-4702HQ @ 2.2GHz / nVidia 765M / 8GB RAM.

how the transporter should look

Seems that the latest version has fixed some, but not all of the texture issues (water in previous screenshot fixed), but the shadow issue remains. Shadows are not fixed in Jak 1 either.

Re texture issues - eyes sometimes work perfectly, sometimes they work but look in the wrong direction (up not down), and sometimes they are either noise or black. No obvious pattern as to when the eyes do/don't work. Other mipmapping issues are still visible. Jak 1 textures all look fine apart from the eyes (as they do in 1.2.1).

gregory38 commented 9 years ago

Increase the level of accuracy blending (likely high). It will normally fix the shadow issue.

charliebruce commented 9 years ago

Just tried all the different blending levels - none of them have any effect on the shadow issue, in Jak 1 or Jak 3.

gregory38 commented 9 years ago

Strange. Can someone make me a gs dump of the shadow issue (disable all speedhack in PCSX2)

Nobbs66 commented 9 years ago

i just posted a dump in the gsdx 1.0 thread on the forums

gregory38 commented 9 years ago

You know I follow the 2 threads ;) It would have been better to post it here. Anyway I will try to give it a quick look in coming days.

charliebruce commented 9 years ago

http://cjb248.com/pcsx2dump/jak-shadow-glitch.zip and http://cjb248.com/pcsx2dump/jak3-shadow-glitch.zip - for Jak 1 and Jak 3.

gregory38 commented 9 years ago

Do you confirm that shadow is broken on SW renderer too?

gregory38 commented 9 years ago

Hum, I think I understand the issue for the shadow. I'm not sure that we can emulate it.

The bad draw call have both input texture and render target at the same address (0x3300). The game renders triangle with basically does Alpha RT = Alpha Fragment * Alpha Texture. However Texture and RT is the same on the GS but not on the plugin.

So they manage to implement a kind of alpha blending of the alpha channel which is normally impossible on the GS.

gregory38 commented 9 years ago

The best will be to allow to read the RT from the shader but it isn't easy.

Just another idea that could work. 1/ detect the effect (RT == Tex and TFX_MODULATE and only_write_alpha) 2/ Create a float texture 3/ Render with blending on with this kind of equation

We need an unclamped texture because as always alpha range from 0 to 2. However it means clamping won't be accurate. But it could be enough. Otherwise we can still do a 2 pass like the older colclip algo.

Nobbs66 commented 9 years ago

Yes, it's broken in the software renderer as well.

Hmm, didn't know this was such a complex issue.

gregory38 commented 9 years ago

On gpu textures are read-only or write-only. Recent GPU (gl4) support RW texture but out-of-order with atomic. Hum I need to check if mult is supported as atomic. Or maybe replace with +/- 1, it must be close of it.

gregory38 commented 9 years ago

Yeah no multiplication in atomic. Anyway it won't work neither the blending method above due to rounding.The game uses 127/128 factor to do a -1 and 130/128 to do a +1. Maybe we can replace the draw call with a pseudo colclip.

gregory38 commented 9 years ago

@charliebruce Did you generate the above dump with VU cycle stealing enabled?

charliebruce commented 9 years ago

No, I don't think so - all speedhacks should have been switched off for both of the dumps I did

On 15 August 2015 at 19:04, Gregory Hainaut notifications@github.com wrote:

@charliebruce https://github.com/charliebruce Did you generate the above dump with VU cycle stealing enabled?

— Reply to this email directly or view it on GitHub https://github.com/PCSX2/pcsx2/issues/168#issuecomment-131412232.

gregory38 commented 8 years ago

I pushed a hack for the shadow. Note, it is likely quite slow => UserHacks_AutoFlush = 1

MrCK1 commented 8 years ago

I can test in an hour or so unless somebody else beats me to it :p

pepiczech77 commented 8 years ago

I tested the hack and the shadows are nearly perfect. But from some camera angles they glitch out a bit. The performance without the hack is about 30fps SW mode, 52fps HW mode.(OGL) With the hack enabled it's about 25fps SW mode, 13fps HW mode.(OGL) Intel Core i7-4700MQ nVidia geforce GT 740M Windows 8.1 gsdx_20160908212148 screen when the shadows are glitched gsdx_20160908213953 2x native, now shadows are glitched all the time (about 2fps)

gregory38 commented 8 years ago

Yes glitch are expected on the shadow. Except a CRC hack to replace the draw call (same issue as tri-ace game), it isn't doable with upscaling. It is already a miracle that shadows are kind of working in native resolution (due to the different rounding between integer (GS) and float (GPU) ). Potentially you could try accurate blending but it will be sluggish...

Anyway, I was expected very poor performance on the HW renderer. Perf on SW isn't too bad.

Edit: beside without mipmapping HW renderer is kinds of moot

pepiczech77 commented 8 years ago

Blending accuracy seems to have no effect. This is already great progress anyway. Thank you for working on this :) Do you need GS dump when it's glitched?

gregory38 commented 8 years ago

Even on ultra (and I mean in native resolution). Ah no it might not work as the game does shits with the alpha channel.

No need for a dump. I know exactly what happen. Actually a crc might not be fast enough. Hum maybe I can test something... When I detect the bad draw call, I will try to sample from the rt instead of texture with a full barriere. I will give it a trial when I got extra motivation :)

pepiczech77 commented 8 years ago

Native resolution and ultra. It still breaks from certain angles. What motivation do you mean? (sorry, didn't get it)

gregory38 commented 8 years ago

Mine ;) Devs are lazy people.

Anyway I implemented it. I don't know for the speed but it would be faster than previous hack. And it will glitch less.

However I need you game name & CRC.

Edit: did a quick speed test and impacts is rather small.

pepiczech77 commented 8 years ago

Oh, now I understand :) Jak 3 (PAL-M7) [SCES-52460] - Platinum GSdx Lookup CRC:12804727

gregory38 commented 8 years ago

Please test latest git (without previous hack). You need to enable accuracy blending to basic at least.

pepiczech77 commented 8 years ago

In Jak 3 I can confirm that shadows are fine on OGL HW, but now it doesn't work in SW.

Jak X (PAL-M7) (Platinum) Shadows seems to benefit from this hack as well [SCES-53286] GSdx Lookup CRC:DF659E77 gsdx_20160909004135 hack off gsdx_20160909004202 hack on

gregory38 commented 8 years ago

The CRC hack only impact the openGL HW renderer. The auto flush hacks impacts both renderer. It is likely a bad idea to enable both. The CRC hack is a faster implementation of the auto flush hack for Jak series. By the way, could you tell me the speed impact of the CRC hack.

pepiczech77 commented 8 years ago

I have about 47-55fps without CRC hack and about 45-52fps with the CRC hack.

gregory38 commented 8 years ago

It is much better than previous hack, I can't do better. Note, perf impact might be bigger if there are lots of shadows (or complex model).

For the record, I'm sorry for AMD users but perf impact will be bigger for them.

PTKay commented 8 years ago

I belive you said you needed the CRC's of all Jak games that suffer from this issue, so here's a bunch of them (all of these were tested using the OGL HW renderer and high blending accuracy):

CRC:9C712FF0 6a8fb88f592088e271d7427296276185

CRC:2479F4A9 eb58f0dbfbd5a850c7b0bc9af6b42f52

CRC:DF659E77 28c613c70d8260bcb566834296846b44

Hope this helps :)

gregory38 commented 8 years ago

I need the game name (for example jak 2). And the region too (for example Eu)

PTKay commented 8 years ago

Ok, I'll say it by the same order:

Jak and Daxter: The Precursor Legacy (Europe) Jak II - Renegade (Europe, Australia) Jak X (Europe, Australia)

refractionpcsx2 commented 8 years ago

jak jak2 jakx

then xD

gregory38 commented 8 years ago

I pushed a new version with various CRC. Tell me if shadows are fine on the openGL renderer + accurate blending on basic.

PTKay commented 8 years ago

Teste the above mentioned games with the specified settings, shadows are working fine now: 90d4f106c50c6a61a84c5e40b58e7d12 d1cd55a62bbf7614316414cd43407a37 6c88dbae931f56dbcb90c4e031a21f42

Also, I can provide you one USA CRC that I have:

Jak 3 (USA) - 644CFD03 d3ee3065e8a2552cf34959e271c05220

Also, the USA version has that weird globe on the upper left corner in all blending accuracies. Non existing in software mode btw.

gregory38 commented 8 years ago
Also, the USA version has that weird globe on the upper left corner in all blending accuracies. Non existing in software mode btw.

You ask too much ;) Either mipmap or something wrong in the texture cache. Not for this month, working shadows are already a huge improvement.

PTKay commented 8 years ago

I'm not asking, just reporting :)

gregory38 commented 8 years ago

Actually I saw it on my gs dump. Potentially I already looked at it. If it isn't fixed it is surely a complex issue.

I added your CRC too.

By the way, who can add a gui option for the auto flush hack

gregory38 commented 7 years ago

SW renderer has wrong skin color on Jak3. If you have the issue could you test the PR #1843

FlatOutPS2 commented 7 years ago

SW renderer has wrong skin color on Jak3. If you have the issue could you test the PR #1843

It's fixed by PR #1843

FlatOutPS2 commented 7 years ago

@gregory38 Jak 3 still has skin issues in Direct3D11 Hardware mode when using upscaling. Direct3D9 and OpenGL are fine, and Direct3D11 is fine on native resolution. The skin issue is basically the same as it was in Software mode, except that the markings are black. Any idea what could be causing it?

gregory38 commented 7 years ago

Hum, hum. It could be this one.

void GSRendererHW::OO_Jak()
{
    // FIXME might need a CU_Jak too

Draw call N:

Following draw calls:

It means that texture sampling must be 100% correct otherwise you won't have the good color. A slight rounding and you will get the neighbor texel which contains a wrong color.

gregory38 commented 7 years ago

I would advice to just dump all the texture/frame buffers.

PabloDL commented 7 years ago

i don't know if some developer already knows this, but i found that if you put the rendering in software mode, and then return to hardware mode the textures on the sand remain correctly loaded, it works every time, i don't know if its worth mentioning

gregory38 commented 7 years ago

Yes because the bug are related to texture cache. Toggling force a reload of all textures from GS memory. If you're​ lucky it might help to fix bug. Or it will create new ones

Traace commented 5 years ago

I tested Jax 3 US with current nightly build (crash tag team crc) and a AMD RX 480 on game's native resolution.

Shadows issue still existing for me on opengl hw render and dx11 hw render. When I use dx11 sw render it looks fine, but the sw render is to slow to play.

When I enable UserHacks_AutoFlush = 1 its getting even worse. More shadow bugs, the map under the ship (intro) is just black.

Also dx11 hw render gives me 60fps ~ while opengl hw render gives 20-30 fps ~ (in every game I tested).