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

BLUS30767 texture clamping issues #4133

Open
Nerboruto opened this issue Jan 31, 2018 · 30 comments
Open

BLUS30767 texture clamping issues #4133

Nerboruto opened this issue Jan 31, 2018 · 30 comments

Comments

@Nerboruto
Copy link

look at the attached picture

rpcs3 2018-01-29 21-53-53

@Nerboruto
Copy link
Author

even the shadows flash in that place...

@kd-11
Copy link
Contributor

kd-11 commented Jan 31, 2018

Just looks like texture border issues. Also, this report is lacking alot of information. What renderer is that? What settings? Does it happen on both opengl and vulkan? Does strict mode affect anything? etc

@Nerboruto
Copy link
Author

opengl & vulkan on nvidia... 1280x720 scaling 100%.. monitor resolution 1360x768 + reshade custom scanlines. reshade & strict mode is irrelevant. the shadows become darker and blink.
tested on 2 different nvidia PCs only at that point in the game.
around the branches of the tree there is a black outline that appears
during the scrolling of the backdrop the problem tends to disappear and reappear and the shadows become more darker.

I would also have a suggestion for scaling resolution.
approximate resolutions to 16 pixels multiple.
es: 1280x720 @ 107% =1369x770 rounded at 1360x768.

@Nerboruto
Copy link
Author

use gpu texture scaling is irrilevant. all options at default.

@Nerboruto
Copy link
Author

it seems more a problem of how shadows are rendered over background texture.
however I'm not sure.

@dio-gh
Copy link
Contributor

dio-gh commented Oct 10, 2019

Both the shadow flickering and the misalignment issues are still present as of RPCS3 v0.0.7-8852-e9ea226e Alpha. I couldn't capture the shadow flicker, but the misalignment I did manage to; see the RRC file attached below. Captured on VK, replayed on GL, happens on both. Stock settings.

image

RRC file: BLUS30767_20191011014102_capture.zip

Guide to the area on the picture

The area can be accessed after about 5-10 minutes spent ingame. I also chose an Amazon character, as I wasn't sure how different the playthroughs are for each character archetype.

You have to do a quick tutorial that teaches you how to move around, fight, and interact with your environment. This takes about 5 minutes at worst.

Then you'll be in the city and forced to join a guild, but probably have yourself rejected for unkept armor, sent to repair it, and then will you be allowed to join. This takes about another minute.

After this, you're sent out to help a guild member, that's when you'll be able to access the area on the picture, called Gate. Once there, go a bit left, and there you are.

@digitaldude555
Copy link

@Nerboruto update.

@Nerboruto
Copy link
Author

Nerboruto commented Feb 21, 2020

the problem is here...

@kd-11 kd-11 self-assigned this May 8, 2020
@kd-11
Copy link
Contributor

kd-11 commented May 8, 2020

Need a new RSX capture, the one attached here is incompatible with current rpcs3.

@Nerboruto
Copy link
Author

@Nerboruto
Copy link
Author

VID_20200508_230519.zip
shadows flikering

@13xforever
Copy link
Contributor

RenderDoc 1.7 captures on current build 10398
I got four frames with various characters flickering, and most of them have texture alignment issues in the background sprites

@kd-11
Copy link
Contributor

kd-11 commented May 17, 2020

This is not caused by shadows or anything like that its a combination of factors. Unfortunately modern hardware does not behave the same way as a GPU from 20 years ago and some of the techniques this game is relying on are not present on modern cards anymore.
The borders are part of the artwork. You can see them in this pic (alpha channel isolated):
image
But that's not all, if you zoom in closer, you get a better idea of where the line truly comes from:
image
This is a compressed texture, so there is some 'bleeding' over the edges of alpha vs no alpha along with some banding due to low bit compression. So how does the game sample this texture? It uses the old-school coordinate clamp technique which no longer exists for over a decade (GL_CLAMP). From spec they just say "it clamps the coordinates to [0-1]" but I know that's not the whole story, it does some other fuckery too depending on the hardware. We can only enable this on old OGL v2 which has been obsolete since 2008. Rpcs3 has a workaround for this with GL_CLAMP_TO_EDGE, but its not the exact same behavior.
Whether the alpha border texels are decoded differently on a G70 class GPU is unknown, but not entirely out of the question either. But from what I can see, rpcs3 is doing the best it can with what we have to work with.

@kd-11 kd-11 added Render: OpenGL Render: Vulkan Won't Fix Workaround To be fixed properly in the future. Discussion and removed Bug Need Information RSX Won't Fix Workaround To be fixed properly in the future. labels May 17, 2020
@kd-11 kd-11 changed the title BLUS30767 pixel alignment or texture alpha problem BLUS30767 texture clamping issues Jun 5, 2021
@Bertue
Copy link

Bertue commented Feb 15, 2022

Well, the transparent graphical errors of the paintings plus the cup in the menu in the RPCS3 game of Dragon's Crown continue to happen to me!

