hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
10.85k stars 2.13k forks source link

silent hill shattered memories, the torch does not shine the road. #6265

Open daniel229 opened 10 years ago

daniel229 commented 10 years ago

simulate block transfer on/off not help ppsspp 02

psp 201406091259_002

daniel229 commented 10 years ago

info log https://gist.github.com/daniel229/40afc7acf73b8cfa193c

daniel229 commented 10 years ago

looks like is this thing. 03

unknownbrackets commented 10 years ago

Hmm, it has a stencil test that zeros except on depth fail. Is the depthtest enabled? It's also using maskalpha (theoretically we could partially implement this using glStencilMask.)

-[Unknown]

daniel229 commented 10 years ago

Yes,it's enabled

unknownbrackets commented 10 years ago

So basically, where the depth test passes, it's supposed to set the stencil/alpha to (a & 0x7f). Where it fails, it's supposed to set it to 0x80 | (a & 0x7f), which might make it brighter or be used in a future stencil test, I guess?

-[Unknown]

daniel229 commented 10 years ago

silent hill shattered memories reports GLES\StateMapping.cpp:449 Unsupported RGB mask: r=07 g=e3 b=000000ff GLES\StateMapping.cpp:452 Unsupported alpha/stencil mask: fe

silent hill zero reports GLES\StateMapping.cpp:452 Unsupported alpha/stencil mask: 7f

brujo5 commented 10 years ago

same problem in silent hill origins.

torch working fine only in the begining img_0034

in the hospital/roms or any place,torch only iluminate character/some items img_0036

is a bit unplayable in some are to dark.

real psp torch img_0038 img_0037

ASSauLTxMasTER commented 10 years ago

Man, is this error still present?

daniel229 commented 10 years ago

The light need RGB mask implement,JPCSP enable color mak,the light showup.

ASSauLTxMasTER commented 10 years ago

Wait a second, disabling the stencil test produces this: ulus10450_00006

Here's Origins: ulus10285_00001

daniel229 commented 10 years ago

Yes,diasable stencil test helps these games. 02

daniel229 commented 10 years ago

Disable stencil test also helps brightness in Ultimate Ghosts'n Goblins.

not disable stencil test 03

Disable stencil test 04

brujo5 commented 10 years ago

yep dissable stencil fix lintern problem.still a bit slow in some areas.

img_0140

brujo5 commented 10 years ago

full enjoying SH games

image

brujo5 commented 10 years ago

in forum some user report that:http://forums.ppsspp.org/showthread.php?tid=1576&page=4

i was playing the beginning , no problem, flashlight working properly, until i reach the playground (the first ghost scene) and this occur. some kind of alpha problem, enable 'disable stencil test' fix the flashlight, disabling helps with this alpha problem but mess up with the flashlight Sad anyone? (using v0.9.8-1088)

ulus10450_00002

ppmeis commented 10 years ago

Tested with latest build. Stencil hack helps in Silent Hills Origins with lantern light.

ASSauLTxMasTER commented 9 years ago

I am going to assume this was fixed between build v0.9.9-50-g0279aa1 and the latest one, but it seems that we are getting closer to solving this issue. Stencil Test was not disabled.

ulus10450_00000

ulus10450_00002

ulus10450_00001

unknownbrackets commented 5 years ago

Could you try exporting a GE debugger dump on PC?

To do this, open the game and select Debug -> GE debugger..., then when it's displaying the scene, press Record in the top right. After a second or so, it'll finish and save a trace of the drawing activity.

After that, check the memstick/PSP/SYSTEM/DUMP folder and it'll have created a file named something like "ULES12345_0000.ppdmp". You can zip that and then drag and drop it into a reply here.

-[Unknown]

Sonim194 commented 5 years ago

Unknownbrackets

I have tested Silent Hill Origins and Silent Hill Shattered Memories in the last stable built(1.7.4) and they seem a little better than the previous built. However, some bugs still existing and I am prepared to help in any way needed. These are the bugs I have found now:

Silent Hill Shattered Memories has now a black line bug, where it appears when the flashlight is on. Besides it, the game has some frame drops when you open a door/load a new scenario. shm1 When the flashlight is on, no object has a shadow, I have tried to play it with the "Disable Stencil Test" on, but it does not solve the problem and the game gets way more buggier than before. shm2 The bathrooms in Silent Hill Shattered Memories still bugged. shm3 In Silent Hill Origins, after reaching for the first time the second floor, you flashlight turns on, but it is not projected in the scenario. sho1 Silent Hill Origins has the same shadow problem as Silent Hill Shattered Memories has, no object has a shadow at all. sho2

