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

Outrun 2006 Lighting Bug: Every cars' colours are wrong #5506

Closed
thedax opened this issue Feb 18, 2014 · 25 comments · Fixed by #5612
Closed

Outrun 2006 Lighting Bug: Every cars' colours are wrong #5506

thedax opened this issue Feb 18, 2014 · 25 comments · Fixed by #5612

Comments

@thedax
Copy link
Collaborator

thedax commented Feb 18, 2014

As a continuation of #2603, it makes more sense to begin parsing out the game's remaining separate issues into their own issues instead of one mega issue for everything wrong.

In this particular instance, nearly all of the cars in the game have the wrong colours.

Screenshots of all of the cars (in their default colours) from RHW: http://min.us/mbwKK55M1pdsCm

Screenshots of all of the cars (in their default colours) from PPSSPP: http://min.us/mbqcmIXrarTMEs

I'm currently unaware if they've ever been correct. I need to investigate. From a few screenshots I've seen of the game in JPCSP, the car colours appear to be correct.

@thedax
Copy link
Collaborator Author

thedax commented Feb 18, 2014

This is interesting: PPSSPP actually renders the colours right, but then some sort of reflection or something gets put on top of it, and that's when it looks incorrect:

Don't mind the debug info on this first screen, the point of it is to illustrate the correct colour:
screenshot 01

Here's the "reflection" or whatever it's doing to the car afterward:
screenshot 02

@unknownbrackets
Copy link
Collaborator

What happens if you disable lighting when it's drawing the reflection? You might have to keep disabling it. Just double click Lighting under Flags until it's 0.

-[Unknown]

@dbz400
Copy link
Contributor

dbz400 commented Feb 18, 2014

If i remember correctly , set the vfb->format == fmt , fixes the color issue here but breaks Kingdom Heart.

     if (MaskedEqual(v->fb_address, fb_address) && vfb->format == fmt) 

@thedax
Copy link
Collaborator Author

thedax commented Feb 18, 2014

@unknownbrackets: When lighting is disabled, the car is drawn correctly, but without the "shininess", of course:

screenshot 01

For comparison, here's the bug:

screenshot 02

@unknownbrackets
Copy link
Collaborator

It'd be great to see all the values from the Lighting tab.

-[Unknown]

@thedax
Copy link
Collaborator Author

thedax commented Feb 18, 2014

When it's first drawn as yellow (no reflection yet):
Ambient color 000000
Ambient alpha 0000ff
Material update ambient, diffuse, specular
Material emissive 000000
Material ambient 8b8b8b
Material diffuse 7f7f7f
Material alpha 0000ff
Material specular 8b8b8b
Mat. specular coef 0.500000
Reverse normals 0
Shade model 1
Light mode 0
Light type 0 1
Light type 1 0 (disabled)
Light type 2 0 (disabled)
Light type 3 0 (disabled)
Light pos 0 -0.500000, -0.707092, -0.499992
Light pos 1 -1.000000, -0.000000, -0.000000 (disabled)
Light pos 2 -0.000000, -0.190807, -0.981613 (disabled)
Light pos 3 0.000000, 0.000000, 0.000000 (disabled)
Light dir 0 0.000000, 0.000000, 0.000000
Light dir 1 0.000000, 0.000000, 0.000000 (disabled)
Light dir 2 0.000000, 0.000000, 0.000000 (disabled)
Light dir 3 0.000000, 0.000000, 0.000000 (disabled)
Light att 0 0.000000, 0.000000, 0.000000
Light att 1 0.000000, 0.000000, 0.000000 (disabled)
Light att 2 0.000000, 0.000000, 0.000000 (disabled)
Light att 3 0.000000, 0.000000, 0.000000 (disabled)
Lightspot coef 0 0.000000
Lightspot coef 1 0.000000 (disabled)
Lightspot coef 2 0.000000 (disabled)
Lightspot coef 3 0.000000 (disabled)
Light angle 0 0.000000
Light angle 1 0.000000 (disabled)
Light angle 2 0.000000 (disabled)
Light angle 3 0.000000 (disabled)
Light ambient 0 3f3f3f
Light diffuse 0 9f9f9f
Light specular 0 000000
Light ambient 1 000000 (disabled)
Light diffuse 1 000000 (disabled)
Light specular 1 000000 (disabled)
Light ambient 2 000000 (disabled)
Light diffuse 2 000000 (disabled)
Light specular 2 000000 (disabled)
Light ambient 3 000000 (disabled)
Light diffuse 3 000000 (disabled)
Light specular 3 000000 (disabled)

