ppsspp icon indicating copy to clipboard operation
ppsspp copied to clipboard

Water reflections in Flatout head on

Open marosis opened this issue 7 years ago • 15 comments

What happens?

screenshot_20180909-114746

What hardware, operating system, and PPSSPP version? On desktop, GPU matters for graphical issues.

Tested on android OpenGL with HW transformation-ON. Dont know if this issue have vulkan or dx

marosis avatar Sep 09 '18 10:09 marosis

Never fixed yet

marosis avatar Sep 09 '18 10:09 marosis

Could you try exporting a GE debugger dump on PC?

To do this, open the game and select Debug -> GE debugger..., then when it's displaying the scene, press Record in the top right. After a second or so, it'll finish and save a trace of the drawing activity.

After that, check the memstick/PSP/SYSTEM/DUMP folder and it'll have created a file named something like "ULES12345_0000.ppdmp". You can zip that and then drag and drop it into a reply here.

-[Unknown]

unknownbrackets avatar Sep 09 '18 14:09 unknownbrackets

I tried to reproduce the error on Windows version. No issues.

ppmeis avatar Sep 24 '18 20:09 ppmeis

Is this still an issue ??

benderscruffy avatar Sep 04 '22 11:09 benderscruffy

Still the same opengl+vulkan

marosis avatar Oct 01 '22 16:10 marosis

A frame dump would be useful as unknown says above, full instructions: https://github.com/hrydgard/ppsspp/wiki/How-to-create-a-frame-dump (then just zip up and drag into your github post)

Additionally, a screenshot with the software renderer enabled could be enlightening, or from hardware.

hrydgard avatar Oct 01 '22 16:10 hrydgard

Uploading Screenshot_2022-10-02-21-00-57-564_org.ppsspp.ppsspp.jpg… Software render is the same as HW

marosis avatar Oct 02 '22 19:10 marosis

So what does it look like on actual PSP hardware?

hrydgard avatar Oct 02 '22 19:10 hrydgard

I'm sending dump or atleast i think it's dump

marosis avatar Oct 02 '22 19:10 marosis

ULES00968dump?.zip

marosis avatar Oct 02 '22 19:10 marosis

Am i did it right?

marosis avatar Oct 02 '22 19:10 marosis

I've found some pixelated footage on youtube bcs i don't have psp anymore. With some imagination you may see, the water should be transparent Screenshot_2022-10-02-21-29-37-114_com google android youtube Screenshot_2022-10-02-21-29-08-344_org ppsspp ppsspp

marosis avatar Oct 02 '22 19:10 marosis

You can see part of the boat visible under water

marosis avatar Oct 02 '22 19:10 marosis

That frame dump does show transparent water (from a PSP): #11376_ULES00968_flatout_water

Doesn't look like water I'd want to drive through, haha, but let's see.

-[Unknown]

unknownbrackets avatar Oct 02 '22 19:10 unknownbrackets

Draws the ground and sky, then gets to a shadow of the vehicle at 745/1768 (which looks fine, at least in software.) At this point, depth is mostly near 1, but around 0.75 in the near direction, and stencil is zero.

Next it draws the vehicle and some objects and trees, up until 1137/1768. Depth has the vehicle closer, but still pretty standard. Stencil still zero.

This water is drawn using a positions only vertex type, texturing + alpha blend + depth test. The alpha blend is standard, src.a + (1 - src.a) and depth test is < (i.e. water closer than ground, makes sense.) Texture uses modulate and linear/mipmap linear between 4 levels (standard halving, similar colors and alpha.) Alpha is generally between 60-80. Dither off, fog off, no RGBA write mask. Texture is 8888 (CLUT8) and target is 5551.

Lighting is off, but in case it matters the update flag is set to ambient/diffuse. Material ambient is fbcdcd, and alpha is ff. The ambient color (used for lighting) is 464141, but its alpha is also ff.

After this draw, software already looks like this (personally I think it looks less ugly, but alas it's wrong apparently): Very blue water

Hardware is even darker for some reason, at: Darker blue water

Later, at 1522/1768 it draws an interesting texture from the rendered scene: Perspective around vehicle

For some reason at ~1624/1768, the colors look really weird in hardware but fine in software. This is where it applies that, changed to a bloom texture. This brightens the final water a bit more.

Filtering to 1-1138 gives the water pre-bloom. Maybe there's copying affecting the PSP playback. Here's it filtered similarly: #11376_ULES00968_flatout_water

So even before the bloom, it looks much less harsh. Ground looks about right just before that draw, too.

The previous draw (1136/1768) includes color, ee776655, which wouldn't help even if it were somehow reused instead of material color/alpha.

It does use texture matrix generation (based on positions), and has UV scale/offset set (which I don't think apply in that mode.) Uses a -8 mip bias, but doesn't seem like it'd matter. The water texture is in RAM and not rendered.

I wonder how it's supposed to be more transparent...

-[Unknown]

unknownbrackets avatar Oct 02 '22 20:10 unknownbrackets

As a quick test, I tried enabling depth write on this draw. Here's what software drew: Closer looking water

Hardware is similar, although it has more and darker patches of water that way.

Now for another test: disabling depth clamp/clipping in software for just that one draw: Very dirty water

This looks almost exactly right. Hardware still gets the water bluer, but it looks much better: Less dirty looking water

Digging deeper, if I turn off near clipping bad things happen. But if I target it just to that draw: Looks about right

So clipping is causing problems here... and yes. It's another triangle inversion. Each time it clipped (in this case), one or more original vertices had a negative w, and the resulting vertices are ending up with always positive w. This is happening to hardware rendering as well, in a visible way. I think it's harsher because of 8888 vs 5551.

That means this is similar to the issue noted in #16207 and #15875, linking #16131 as well. But this one is visibly wrong in hardware rendering as well (not surprising.) Clipping against w >= 0 would not help here.

-[Unknown]

unknownbrackets avatar Oct 23 '22 15:10 unknownbrackets

I can confirm that water is now looking right in software rendering

marosis avatar Dec 02 '22 06:12 marosis

Fixing this in hardware renderers will be annoying. Should be pretty doable with a geometry shader, as long as we clip (or do some of the same math, at least) manually... we can't really decide to discard the points from the vertex shader, not accurately, anyway.

Now that I understand how all of this works, it's obvious that the vertex range primitive discard just always happens, and clipping only "skips" it by happening beforehand. But APIs don't want to clip beforehand...

-[Unknown]

unknownbrackets avatar Dec 02 '22 08:12 unknownbrackets