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

MotorStorm Arctic Edge USA - Abnormal Shadow #7552

Closed
tabnk opened this issue Mar 3, 2015 · 36 comments · Fixed by #17602
Closed

MotorStorm Arctic Edge USA - Abnormal Shadow #7552

tabnk opened this issue Mar 3, 2015 · 36 comments · Fixed by #17602
Milestone

Comments

@tabnk
Copy link

tabnk commented Mar 3, 2015

On Latest ppsspp-v1.0.1-97-g3e1e8f1-windows-amd64. Buffering Mode On and all default settings.

ucus98743_00002
ucus98743_00001
ucus98743_00000

@ppmeis
Copy link
Contributor

ppmeis commented Mar 3, 2015

It works fine for me:
image

@daniel229
Copy link
Collaborator

The EU does not have the shadow glitch while the USA verson has that glitch.

@ppmeis
Copy link
Contributor

ppmeis commented Mar 5, 2015

@daniel229 that sounds very strange :/

@unknownbrackets
Copy link
Collaborator

Does this still happen? Can you capture the drawing of the shadows in the GE debugger?

-[Unknown]

@tabnk
Copy link
Author

tabnk commented Dec 27, 2015

Same issue on latest build too ppsspp-v1.1.1-457-gda65116-windows-amd64.

Attached GE Screenshot

1

@unknownbrackets
Copy link
Collaborator

Can you try to pick out when it's highlighting the ground in red, right before it draws the shadow?

https://github.com/hrydgard/ppsspp/wiki/How-to-find-a-graphic-issue-with-the-GE-debugger

What I'm looking for is how it's drawing the shadow. I don't have the game so you are my window into this information. A screenshot just shows me that it's wrong but it could be doing so many different things.

I guess it's most likely projecting. Maybe it's using stencil or something though...

-[Unknown]

@tabnk
Copy link
Author

tabnk commented Dec 27, 2015

Shadow appear immediately together with the Car so there is no "right before it draws the shadow".

Not sure how to use GE debugger but maybe below Red screen may help.

2

@tabnk
Copy link
Author

tabnk commented Dec 27, 2015

If can't be fix than it is fine. :)

@unknownbrackets
Copy link
Collaborator

Normally if you keep pressing step prim, it will eventually show the car. What you're seeing there is it initially clearing the screen. Here's how it works:

  1. First, it's going to show the old frame (not the new one it's about to draw.)
  2. Then, it's going to draw black on top of it, most likely.
  3. After that, it will probably draw the ground.
  4. Once the ground is drawn, it'll probably draw the far-away buildings. Side by side, billboard by billboard.
  5. Once those things are drawn, it will likely draw the sky. Maybe it will draw the sky before the ground, or before the buildings. But at some point it'll draw it.
  6. Later, it may draw the shadows on top of the ground. It'll probably draw the cars (one at a time) first.
  7. After it's done all those things, it will draw the text "Press X to skip" on top.

You just pressed step prim a couple times. You probably didn't even get 1% through the frame. There's a ton to draw. It redraws everything from scratch every single frame. That's how 3d games work.

-[Unknown]

@tabnk
Copy link
Author

tabnk commented Dec 27, 2015

I'm step through it and it show RED on the Ground before Shadow. Let's hope it is what you refer to.

3

@tabnk
Copy link
Author

tabnk commented Dec 27, 2015

Another Screenshot
4

@unknownbrackets
Copy link
Collaborator

That's exactly the right place, I just need the contents of the other tabs (you can use ctrl-a ctrl-c to copy as per that wiki page.) You can get there quicker by clicking "Step Frame" and then "Break on Texture..." and pasting 0x0907af00 into the box, then clicking "Resume". It will stop when it starts using that shadow texture again.

So it's not projecting, it seems to be drawing it right where it wants. Actually, I wonder if this is bot blending right... I especially want to see the Flags, Lighting, Texture, and Settings tabs.

-[Unknown]

@tabnk
Copy link
Author

tabnk commented Dec 30, 2015

OK here it is.

Flags:
Name Value
Lighting enable 0
Light 0 enable 1
Light 1 enable 0
Light 2 enable 0
Light 3 enable 0
Clip enable 0
Cullface enable 1
Texture map enable 1
Fog enable 1
Dither enable 0
Alpha blend enable 1
Alpha test enable 0
Depth test enable 1
Stencil test enable 0
Antialias enable 0
Patch cull enable 0
Color test enable 0
Logic op enable 0
Depth write disable 1

@tabnk
Copy link
Author

