Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect blend in Persona 1 #1793

Closed
unknownbrackets opened this issue May 13, 2013 · 18 comments

Comments

@unknownbrackets
Copy link
Collaborator

commented May 13, 2013

The first save point in Persona 1 shows with a big black box around it. I initially thought this was gonna be a texture bug, but it turns out it's not AFAICT.

The texture definitely has alpha, although I think it might just have 1/0 alpha (the simple alpha flag was set.) I noticed that it was using the blend mode src.a + (1.0 - dst.a), which I'd not noticed used before. Most other textures were using the standard src.a + (1.0 - src.a).

Using the standard one, it looks different (better, I'd say), but still wrong. Note that this was happening before the double alpha thing, and it doesn't seem to be doubling alpha anywhere.

persona1

It should look like the top one - nicely blended, I guess. Using src alpha only, it has a black border (which supports it using 1/0 only.) I'm not sure I understand how the dst alpha should work here... since it's drawing on top of something, wouldn't that area likely already be fully opaque?

-[Unknown]

@hrydgard

This comment has been minimized.

Copy link
Owner

commented May 13, 2013

That's really weird. Maybe it's a two pass thing, where it first draws alpha to the framebuffer and then uses it to blend? I don't really see the point though.

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator Author

commented May 13, 2013

So, it's worth noting that the thing is flashing/glowing. And, the pot/etc. is part of the background, which it draws on top of. At least at that point it appears to have full alpha. Of the 103 textures drawn each frame, the bg is 2rd and overlay is 13th. It seems it's just there to make it glow.

Here's a frame dump:
https://gist.github.com/unknownbrackets/5566745

The BG that draws the pot/etc. is using add src.a, 1.0 - src.a, and an u8 indexed u32 clut. They're marked with == THIS IS THE at the flush (so after their respective commands.)

It actually draws 5 textures using add src.a, 1.0 - dst.a, but the rest are just using src. Not really sure how to tell if it's doing a first pass? Would drawing with normal blend and partial alpha write that alpha to the framebuffer?

-[Unknown]

@hrydgard

This comment has been minimized.

Copy link
Owner

commented May 13, 2013

Any drawing should write whatever is in gl_FragColor.a at the end of the shader to the alpha channel of the frame buffer (that is, the alpha blend factor "dst" in the next call that touches the pixel), if the alpha channel is not masked out by glColorMask of course.

Don't know why this hasn't happened here...

Is it also doing some kind of alpha test when drawing the glow overlay? Is the pot glowing correctly, and the only error is the black around it?

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator Author

commented May 13, 2013

It glows fine, it's just the black box. I don't think it's doing any tests at all (per the frame dump), but I'll double check later (I guess it could be persisting for all draws from a prev frame... well, probably not, since savestates work fine.) I don't think it uses any masks either.

-[Unknown]

@hrydgard

This comment has been minimized.

Copy link
Owner

commented May 13, 2013

It could be using stencil writes to clear the alpha channel of the background...

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator Author

commented May 24, 2013

Sorry for the stupid question, but how would I check for a stencil write? Would it need to use the stencil test/op to write to it?

-[Unknown]

@xsacha

This comment has been minimized.

Copy link
Collaborator

commented May 24, 2013

Looks like JPCSP are working on the same issue here:
https://code.google.com/p/jpcsp/source/detail?r=3156

Edit: On second glance, it looks like they are getting rid of horizontal lines.

@Abalieno

This comment has been minimized.

Copy link

commented Jun 9, 2013

After I fixed my video issue( #2179 ) this is the only other problem I'm aware of, sadly it makes the game almost unplayable since it affects the combat effects.

Can't someone look into this problem further? The game is just so close being perfectly playable.

@hrydgard

This comment has been minimized.

Copy link
Owner

commented Jun 10, 2013

Don't demand stuff, that makes us (or at least me) less likely to care. Play Persona 3 or FF7:CC while waiting :)

@internetakias

This comment has been minimized.

Copy link

commented Jul 24, 2013

No offence, but telling someone to play Persona 3 Portable instead seems kinda ignorant IMO, considering A.They're completely different games with only a few links here and there and B.There exists a better version of P3 called P3 FES. Also, this seems to be more than just a cosmetic glitch, since it obscures part of the screen in both P1P and P2:ISP. For example:
screen00066
screen00069
Here, part of the map is obscured making it difficult to navigate in
screen00029
And here in Persona 2 Innocent Sin, part of the room is obscured, so the player isn't able to see what's going on in the cutscene that takes place there nor is he/she able to see any of the NPCs afterwards

@internetakias

This comment has been minimized.

Copy link

commented Aug 17, 2013

Also, I should note that JPCSP doesn't have this issue. Perhaps you could take a look at the code and see how they fixed it?

@hrydgard

This comment has been minimized.

Copy link
Owner

commented Aug 17, 2013

Both emus are complex codebases that partly work in very different ways, it's not as easy as just copying a fix over.

Sorry for the stupid suggestion to play another game instead, I must have been frustrated at the time :P

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 18, 2013

Not to mention that they can do a lot of things we can't do because we're supporting OpenGL ES.

On that note, the software renderer has this same bug.

-[Unknown]

@internetakias

This comment has been minimized.

Copy link

commented Aug 18, 2013

I see. And yeah, I know both emus work pretty differently but I assumed maybe there could be something in the code that could clue you in on how they fixed it.

@starlightknight

This comment has been minimized.

Copy link

commented Aug 20, 2013

I started playing through this recently on PPSSPP and it would be awesome if we rooted out a fix for this.

The transparency issue in battles I can get by easy enough, but the maps can be difficult as shown above. The maps get obstructed because during most of the game there is supposed to be a large fog type effect on it, and any area that would have it turns completely block.

If there's any type of debug logging I can gather or you guys, or if you need save games or states let me know, I would be happy to provide them.

@hrydgard

This comment has been minimized.

Copy link
Owner

commented Aug 22, 2013

Should be fixed by 416f0c5 . Hope it's alright...

@internetakias

This comment has been minimized.

Copy link

commented Aug 22, 2013

THANK YOU! It actually works! Now all that's left is fixing the dim 3d overworlds (In JPCSP it's fixed by enabling Stencil Test FYI), the flickering in loading screens and battle entrance animations when BR is off and the sound effect crackle

@hrydgard hrydgard closed this Aug 22, 2013
@starlightknight

This comment has been minimized.

Copy link

commented Aug 22, 2013

Dude - totally awesome. Thanks so much for looking into this, the fix works great ^_^.

I'm glad I get to finish my playthrough on PPSSPP with it looking right. Playing on the big screen with dualshock 3 is so much more enjoyable than real PSP :-)

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.