rpcs3 icon indicating copy to clipboard operation
rpcs3 copied to clipboard

[Regression] killzone 3: broken water effect after #15683

Open digant73 opened this issue 1 year ago • 19 comments

Quick summary

Water effects on killzone 3 have been broken by #15683. On previous RPCS3 releases it was ok (on par with PS3). Attached pictures of PS3's effect, RPCS3's correct effect and RPCS3's broken effect

NOTE: #15683 also affects bug report #15928, although previous water effects were not on par with the effects on a real PS3.

Details

No response

Build with regression

rpcs3-v0.0.32-16592-2647a097_win64

Attach two log files

RPCS3.log.gz

PS3's effect killzone3_ps3

RPCS3's correct effect killzone3_rpcs3_ok

RPCS3's broken effect killzone3_rpcs3_bug

Attach capture files for visual issues

Below the links for two RSX captures. One is without any patch while the second is with only MLAA patch applied (MLAA disabled on SPU)). In both cases, the issue is present.

https://mega.nz/file/Pu5kFbIY#hP3mbBwAEZ0bzAGW1x5wfh43f7B2zlf-J027MwjCg2A (no patch applied) https://mega.nz/file/73ZE1ZZR#WNyjnqOsejNugSg_9fq1tvEb7_fPzVHFoSQ5yxKT7WE (MLAA patch applied)

No response

System configuration

No response

Other details

No response

digant73 avatar Aug 15 '24 16:08 digant73

Missing logs and rsx captures

FlexBy420 avatar Aug 15 '24 16:08 FlexBy420

Missing logs and rsx captures

just attached the log file for RPCS3 with the issue. Shall I attach also the log file for the RPCS3 with no issue? How can I create the rsx captures?

digant73 avatar Aug 15 '24 17:08 digant73

The log is for resistance 3, not killzone 3 Utilities>create rsx capture

FlexBy420 avatar Aug 15 '24 17:08 FlexBy420

The log is for resistance 3, not killzone 3 Utilities>create rsx capture

Yes, I uploaded the wrong log file. Log file for killzone 3 is now attached. For the capture, when I start the capture the game is frozen for some seconds before it is asked to press and hold on start button to resume, but the file size is already over 50MB so over the limit of 25MB for the upload

digant73 avatar Aug 15 '24 17:08 digant73

This is actually progress. We now have a control data point.

kd-11 avatar Aug 15 '24 18:08 kd-11

This is actually progress. We now have a control data point.

Thanks. I can do some testing if needed. The regression is also impacting #15928, the water effects are even in that case worse, although even on old RPCS3 releases the water effects didn't match the effects on PS3 (on PS3 there are more transparencies and depth). But, as reported by other more experienced users, it seems that water effect is a common issue on many games from Insomniac

digant73 avatar Aug 15 '24 18:08 digant73

I need a capture for this one. This engine seems to be setting up multiple conflicting flags, I need to figure out which flags should overwrite the others and in which order.

kd-11 avatar Aug 20 '24 22:08 kd-11

I need a capture for this one. This engine seems to be setting up multiple conflicting flags, I need to figure out which flags should overwrite the others and in which order.

do you mean from Utilities->Create RSX Capture, right? I have a capture but it is about 85MB and I cannot upload here (25MB as limit). I will upload the file on another server and provide the link tomorrow

digant73 avatar Aug 20 '24 23:08 digant73

That's fine.

kd-11 avatar Aug 20 '24 23:08 kd-11

Ok, below the links for two RSX captures. One is without any patch while the second is with only MLAA patch applied (MLAA disabled on SPU)). In both cases, the issue is present.

https://mega.nz/file/Pu5kFbIY#hP3mbBwAEZ0bzAGW1x5wfh43f7B2zlf-J027MwjCg2A (no patch applied) https://mega.nz/file/73ZE1ZZR#WNyjnqOsejNugSg_9fq1tvEb7_fPzVHFoSQ5yxKT7WE (MLAA patch applied)

If it can help the troubleshooting, a ghost of the rocks is also present on the water (see the picture below).

Also, on the PS3 waves effects are created on the water by each soldier moving on the water while this effect is absent on RPCS3. However, this missing effect is not a regression of #15683, it is missing also on old RPCS3 versions (I thought that it was due to a feature not yet implemented on RPCS3).

Ghost of rocks on the water:

killzone3_rpcs3_bug_and_ghost_on rocks

digant73 avatar Aug 21 '24 10:08 digant73

@kd-11 I just did some testing changing the precedence for SNORM, GAMMA and UNSIGNED_REMAP in RSXThread.cpp.