tabnk commented Dec 30, 2015

Lighting:
Name Value
Ambient color 000000
Ambient alpha 0000ff
Material update ambient, diffuse
Material emissive 000000
Material ambient ffffff
Material diffuse ffffff
Material alpha 0000ff
Material specular 000000
Mat. specular coef 255.000000
Reverse normals 0
Shade model 1
Light mode 1 (disabled)
Light type 0 1
Light type 1 0 (disabled)
Light type 2 0 (disabled)
Light type 3 0 (disabled)
Light pos 0 -0.000000, 0.707092, -0.707092
Light pos 1 0.000000, 0.000000, 0.000000 (disabled)
Light pos 2 0.000000, 0.000000, 0.000000 (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 000000
Light diffuse 0 e0e0e0
Light specular 0 e0e0e0
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)

@tabnk
Copy link
Author

tabnk commented Dec 30, 2015

Texture:
Name Value
Tex U scale 1.000000
Tex V scale 1.000000
Tex U offset 0.000000
Tex V offset 0.000000
Tex mapping mode gen: tex coords, proj: pos
Tex shade srcs 000000
Tex mode swizzled, 1 levels
Tex format CLUT4
Tex filtering min: linear, mag: linear
Tex wrapping clamp s, clamp t
Tex level/bias 000000
Tex lod slope 3cf9db
Tex func modulate, RGBA, color doubling
Tex env color 000000
CLUT 08f8c080, w=0
CLUT format ABGR 8888 ind & ff
Texture L0 addr 0907af00, w=64
Texture L1 addr 09ada080, w=64
Texture L2 addr 09ada880, w=32
Texture L3 addr 09adaa80, w=16
Texture L4 addr 09adab80, w=8
Texture L5 addr 09adac00, w=4
Texture L6 addr 09adac40, w=2
Texture L7 addr 09adac60, w=1
Texture L0 size 64x64
Texture L1 size 64x64
Texture L2 size 32x32
Texture L3 size 16x16
Texture L4 size 8x8
Texture L5 size 4x4
Texture L6 size 2x2
Texture L7 size 1x1

@tabnk
Copy link
Author

tabnk commented Dec 30, 2015

Setting:
Name Value
Clear mode 0
Framebuffer 00000000, w=512
Framebuffer format 8888
Depthbuffer 00130000, w=512
Vertex type float texcoords, ABGR 8888 colors, float positions
Offset addr 08000000
Vertex addr 08d9dc08
Index addr 08d6d51c
Region 0,0 - 511,295
Scissor 0,0 - 511,295
Min Z 000000
Max Z 00ffff
Viewport Scale 256.000000, -148.000000, -32768.000000
Viewport Offset 2048.000000, 2048.000000, 32767.000000
Offset 1792.000000x1900.000000
Cull mode 1
Color test pass if (c & ffffff) != (000000 & ffffff) (disabled)
Alpha test pass if (a & ff) > (00 & ff) (disabled)
Stencil test pass if (00 & 00) ALWAYS (a & 00) (disabled)
Stencil test op fail=KEEP, pass/depthfail=KEEP, pass=KEEP (disabled)
Depth test pass if src >= dst
Alpha blend mode add: src.a, 1.0 - src.a
Blend color A 000000
Blend color B 000000
Logic Op clear (disabled)
Fog 1 640.000000
Fog 2 0.001736
Fog color bacccf
RGB mask 000000
Stencil/alpha mask 000000
Morph Weight 0 1.000000
Morph Weight 1 0.000000
Morph Weight 2 0.000000
Morph Weight 3 0.000000
Morph Weight 4 0.000000
Morph Weight 5 0.000000
Morph Weight 6 0.000000
Morph Weight 7 0.000000
Patch division 001010
Patch primitive 000000
Patch facing 000000
Dither 0 001d0c (disabled)
Dither 1 00f3e2 (disabled)
Dither 2 000c1d (disabled)
Dither 3 00e2f3 (disabled)
Transfer src 04098000, w=512
Transfer src pos 0,0
Transfer dst 04000000, w=512
Transfer dst pos 0,0
Transfer size 479,271

@tabnk
Copy link
Author

tabnk commented Dec 30, 2015

