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

Remaining lighting issues #4140

Closed
hrydgard opened this issue Oct 12, 2013 · 38 comments
Closed

Remaining lighting issues #4140

hrydgard opened this issue Oct 12, 2013 · 38 comments
Milestone

Comments

@hrydgard
Copy link
Owner

hrydgard commented Oct 12, 2013

Bugs probably caused by something wrong with our lighting equations (possibly edge cases, NaNs, whatnot):

  • Strong yellow light in Fired Up
  • Fish with the wrong color in Monster Hunter (reported in forums), also some pointer arrows (FIXED)
  • Overly strong light in Virtua Tennis
  • Black arms and legs in NBA Live 06 (also NBA Live 06 : Black texture (hand/leg) #4109)
  • Unexpected blue and banding in Blade Dancer (ULUS10124_0001.zip)
@thedax
Copy link
Collaborator

thedax commented Oct 12, 2013

Monster Hunter's lighting in general is too dark(#2526). Also, cooking steaks in Monster Hunter is made much more difficult by the meat not changing in colour as it cooks, like the fish issue(it goes from a light red/raw to black if it burns).

@xsacha
Copy link
Collaborator

xsacha commented Oct 17, 2013

Is the bright Wipeout considered a lighting issue?

@hrydgard
Copy link
Owner Author

Most likely not.

@hrydgard
Copy link
Owner Author

I think all this is fixed except the strong light in Virtua Tennis, which might be an entirely separate issue. It occurs when the "strike power" meter is shown, before that it looks correct.

@thedax
Copy link
Collaborator

thedax commented Dec 31, 2013

#2526 seems to have been fixed, so that can be marked off the list.

@internetakias
Copy link

Shouldn't Sonic Rivals 2 be included to the list?

@unknownbrackets
Copy link
Collaborator

This isn't really about bloom issues. Does that game look correct in softgpu? If yes, then it's probably not a lighting issue.

-[Unknown]

@dbz400
Copy link
Contributor

dbz400 commented Jan 6, 2014

I think item 2 should be fixed .Item 4 is not .Wondering how about item 1 and 3?

@vnctdj
Copy link
Contributor

vnctdj commented Jan 6, 2014

Yes, the issue which occurs in Monster Hunter games is fixed :)

@unknownbrackets
Copy link
Collaborator

Is Virtua Tennis any better now?

-[Unknown]

@ppmeis
Copy link
Contributor

ppmeis commented Jul 21, 2014

@unknownbrackets Virtua Tennis World Tour is a bit better during gameplay but in near camera views players are too bright:
image
image

@unknownbrackets
Copy link
Collaborator

Does the GE debugger show anything when it's drawing the areas that are too bright?

-[Unknown]

@ppmeis
Copy link
Contributor

ppmeis commented Mar 2, 2015

@unknownbrackets here you have:
image
image

image
image

@unknownbrackets
Copy link
Collaborator

It's using color doubling but the texture already looks reasonable imho. Unless we're doubling incorrectly (I don't think we are), not sure. Though, it's using a texture level bias. Does the other texture level look different, other than smaller? e.g. is it darker?

-[Unknown]

@ppmeis
Copy link
Contributor

ppmeis commented Mar 3, 2015

@unknownbrackets no, other texture levels look the same color and brightness.

@unknownbrackets
Copy link
Collaborator

If you change "Light 0 enable" (by double clicking) to off right when it's sitting with the face highlighted in red, and then click "Step Draw", does it make it darker, or is it the same?

-[Unknown]

@unknownbrackets
Copy link
Collaborator

It would be interesting if these issues reproduce now in softgpu (especially starting from the beginning.) If it's an issue of RAM not being updated somewhere, i.e. stencil or depth or w/e, then softgpu may handle it more correctly.

-[Unknown]

@hrydgard
Copy link
Owner Author

Apart from some black pixels (rounding issues) Virtua Tennis looks fine in the software renderer.

tennis

It's actually really strange that this is still buggy in the hardware renderer... i wonder what it could be.

By the way I'm going to turn off the "slow" warning in the software renderer :)

@unknownbrackets
Copy link
Collaborator

Well, frameskip does still help in softgpu, but sure, heh.

-[Unknown]

@unknownbrackets
Copy link
Collaborator

Blade Dancer also has an issue - both in softgpu and GLES.

ulus10124_00000

Also, double-checked that this wasn't somehow a bug in the real game. A few notes:

  • Incorrect blue is added by light 1.
  • Using flat shading (but gouraud shading looks wrong too.)
  • It's using separate specular colors (but doesn't matter either way.)

It uses the same lighting parameters for basically the entire scene. Probably the lighting parameters are being calculated too close?

-[Unknown]

@hrydgard
Copy link
Owner Author

What's incorrect in the screenshot? The dark triangle?

What do you mean by "calculated too close"? Sorry :)

@unknownbrackets
Copy link
Collaborator

Yes, the blue triangle is wrong. It shouldn't be there at all. Note that the same blue is darkening things like the steps, the walkway, the wall, etc. The amount of blue is correct on those things.

-[Unknown]

@hrydgard
Copy link
Owner Author

Could always be some inf or nan interpreted differently than the PSP, but that's just speculation...

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented May 29, 2017

Here's all the tabs when it draws it (PRIM_TRIANGLE_STRIP):
https://gist.github.com/unknownbrackets/8f98e0511e1991932b21ef2cf565d974

Disabling the light 1 flag for only this draw makes it look approximately correct (but other things look wrong unless light 1 is manually re-enabled before continuing drawing.) I don't see any inf/nans, but maybe it's guardband related or something...

Quickly checked - JPCSP does not have this bug. However, it also renders the opening scene wrong (the girl is not translucent - which is a lighting bug in JPCSP.)