screenshot_20220215_100727

screenshot_20220215_101244

@dante3732
Copy link

Same, still not fixed.

@Bertue
Copy link

Bertue commented Jun 8, 2022

I already get angry about this issue but still no case for these 2D games like Dragon's Crown or Odin Sphere to fix the problems they have even knowing that it says they are 100% playable without technical problems or graphic bugs and they continue the same with errors I don't know What are you waiting for to solve it once and for all for the good and entertainment of the users of the Rpcs3 emulator with how beautiful those games really are!

@Peduls
Copy link

Peduls commented Jun 8, 2022

Seems like a duplicate of #9150

@Bertue
Copy link

Bertue commented Jun 8, 2022

If I think that the solution would be to expand the bilinear texture for the first time for 2D games like these, well, the kd-11 knows more about it, let's see what will be done sooner or later, but it will be less, I suppose, to be able to eliminate these absurd bugs of the Rpcs3 emulator and everyone is happy.

@Peduls
Copy link

Peduls commented Jun 8, 2022

Being hostile and impatient towards the dev team won't help get this bug fixed any sooner. If anything it'll make them not want to help you. I am very eager for the issues in Dragon's Crown and Odin Sphere to be fixed as well, but I'm not a jerk about it.

@Bertue
Copy link

Bertue commented Jun 8, 2022

I made a mistake, I recognize that I shouldn't have rushed, I'm sorry, when it has to happen, let it happen, please.

@Bertue
Copy link

Bertue commented Jun 9, 2022

Well, I think it is very difficult to fix these graphic bugs and more of old 2D games like these in the RPCS3 emulator and I have already seen why they fail due to the problem of OpenGL version 2.3 for much older computers that do not incorporate it and Vulkan I think that it does not reach him until they release some version of VK something that I have not seen at least that even if this kind of complicated fastening textures will work to solve the graphical errors of these two games because it is not even known what solution it has for what The texture clamping error would no longer exist in both Dragon's Crown and Odin Sphere because we have to thank those of Rpcs3, which is much better than the Vita3k emulator, which already works with those two games too, and they are much worse because of how green they are. is that emulator still!

@Bertue
Copy link

Bertue commented Jun 27, 2022

Ogl bringup 4 #12284
I wish I could fix the few graphical glitches that both Dragon's Crown and Odin Sphere have, but I doubt it so soon yet.

@shinra-electric
Copy link
Contributor

This should be fixed.

Screenshot 2023-05-26 at 16 25 52

@13xforever
Copy link
Contributor

it's not fixed, and as kd explained before, the actual fix won't be easy or performant
image

@shinra-electric
Copy link
Contributor

Ah, ok. I didn't realise it was a specific area. I can reproduce.

Screenshot 2023-05-26 at 16 51 32

@kd-11
Copy link
Contributor

kd-11 commented Dec 24, 2023

Earlier this year I submitted some work that supports custom clamp algorithms (#14104)
I think we can now tackle this one in software as we have a pipeline to do it. I need a save file though and instructions how exactly to reproduce it (basically eli5)

@13xforever
Copy link
Contributor

You can reproduce all the issues from the beginning, it doesn't take much time to go through character creation and get to the tavern.

After you load save, leave the tavern and go all the way to the right, then exit through the Gate, and that's it.

On the first actual dungeon (Ancient Temple Ruins / Boss: Harpy Lv 1) if you go most of the way to the boss, there's a section with drowned ruins and a couple of lizard enemies where you could reproduce disappearing sprites (if you go too far right, you start the boss fight). But I think this was fixed already.

dragon's crown save.zip

@kd-11
Copy link
Contributor

kd-11 commented Jan 16, 2024

I finally got some time to look into this.
The game has a weird rendering setup and basically renders everything as tiles. The inputs are chunked and stitched together into texture atlases. This is fine, but introduces some 1px borders all over the place.
The borders are actually invisible, and are caused by a blending setup error. The developer set up the blend equation as S.src_alpha + D.(1 - src_alpha) for both color and alpha which is almost never what you want. However, the output is typically never sampled so nothing bad happens.
However, sometimes, to render special effects or menus, etc, the game can decide to duplicate a frame and resamples the previous frame. This is where everything falls apart, because now the alpha channel which is ignored normally is now relevant.

So, why doesn't this appear on PS3? Because they picked a special PS3 output format that erases the alpha channel. In rpcs3 this is implemented using a special mask when reading. However, the mask does not propagate properly when data is being copied around so we lose track of the "throw away the alpha" flag and we end up rendering the seams.

A fix is trivial, but unfortunately comes with a shader cache version bump. This also explains the weird issues observed in #9150

@kd-11
Copy link
Contributor

kd-11 commented Jan 16, 2024

Hmm, I'll try and come up with a less intrusive stop-gap solution for now.

@peilong-du
Copy link

Is this related to the weird boxes that show up in shadow-y areas in the game?

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

No branches or pull requests