Vertices:
X Y Z U V Color
-3279.838867 -13618.438477 -1.015625 0.000000 63.249996 0000003f
-3279.859131 -13618.517578 -1.015625 3050.914795 -11177.312500 0000003f
-3279.824463 -13618.381836 -1.019531 3047.397949 -10883.437500 0000003f
-3279.859131 -13618.517578 -1.015625 3019.123047 -10768.041016 0000003f
-3279.869141 -13618.557617 -1.019531 3047.397949 -10883.437500 0000003f
-3279.843018 -13618.455078 -1.015625 3054.712891 -10736.500000 0000003f
-3279.843018 -13618.455078 -1.015625 3016.168945 -10448.779297 0000003f
-3279.824463 -13618.381836 -1.019531 3016.168945 -10448.779297 0000003f
-3279.859131 -13618.517578 -1.015625 3019.123047 -10768.041016 0000003f

@tabnk
Copy link
Author

tabnk commented Dec 30, 2015

Matrics:
Name 0 1 2 3
World 0 1.000000 0.000000 0.000000 0.000000
World 1 1.000000 0.000000 0.000000 0.000000
World 2 1.000000 -99.000000 -56.000000 104.000000
View 0 -0.965912 -0.253044 0.054606 -0.255081
View 1 0.966309 -0.034243 0.044102 0.047005
View 2 0.997910 -0.111460 0.144844 0.310555
Proj 0 1.854431 0.000000 0.000000 0.000000
Proj 1 0.000000 3.296753 0.000000 0.000000
Proj 2 0.000000 0.000000 -1.000000 -1.000000
Proj 3 0.000000 0.000000 -0.600082 0.000000
Texgen 0 0.000000 0.000000 0.000000 0.000000
Texgen 1 0.000000 0.000000 0.000000 0.000000
Texgen 2 0.000000 0.000000 0.000000 0.000000
Bone #0 row 0 984.000000 0.000000 0.000000 0.000000
Bone #0 row 1 984.000000 0.000000 0.000000 0.000000
Bone #0 row 2 984.000000 -99.000000 -56.000000 104.000000
Bone #1 row 0 0.000000 0.000000 0.000000 0.000000
Bone #1 row 1 0.000000 0.000000 0.000000 0.000000
Bone #1 row 2 0.000000 0.000000 0.000000 0.000000
Bone #2 row 0 0.000000 0.000000 0.000000 0.000000
Bone #2 row 1 0.000000 0.000000 0.000000 0.000000
Bone #2 row 2 0.000000 0.000000 0.000000 0.000000
Bone #3 row 0 0.000000 0.000000 0.000000 0.000000
Bone #3 row 1 0.000000 0.000000 0.000000 0.000000
Bone #3 row 2 0.000000 0.000000 0.000000 0.000000
Bone #4 row 0 0.000000 0.000000 0.000000 0.000000
Bone #4 row 1 0.000000 0.000000 0.000000 0.000000
Bone #4 row 2 0.000000 0.000000 0.000000 0.000000
Bone #5 row 0 0.000000 0.000000 0.000000 0.000000
Bone #5 row 1 0.000000 0.000000 0.000000 0.000000
Bone #5 row 2 0.000000 0.000000 0.000000 0.000000
Bone #6 row 0 0.000000 0.000000 0.000000 0.000000
Bone #6 row 1 0.000000 0.000000 0.000000 0.000000
Bone #6 row 2 0.000000 0.000000 0.000000 0.000000
Bone #7 row 0 0.000000 0.000000 0.000000 0.000000
Bone #7 row 1 0.000000 0.000000 0.000000 0.000000
Bone #7 row 2 0.000000 0.000000 0.000000 0.000000

@tabnk
Copy link
Author

tabnk commented Dec 30, 2015

List:
Start PC PC Stall State Started Interrupted
0x08CE7D00 0x08D2CB3C 0x08CE7D18 Running Yes No

@tabnk
Copy link
Author

tabnk commented Dec 30, 2015

Hope it help. :)

@unknownbrackets
Copy link
Collaborator

Thanks. Those UVs definitely look questionable. If this is when the red is highlighted, it makes me think the vertices were written incorrectly somehow. The first one looks probably right, the rest look wrong.

-[Unknown]

@hrydgard
Copy link
Owner

Hm, if the vertices are written wrong, that would likely be a VFPU bug.. I thought we flushed most of those out by now though. Maybe some kind of int to shorter int conversion is not saturating properly, or similar..

@tabnk
Copy link
Author

tabnk commented Jan 2, 2016

Is the shadow issue fixable ?

@unknownbrackets
Copy link
Collaborator

Hmm, I'm not sure now... the vertices can't be that wrong, because the preview is drawing them in the right place... right?

Anyway, it's also possible this might be depth related. Does this behave the same in OpenGL and Direct3D in the latest git build?

-[Unknown]