-[Unknown]

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented Jul 16, 2017

See ULUS10124_0001.zip ULUS10124_0002.zip for a dump of the Blade Dancer lighting issue. Will also add to the issue description.

Edit: Uploaded a new one since the old broke.

-[Unknown]

@unknownbrackets
Copy link
Collaborator

I'm not sure why, but #10411 has made the Blade Dancer issue stop happening in GLES. It still happens everywhere else and in softgpu.

This may be a case of "accidentally working", I'm not sure...

-[Unknown]

@marosis
Copy link

marosis commented Jan 22, 2018

This issue have maybe Flat Out Head on too.

@unknownbrackets
Copy link
Collaborator

An interesting finding, the Blade Dancer bug doesn't happen in OpenGL in game... but it does happen from the dump. This makes me think it's an alignment issue or something.

-[Unknown]

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented Nov 18, 2018

Any change to the Virtua Tennis, NBA, or Flat Out Head On issues?

Could you try exporting a GE frame dump? These help a lot (already have one for NBA, sorry, see #4109.)

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]

@hrydgard
Copy link
Owner Author

hrydgard commented Nov 19, 2018

vtennis.zip

Virtua Tennis still has problems, so here's a couple of frame dumps. In the first one (03), the character lighting is normal. In the second one (04), the lighting is wrong and too bright.

The change to the bad lighting happens when you hit X to start a ball strike, which shows the little meter. Presumably it sets some state that the rest of the drawing shouldn't care about but somehow does...

Here's a youtube video confirming what the normal lighting looks like: https://www.youtube.com/watch?v=TAhAGgeJthM

@unknownbrackets
Copy link
Collaborator

Texture for overly bright person: 0x04105720

For reference, the correct image for that frame:
ules00126_ 4140_virtua_tennis_lighting

And the incorrect:
virtua tennis wrong

Interestingly, softgpu also gets the lighting wrong and the shadows even worse. It also has an easy to fix bug breaking clearing, which I'll fix soon. What's interesting is: it used to work in the software renderer. This implies it's not a state thing.

If I disable light 0 (the only enabled light), the characters are too dark. This light uses powered diffuse + spec. If I remove specular from the equation, it looks right.

The shadow uses color doubling + standard blend, and the same lighting parameters. It also looks correct without specular. Curiously, softgpu loses the shadow after the first frame.

The check from #8403 doesn't help. Also, because getMaterialSpecularCoef is 1.0, pow doesn't really matter.

It's not possible that mode 2 is powered diffuse only, and not specular, is it? Hm.

-[Unknown]

@unknownbrackets
Copy link
Collaborator

Hardware tests so far indicate that mode 2 is powered diffuse only, no specular. Also makes this dump look perfect, except in softgpu (still not sure what's causing the shadow to evaporate after the first frame - it's drawn briefly... so weird.)

I'm seeing some other possible differences though. For example, lightdir = (0, 0, 0) seems to normalize to (0, 0, 1) for spot lights, and a clamping issue for spot lightScale.

It also seems like lighting is generally rounding down, not up, but that's a fairly minor accuracy issue...

Need to check more and see how games react to this, but later.

-[Unknown]

@hrydgard
Copy link
Owner Author

hrydgard commented Nov 20, 2018

Nice! All of it makes sense, I think this will fix a lot of graphics issues. Did you confirm that specular is off if dot(light, normal) is <= 0.0?

With rounding down, do you mean when it gets rounded to the final screen color from float? I thought we were already effectively doing that, but maybe not... Come to think of it, should we maybe explicitly round down before multiplying with the texture color in case of MODULATE, hm... I mean, really we should probably do what Dolphin did and perform the fragment shading in fixed point, but that would not be good for perf on older mobile chips.

@unknownbrackets
Copy link
Collaborator

Yeah - many of the tests I'm running are giving me colors that are off by one, e.g. 00471d1d instead of 00461d1d (diffuse.) I'm running these tests with no texturing at all, actually.

Didn't create a test yet to confirm specular during diffuse + specular, still more to test...

-[Unknown]

unknownbrackets added a commit to unknownbrackets/ppsspp that referenced this issue Nov 22, 2018
Matches hardware tests and improves lighting for Virtua Tennis, see hrydgard#4140.
@hrydgard
Copy link
Owner Author

Confirming that Virtua Tennis looks good now. For the record, it was the no-specular-during-powered-diffuse.

@ppmeis
Copy link
Contributor

ppmeis commented Nov 23, 2018

Tested with latest build. Now lightning seems to be fine, but now start menu has disappeared in some backends:

Vulkan:
image
ULES00126_0001.zip

OpenGL seems to be fine:
image

Direct3D9:
image

Direct3D11:
image
ULES00126_0002.zip

@unknownbrackets
Copy link
Collaborator

Near texture 0x08973d00 + several draws to VAIDISOVA. I think that's a separate issue related to depth.

It draws verts with a crazy high Z, depth clamp, and standard minz/maxz. It uses src >= depth test. This passes and it draws the BG and clamped depth. Lighting is disabled. Alpha test and blend, but 8c alpha sent.

Not clear what should be keeping it from drawing... it doesn't draw on a PSP running the same dump...

Should open a separate issue, since lighting is disabled.

-[Unknown]

unknownbrackets added a commit to unknownbrackets/ppsspp that referenced this issue Nov 23, 2018
It needs to use the provoking color, regardless of culling or clipping.

Fixes Blade Dancer lighting (see hrydgard#4140.)
@hrydgard
Copy link
Owner Author

As I don't think NBA Live 06 (#4109) is a lighting problem, I'm gonna close this. If we discover more lighting-related problems, let's open new game-specific issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants