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
11.36k stars 2.18k forks source link

Fragment color issue (gl_FragColor) #1201

Closed dbz400 closed 11 years ago

dbz400 commented 11 years ago

It seems to me that gl_FragColor generates incorrectly (may be i'm wrong) .When i tried to set gl_FragColor to a constant value like texture2D(tex, v_texcoord) instead of the dynamically generated from texture modulate/decal/blend/add/replace , Of course it breaks graphic in games but it shows me TON of games that have missing or black textures reappear now

List of games

Kingdom Heart (black texture ingame) Gundam AGE (black texture ingame) Three Kindom 9 (black texture ingame) Dragon Ball Evolution (missing profile input , arcade menu etc) Dragon Ball Z Shin Budokai 2 (black texture ingame)

hrydgard commented 11 years ago

Will look into it, thanks for re-filing a nice issue report :)

dbz400 commented 11 years ago

Thanks @hrydgard .Just seen the RGBA decal fix :)

dbz400 commented 11 years ago

Have tested those list of games which have black or missing textures , seems to be not yet fixed to them .

hrydgard commented 11 years ago

It made Virtua Tennis a bit less overbright, at least..

dbz400 commented 11 years ago

That's great .

hrydgard commented 11 years ago

I suspect that the blackness is really caused by lighting calculations going wrong rather than decal mode etc going wrong, but not 100% sure.

dbz400 commented 11 years ago

I see. I will try to see if adjusting the lighting calcuations will help when i come back home tonight .

unknownbrackets commented 11 years ago

I still think we really need tests here, although I haven't been able to figure out how to make them...

If you want, you could try giving that a shot - I think it'd really help. If you created a test under pspautotests, you could test it under JPCSP even without a PSP. Presumably it would look correct there if these games do, and wrong in PPSSPP.

That way we can get to a place where we're not playing hot potato with rendering bugs.

-[Unknown]

dbz400 commented 11 years ago

In some cases , definitely it is lightning calc issue . for example . black texture in Gundam Universe AGE

-SW mode

2

-HW mode

1

VIRGINKLM commented 11 years ago

There's def something related to lightning too, on Kingdom Hearts when there isn't a direct light source you are able to see the textures of the models. It looks like lightning sources instead of light up the model do the opposite.

unknownbrackets commented 11 years ago

Maybe something isn't clamped that should be, and the lighting is doing too much or something? Or a NaN?

-[Unknown]

VIRGINKLM commented 11 years ago

Dunno but the missing textures also in 2D menus like loading screen (KHBBS) is an intresting fact that I have no clue if I should consider it related or not. You really need to check some cutscenes of that game to understand what I'm talking about. I never seen something like it, it's kinda scary, a black silhouette that at times may fade slowly in into a fully textured model and then fade out to black silhouette again. This happens in a period of 3-4 seconds. Do you want me to provide screenshots?

c0nK3R commented 11 years ago

I don't know if this will help but hopefully it will provide insight into what is happening. http://www.youtube.com/watch?v=CLhkjm1uTvw

From the video the textures are initialized fine but are rendered black over 2~4 frames or ~0.05 seconds from being rendered. So its apparent that for whatever reason the transformation is being multiplied till the texture is turned black.

Also Here is another video. Watch the second case and for some reason the characters texture is rendered fine indefinitely when they spawn behind the wall, but this might just be a case of the game broke :). http://www.youtube.com/watch?v=4Qp8m1wZlsU

dbz400 commented 11 years ago

I think it would be similar to DBZ as well when character transformed , the black texture will gone becasue transformation involve lighting i think

c0nK3R commented 11 years ago

yeah it most likely is or it just replaces the texture and doesn't apply the same function of lighting, but what I was getting at is whatever shadow\light function is doing this is having a multiplying effect and may be an indirect loop issue

example would be. start with a texture image that is rendered fine. // if it was a calc issue then wouldn't it be rendered black from here? on next frame add 30% darkening on next frame add 30% darkening on next frame add 30% darkening end result is a blackened character