@tabnk
Copy link
Author

tabnk commented Apr 26, 2016

Same issue for both OpenGL and Direct3D

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented May 9, 2018

Notes for self: tex=0x0907af00, verts=0x08d8f520. Written by 0x089383D8 at 0x09FFABD0 -> copied from 0x09FF7BD0 -> copied from 0x09FFDBF0. That's written by 0x0893A358.

Software renderer gets this wrong too. And lots of other things...

It's the same across all backends and with jit enabled or disabled. UVs are definitely wrong, but haven't dug into why.

0x0893A16C vtfm2.p C300, E400, C010 -> This is always resulting in a 0 result pair, which gets multiplied by (0.5, 0.5) and then has (0.5, 0.5) added to it. Clearly this is not expected to result in zero - either the inputs are wrong, or the operation is wrong.

The E400 matrix largely comes from 0x08AAA9C0 which seems to always be 0 and isn't written to. Seems to be in bss. Not seeing anything else relocate it...

-[Unknown]

@unknownbrackets
Copy link
Collaborator

Just to confirm this is somehow RAM or CPU related: a GE dump of the wrong shadows renders the shadows wrong on a real PSP too. It's possible there's something the dump isn't reproducing, but most likely it's CPU emulation or RAM transfer/cache/etc. related...

-[Unknown]

@tabnk
Copy link
Author

tabnk commented Apr 23, 2019

Doesn’t matter.

@tabnk tabnk closed this as completed Apr 23, 2019
@unknownbrackets
Copy link
Collaborator

Hmm, I'm pretty sure this bug still exists.

-[Unknown]

@Panderner
Copy link
Contributor

Same happens on latest version

@ShlomiToren
Copy link

Still in 1.11.3 BTW.

@Panderner
Copy link
Contributor

Panderner commented Jun 13, 2021

These versions are affected by shadow glitch:
USA (UCUS98743)
Asia (UCAS40266)
Korea (UCKS45124)
Japan (UCJS10104)

Europe Version (UCES01250) is the only version does not have Shadow Glitch.

@hrydgard
Copy link
Owner

That's really interesting that it's game version dependent! We don't seem to have any compat.ini hacks that could be missing version IDs....

@maxwell-kalin
Copy link

Any updates on this?

@Panderner
Copy link
Contributor

Also happens in software renderer:
UCUS98743_00000

@unknownbrackets
Copy link
Collaborator

Just to confirm this is somehow RAM or CPU related: a GE dump of the wrong shadows renders the shadows wrong on a real PSP too. It's possible there's something the dump isn't reproducing, but most likely it's CPU emulation or RAM transfer/cache/etc. related...

Right, as I said, this isn't really renderer related. Something is funny with the drawing the game triggers. I guess it could even be a tricky VRAM mirror thing like Silent Hill.

For reference, here's a frame dump (edited to remove the bloom, to be sure it isn't overwriting the PSP drawing) and what it looks like on a PSP:
#7552_UCUS98743_motorstorm_abnormal_shadow_edit.zip
#7552_UCUS98743_motorstorm_abnormal_shadow_edit

It's still unclear what's happening here but it seems to be related to something on the CPU, not actual rendering.

A cheat to get rid of the shadow could write the following:

0893A16C D007008C 	vone.p	C300
0893A170 D007008D	vone.p	C310
0893A174 D007008E	vone.p	C320

As a hack, which would at least make the shadows not show at all. Equivalently, you could force the values in memory it's reading (this will also just disable shadows, though):

0x08AAA9C0 0x3F800000
0x08AAA9C4 0x3F800000
0x08AAA9C8 0x3F800000
0x08AAA9CC 0x3F800000

I'd be curious to know if the Europe version has similar code, US looks like this originally:

0893A16C F081308C	vtfm2.p	C300,E400,C010
0893A170 F082308D	vtfm2.p	C310,E400,C020
0893A174 F083308E	vtfm2.p	C320,E400,C030

The operation of this instruction is:

d[N] = s[N*m .. N*m + n-1] dot t[0 .. n-1]

vtfm2.p	C300,E400,C010 means
S300 = [S400, S410] dot [C010, C011] = S400 * C010 + S410 * C011;
S301 = [S401, S411] dot [C010, C011] = S401 * C010 + S411 * C011;

But E400 is all zeros. And as noted, that matrix is loaded from memory at 0x08AAA9C0 (this occurs at 0x0893A028), which starts its life as all zeros and doesn't change. So bit of a mystery what's supposed to fill it in.

-[Unknown]

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.

8 participants