For Killzone 3, the issue is not present when SNORM is applied after UNSIGNED_REMAP (while it is always present if applied before). That means one of the following 3 setups is ok. These setups seem to have no side effects on other games (e.g. Resistance 3 continues to have the same broken water effects). For Resistance 3, I verified that the SNORM filter is applied for water effect. Ironically if I change the algorithm for SNORM (in RSXFragmentTextureOps.glsl) returning a vec4(0.f) the water effect is basically correct (matching the PS3) in 2 of 3 different places. I will provide more details in the related bug #15928,

In the following setups, I enabled the precedence GAMMA->UNSIGNED_REMAP->SNORM, but, I said above, also the other two versions are OK (so UNSIGNED_REMAP->SNORM->GAMMA and UNSIGNED_REMAP->GAMMA->SNORM)

// killzone 3 - OK
const u32 gamma = tex.gamma();
const u32 unsigned_remap = (tex.unsigned_remap() == CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL) ? 0u : (~(gamma) & 0xF);
const u32 argb8_signed = tex.argb_signed() & ~(gamma | unsigned_remap);
u32 argb8_convert = gamma;

/*					
// killzone 3 - OK
const u32 unsigned_remap = (tex.unsigned_remap() == CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL) ? 0u : 0xF;
const u32 argb8_signed = tex.argb_signed() & ~unsigned_remap;
const u32 gamma = tex.gamma() & ~(argb8_signed | unsigned_remap);
u32 argb8_convert = gamma;
*/

/*
// killzone 3 - OK
const u32 unsigned_remap = (tex.unsigned_remap() == CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL) ? 0u : 0xF;
const u32 gamma = tex.gamma() & ~unsigned_remap;
const u32 argb8_signed = tex.argb_signed() & ~(gamma | unsigned_remap);
u32 argb8_convert = gamma;
*/

Does it make sense to have SNORM applied after UNSIGNED_REMAP or the order you used is dictated by well known PS3's specs?

digant73 avatar Sep 24 '24 09:09 digant73

It's restricted by real hw behavior.

kd-11 avatar Sep 24 '24 09:09 kd-11

There are actually 4 toggles. The other is BX2 decompression in shaders. I remember trying out all the permutations at some point. I haven't had much time to test these out lately and writing updated hardware tests takes time.

kd-11 avatar Sep 24 '24 09:09 kd-11

It's restricted by real hw behavior.

ok, so it seems the SNORM filter is currently the problem. If it can be useful, If I maintain the precedence SNORM->GAMMA->UNSIGNED_REMAP the only way to fix the issue in Killzone 3 is to change the SNORM algorithm returning something close to zeros (e.g. vec4(0.f)). The same will fix water effects in Resistance 3 in 2 of 3 places.

digant73 avatar Sep 24 '24 09:09 digant73

There are actually 4 toggles. The other is BX2 decompression in shaders. I remember trying out all the permutations at some point. I haven't had much time to test these out lately and writing updated hardware tests takes time.

oh, reading the comments in the code I understood BX2 was UNSIGNED_REMAP. So maybe a missing filter is the reason for the issue?

digant73 avatar Sep 24 '24 10:09 digant73

No they're all different and are implemented. It is likely that one of them is disabled on presence of another. The only way to validate what happens when multiple flags are set is to write hardware tests (custom ps3 binaries) and check the ouput on real hw.

kd-11 avatar Sep 24 '24 10:09 kd-11

No they're all different and are implemented. It is likely that one of them is disabled on presence of another. The only way to validate what happens when multiple flags are set is to write hardware tests (custom ps3 binaries) and check the ouput on real hw.

Understood. I hope you will fix also this remaining bug soon. Thanks for the effort you put on the project

digant73 avatar Sep 24 '24 10:09 digant73

@kd-11 it seems that PR #13901 is responsible for the issue in killzone 3. If I disable custom color border simply commenting out the line 35 in vkutils/sampler.cpp:

//if (!g_render_device->get_custom_border_color_support())

the issue is no more present.

#13891 was also reported as a regression in #15422 (broken water effect in uncharted 1). I also verified that and also that disabling custom color border (line 35 commented) this issue was also no more present

digant73 avatar Sep 24 '24 21:09 digant73

@kd-11 attached the RSX capture and a recording on OpenGL. As you can see in the recording, after some time of no interaction with the water the issue is gone. When I shoot on the water the issue appears again and so on. Same behavior also with Vulkan

Attachments on OpenGL:

RSX capture: https://mega.nz/file/yjJCwDiI#pAxFqzUcTgf6L6k-FuqHiwQaJkHYjvpsShMblA05vbY

Recording: https://mega.nz/file/b6YjUbIL#_hphEKNeAoIpLZPXOXKyzOXngizHlEZlE7cBoWH-VEU

digant73 avatar Sep 26 '24 19:09 digant73

This is still an issue.

RPCS3.log.gz

https://www.mediafire.com/file/w28rsuvssfcyg5j/BCUS98234_20251118092148_capture.rrc.gz/file

alexconsole04 avatar Nov 18 '25 15:11 alexconsole04