When the car has the reflection drawn on it:
Ambient color 000000
Ambient alpha 0000ff
Material update none
Material emissive ffffff
Material ambient 000000
Material diffuse 000000
Material alpha 0000ff
Material specular 000000
Mat. specular coef 0.500000
Reverse normals 0
Shade model 1
Light mode 0
Light type 0 1 (disabled)
Light type 1 0
Light type 2 0
Light type 3 0 (disabled)
Light pos 0 -0.500000, -0.707092, -0.499992 (disabled)
Light pos 1 -1.000000, -0.000000, -0.000000
Light pos 2 -0.000000, -0.190807, -0.981613
Light pos 3 0.000000, 0.000000, 0.000000 (disabled)
Light dir 0 0.000000, 0.000000, 0.000000 (disabled)
Light dir 1 0.000000, 0.000000, 0.000000
Light dir 2 0.000000, 0.000000, 0.000000
Light dir 3 0.000000, 0.000000, 0.000000 (disabled)
Light att 0 0.000000, 0.000000, 0.000000 (disabled)
Light att 1 0.000000, 0.000000, 0.000000
Light att 2 0.000000, 0.000000, 0.000000
Light att 3 0.000000, 0.000000, 0.000000 (disabled)
Lightspot coef 0 0.000000 (disabled)
Lightspot coef 1 0.000000
Lightspot coef 2 0.000000
Lightspot coef 3 0.000000 (disabled)
Light angle 0 0.000000 (disabled)
Light angle 1 0.000000
Light angle 2 0.000000
Light angle 3 0.000000 (disabled)
Light ambient 0 3f3f3f (disabled)
Light diffuse 0 9f9f9f (disabled)
Light specular 0 000000 (disabled)
Light ambient 1 000000
Light diffuse 1 000000
Light specular 1 000000
Light ambient 2 000000
Light diffuse 2 000000
Light specular 2 000000
Light ambient 3 000000 (disabled)
Light diffuse 3 000000 (disabled)
Light specular 3 000000 (disabled)

@hrydgard
Copy link
Owner

So it's obviously making the car shiny using an environment map, which might be dynamic. If we are rendering to that environment map, maybe that's when we have the wrong colors?

@thedax
Copy link
Collaborator Author

thedax commented Feb 19, 2014

Is there a simple way to check for an amateur like me?

@dbz400
Copy link
Contributor

dbz400 commented Feb 23, 2014

if i try to shuffle 0.5 , it did show the yellow shinning .

        case GE_TEXMAP_ENVIRONMENT_MAP:  // Shade mapping - use dots from light sources.
            WRITE(p, "  v_texcoord = u_uvscaleoffset.xy * vec2(1.0 + dot(normalize(u_lightpos%i), worldnormal), 1.0 - dot(normalize(u_lightpos%i), worldnormal) * 0.5);\n", gstate.getUVLS0(), gstate.getUVLS1());
            break;

ulus10064_00004

@dbz400
Copy link
Contributor

dbz400 commented Feb 23, 2014

In software rendering , if we remove the / 2.f , the shinning reappears as well

        if (gstate.getUVLS0() == (int)light)
            vertex.texturecoords.s() = (diffuse_factor + 1.f) ;

        if (gstate.getUVLS1() == (int)light)
            vertex.texturecoords.t() = (diffuse_factor + 1.f) ;

ulus10064_00005