I am really looking forward to helping you finding and fixing both games, if you need anything, let me know.

unknownbrackets commented 5 years ago

Well, as noted in my previous comment - a GE frame dump would help a lot.

See here for instructions - it's not hard and works on Android too: https://github.com/hrydgard/ppsspp/wiki/How-to-create-a-frame-dump

You can zip that and then drag and drop it into a reply here.

-[Unknown]

Sonim194 commented 5 years ago

Here is the dumps I have made: Silent Hill Shattered Memories(Bathroom): SHSM(Bathroom).zip Silent Hill Shattered Memories(Shadow): SHSM(Shadow).zip Silent Hill Shattered Memories(Black Lines): SHSM(Black Lines).zip Silent Hill Origins(Flashlight Bug): SHO(Flashlight Bug).zip Silent Hill Origins(Shadows Bug): SHO(Shadows Bug).zip

Sonim194 commented 5 years ago

Sorry for the delay.

Sonim194 commented 5 years ago

Wow, just remembered, I have played both of them without using the "Disable Stencil Test", it seems this hack does not help anymore. Even SHO gets worse when the hack is activated.

unknownbrackets commented 5 years ago

Sorry - could you create these with the latest git build? There's a bug in the version of PPSSPP you used to create these dumps that has been fixed since then.

-[Unknown]

Sonim194 commented 5 years ago

Of course, just let me download the last one and as soon as possible I will be sending it to you.

Sonim194 commented 5 years ago

Here is the new dumps: Silent Hill Shattered Memories(Bathroom): SHSM(Bathroom Mirror Bug).zip Silent Hill Shattered Memories(Shadow): SHSM(Shadows Bug).zip Silent Hill Shattered Memories(Black Lines): SHSM(Black Lines Bug).zip Silent Hill Origins(Flashlight Bug): SHO(Flashilight Bug).zip Silent Hill Origins(Shadows Bug): SHO(Shadows Bug).zip

unknownbrackets commented 5 years ago

Black lines

Flash light at: 350/449

First it draws the scene to one framebuf, then again to another (seems to be finding areas with non-flashlight light, maybe?), and then renders to self with colortest to set stencil=1 where color=000000. Then it draws the scene again, looks like dark without much light.

Flash light uses a >= depth test:

That seems to generally succeed. Next it draws the flash light again:

That seems to succeed too. Now we draw the actual light (unmasked RGB/stencil), and here's where things get more problematic:

This is where we get the lines (355/449.) I expected it to be the depth test, but even disabling that or using rounding doesn't fix the lines... it's actually caused by the stencil - that initial color tested draw (271/449.)

So that means the initial rendering to it is getting stripes, because the color test is working correctly. Disabling the color test does give a smooth light, so clearly most of it should be black (000000) by this point.

It draws the initial grayscale scene as of 225/449. 226/449 is where it starts blacking it out.... using a texture that looks corrupt (0x0896feb0 in the dump.) It's a 256x256 texture, CLUT8 with a grayscale CLUT. It's using a texture matrix and linear filtering. The texture is a lot of 1f/00 in the start. Forcing the texture to black makes the light smooth.

In softgpu, the same behavior occurs, after a fix to stencil write masking. It's not playing back completely right on a PSP (I'm not sure why - it produces black), but when I take the temporary buffer at 0x04170000, I get the same lines.

I suspect this is caused by depth texturing (e.g. the striped texture might actually be it attempting to download depth to RAM.)

-[Unknown]

ghost commented 4 years ago

Related issue #9001

bslenul commented 4 years ago

Hey, FYI it's still happening (at least in Silent Hill Origins, haven't tried Shattered Memories), different results depending on the video driver selected:

OpenGL, the light appears on the wall (but no shadows), but you can see the ladder appearing on top of the character in transparency or something:

ULUS10285_00002

and it can be much worse depending on what you're looking at, which makes the game basically unplayable with OpenGL:

ULUS10285_00004

D3D11 and Vulkan, no light on the wall:

ULUS10285_00000

D3D9, light on the wall (still no shadows):

ULUS10285_00006

but depending on the room and/or where you're looking at, the light effect is "cut":

ULUS10285_00007

with the light OFF there are weird glitches on the floor and walls:

ULUS10285_00005

Frame dumps (using the online debugger thing):

SHO.zip

edit: Just notice I was using 1.10.1, but I just updated to latest nightly (1.10.2-5) and same results.

nassau-tk commented 3 years ago

PPSSPP v1.10.3-473 Windows10 (64bit)

Strange light appear!! Sentences of the question answered first are surfaced.

silenthill_sm_00png This is first question in the game. *Attention :Red circles

silenthill_sm_01png Torch light up the text.... *Attention : Yellow circle = Text of Red circles

nassau-tk commented 3 years ago

PPSSPP v1.10.3-473 Windows10 (64bit)

Strange light appear!! Sentences of the question answered first are surfaced.

silenthill_sm_00png This is first question in the game. *Attention :Red circles

silenthill_sm_01png Torch light up the text.... *Attention : Yellow circle = Text of Red circles

I tested again. I couldn't reproduce the issue on v1.10.3-473. I don't know why. and, latest build is solved approximately the issue. and, I tested again other builds.(v1.10.3-474 to v1.10.3-581)

[There was the issue until v1.10.3-543.When lighting up , a big shadow appear] silenthill_sm_1 10 3-477_543

[The issue solved approximately from v1.10.3-547. But,There are glitch on the light. ] silenthill_sm_1 10 3-547

[v1.10.3-581.When lighting up a far place, a black line appear.] silenthill_sm_1 10 3-_581_Black Stripe Line On the light_far

[v1.10.3-581.When lighting up a near place, a black line disappear. silenthill_sm_1 10 3-_581_Black Stripe Line On the light_near

I got the some dumps here. SilentHill_SM_543_547_Dump.zip

brujo5 commented 3 years ago

GPU block transfer ON cause this and cant be disabled until restart game or load save state. Captura de pantalla (15) here a dump recording.zip

anyway the game work fine with GPU block transfer OFF but with slower effects ON

Captura de pantalla (16) Captura de pantalla (17)

but sometimes some texture disapear like this in the character

Captura de pantalla (18) here frame dump recording.zip

hrydgard commented 3 years ago

"Works fine" is not entirely accurate, as shadows seem to be missing? Still, yeah, looks playable.

ghost commented 3 years ago

Flashlight work only on OpenGL Screenshot_2021-05-02-22-08-06-825_org ppsspp ppsspp Vulkan is all dark flashlight is lowbatt 🤣✌️ Screenshot_2021-05-02-22-08-32-370_org ppsspp ppsspp

ghost commented 3 years ago

Using ppsspp latest version on playstore flashlight is ok now on OpenGL with some minor gfx glitch? Screenshot_2021-05-19-20-47-44-570_org ppsspp ppsspp But in Vulkan flashlight is not working

off

Screenshot_2021-05-19-20-48-23-089_org ppsspp ppsspp

on

Screenshot_2021-05-19-20-48-33-477_org ppsspp ppsspp

ghost commented 2 years ago

PCSX2 fixed issues that the PS2 version got for now (including shadows too): https://github.com/PCSX2/pcsx2/pull/4887

ghost commented 2 years ago

Using ppsspp latest version on playstore flashlight is ok now on OpenGL with some minor gfx glitch? Screenshot_2021-05-19-20-47-44-570_org ppsspp ppsspp But in Vulkan flashlight is not working

off

Screenshot_2021-05-19-20-48-23-089_org ppsspp ppsspp

on

Screenshot_2021-05-19-20-48-33-477_org ppsspp ppsspp

Flashlight can only work on vulkan if this game is added to ReinterpretFramebuffers compat.

ReinterpretFramebuffers ON Screenshot_2021-10-11-05-20-44-424_org ppsspp ppsspp

ReinterpretFramebuffers OFF Screenshot_2021-10-11-05-21-36-260_org ppsspp ppsspp

Redmi Note 9 Mali-G52 GPU

ghost commented 2 years ago

Another workaround for Opengl flashlight glitch is by adding this game to [ClearToRAM]

[ClearToRAM] ON Screenshot_2021-10-11-05-40-13-868_org ppsspp ppsspp

[ClearToRAM] OFF Screenshot_2021-10-11-05-33-49-390_org ppsspp ppsspp Screenshot_2021-10-11-05-34-50-955_org ppsspp ppsspp

brujo5 commented 2 years ago

Opengl Screenshot_2021-10-10-17-21-24-315_org ppsspp ppsspp Vulkan Screenshot_2021-10-10-17-20-23-177_org ppsspp ppsspp

Sd860 Adreno 640 Default settings at 5x resolution

ghost commented 2 years ago

@hrydgard is worth to add this game to compatibility ini, because it helps mali gpu.

ClearToRAM fix image glitch on opengl if flashlight is enable.

ReinterpretFramebuffers help vulkan to make flashlight work.

I hope this will include in v1.12.3 :)

ghost commented 1 year ago

This is finally fix @hrydgard thanks 😁👍

Vulkan and OpenGL Screenshot_2022-08-25-22-04-29-729_org ppsspp ppsspp

Software Screenshot_2022-08-25-22-04-11-744_org ppsspp ppsspp

Panderner commented 1 year ago

The Flashlight issue still not fixed: ULUS10450_00000

ghost commented 1 year ago

The Flashlight issue still not fixed: ULUS10450_00000

What platform and GPU backend? Simulate Block Transfer Effects is ON?

unknownbrackets commented 1 year ago

See https://github.com/hrydgard/ppsspp/issues/6265#issuecomment-447602810, which has been buried by tons of screenshots. This probably requires depth texturing, which may not be supported by all GPUs and GPU backends.

That it doesn't work in software implies that there's probably a self-depth-texturing hazard. Could you post a frame dump created from the software renderer?

-[Unknown]

ghost commented 1 year ago

That it doesn't work in software implies that there's probably a self-depth-texturing hazard. Could you post a frame dump created from the software renderer?

-[Unknown]

Here ULUS10450.ppdmp.zip

bslenul commented 1 year ago

Not fixed at all for me either. Windows 10 / GTX 970, seems to still be glitched with any renderer.

Simulate Block Transfer Effects is ON?

Disabling "Simulate Block Transfer Effects" is not a valid solution IMO, it removes almost every shadows produced by the flashlight so yeah the glitches are of course way less visible but it doesn't look good, plus the screen of the in-game phone is completely broken.

hrydgard commented 1 year ago

This is known broken, and is one of the things I'm going to be working on soon.

brujo5 commented 1 year ago

Why when simulate block transfer is enabled and the black spots appear in the flashlight and if you disable that setting again the spots continue until I increase the resolution they disappear?

unknownbrackets commented 1 year ago

Here ULUS10450.ppdmp.zip

In this dump, at 1042/1241 it draws the flashlight stencil (REPLACE/REPLACE/ZERO), and then at 1155/1241 it draws the scratchy lines using stencil testing (a & 0x81) == 0x81. Unfortunately, these spots have 0x80 not 0x81, and it's actually because it was 0x00 / 0x01 at 1042. So it's from earlier.

814/1241 writes 1 bits (RGB masked, stencil masked to write 0x01 only.) It does a self-render of 0x04170000 with a color test for == 0x000000. Some of the pixels in the image at this point have RGB=1, which is why they don't pass the color test. So... it's even earlier.

At 765/1241, it turns a grayscale rendering of the scene into the black. It uses a depth == test, and subtract blending. This is subtracting from colors (no lighting) drawn at 605/1241. But at 765, it's using some texture from RAM to subtract. This seems like a color interpolation accuracy issue with the polygons. Because they don't match the texture exactly, not quite enough color is subtracted and it doesn't exactly equal 000000 later.

The texture is actually I suspect drawn at 260/1241 (to 0x0004c000, strangely), and I suspect copied to RAM from there. It's drawn at 565 with weird looking colors, but the RAM texture is CLUT8 with a simple grayscale ramp, so I suspect the CPU converted the 565 to 8-bit. This drawing of the scene happens at 256x256 and is centered around the area the flashlight can see (clipped on sides and taller.)

So the pattern you see is actually a representation of the color interpolation error, probably, rather than a hazard. I wonder if this is related (after shader bitmasking) to what's happening on some devices with hardware rendering. Tricky that it relies on some specifics of the color interpolation...

Bus texture and scene, different perspectives

-[Unknown]

ghost commented 1 year ago

The Flashlight issue still not fixed: ULUS10450_00000

See https://github.com/hrydgard/ppsspp/commit/a72a425df6e9f8e25f1d1641ece0828d8062e64a#commitcomment-85420933