@ThePhoenixRises
Copy link

Would it be possible to add the game Dirt 2 (ULES01301) to this issue, as it has similar shading problems with the cars skins.
Buffered Rendering produces these:
ules01301_00000
ules01301_00003

@hrydgard
Copy link
Owner

hrydgard commented Mar 6, 2014

Non-buffered rendering is irrelevant because it's a performance hack that skips all rendering to textures, so things like this will break. It's only interesting if it's broken with buffered rendering.

Which is seems to be given your two last images, so okay :)

@thedax
Copy link
Collaborator Author

thedax commented Mar 22, 2014

Um..this wasn't fixed with that commit, it was just mostly corrected.

See #5612 (comment) for how it looks now.

@hrydgard hrydgard reopened this Mar 22, 2014
@hrydgard
Copy link
Owner

Autoclosed, sorry.

@thedax
Copy link
Collaborator Author

thedax commented Mar 22, 2014

Ah, right. I forgot Github does that. It's okay.

@thedax thedax changed the title Outrun 2006 Lighting Bug: Every car's colours are wrong Outrun 2006 Lighting Bug: Every cars' colours are wrong May 4, 2014
@thedax
Copy link
Collaborator Author

thedax commented Feb 17, 2015

Quick update, this affects Direct3D9 as well, and the issue is still happening on the latest builds with both backends.

@thedax
Copy link
Collaborator Author

thedax commented Sep 17, 2015

Yet another update: somewhere along the way, OpenGL lost the environment mapping on the cars, making them look dull and flatly shaded, while Direct3D9 continues to have shiny cars with the wrong colours. if you'd like me to bisect to find where OpenGL went astray, I can.

@thedax
Copy link
Collaborator Author

thedax commented Apr 11, 2016

While I'm on the subject of updating some of my old issues, this one is still present, with one minor new piece of info: Vulkan suffers from the same missing environmental mapping as OpenGL (which is expected :) ). Direct3D9 still has shiny cars, but bad colours on small parts of the cars (e.g. where bumpers or chrome pieces are).

@ThePhoenixRises
Copy link

Same issue with Dirt 2 same problems with the skins of the cars showing incorrect colours.

@thedax
Copy link
Collaborator Author

thedax commented Sep 4, 2018

Update on this with the latest commit ( 562c5f6 ): Cars are still missing their reflections/environment maps on all backends, but software rendering appears to display them correctly. However, as far as I can tell, the original issue of "every car has the wrong colours in Outrun 2006" has been fixed on all backends (on Windows), so I think it might be worth making a new issue for it and closing this one, so new info can be gathered; I'll let Unknown decide on that though.

Vulkan: image

Software (Vulkan backend): image

@unknownbrackets
Copy link
Collaborator

Interesting. I wonder when it improved - maybe whatever change fixed that could lead us to a reflection fix.

I am a fan of a new issue, to avoid getting lost on comments. But I don't think it's important either way. A GE debugger dump might help for the reflection issue.

Especially interesting: if you create the dump while on software, does it work on hardware? If yes, it's almost definitely a framebuffer effect or upload/download. If it still doesn't work, then it's some mishandled state.

-[Unknown]

@thedax
Copy link
Collaborator Author

thedax commented Sep 5, 2018

From what i saw, yes, the dump made on software works on hardware. Here are two dumps I took, one on Vulkan (hardware) and one on Vulkan (software):

DUMP.zip

That being said though, let's move this over to a new issue.

@unknownbrackets
Copy link
Collaborator

Yeah, the texture is blank. It seems to use a 4444 texture using tex env mapping. I'm guessing it's an upload of some kind - I'm not sure where, though. It could be 0x040cc000.

-[Unknown]

@hrydgard
Copy link
Owner

hrydgard commented Sep 5, 2018

Blank texture data in VRAM can of course also be caused by faulty render target downloads/writebacks... But let's add any further comments or research in the new issue instead.

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

Successfully merging a pull request may close this issue.

5 participants