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

Tiles drawn with white pixels #139

Open
collinsmith opened this issue Jan 20, 2021 · 4 comments
Open

Tiles drawn with white pixels #139

collinsmith opened this issue Jan 20, 2021 · 4 comments

Comments

@collinsmith
Copy link
Owner

collinsmith commented Jan 20, 2021

Noticed this issue on the latest version of Android where the 0 index on tiles shows up as white, even though glClearColor is set to black. Only occurs on acts 3-5 so far from what I've seen. This did not used to happen on older versions of Android, and does not occur on PC.

Tiles have always been drawn incorrectly where index 0 is transparent, and since the background is black and index 0 is black, it hasn't mattered, but something with the newer OpenGL ES may be effecting this behavior. I have a special draw setting for tiles that should draw index 0 as black, it might not be enabled, or the palettes might need to be looked at. Another possibility is the transparency draw call, i.e., are the tiles being drawn on the newer version of android as opaque, causing white pixels because it can't blit them correctly.

Screenshot_20210119-160529_Riiablo

@collinsmith
Copy link
Owner Author

I spoke too soon. The issue appears in all acts, just much less noticable. aside from the background color not matching black like on desktop, this looks like an index is mismatched. need to look into the specific index and pixel shader

@collinsmith
Copy link
Owner Author

Experimented using different blend mode and still got the same behavior.

@collinsmith
Copy link
Owner Author

collinsmith commented Jan 24, 2021

Playing with the palettes directly shows that this appears to be an issue with index 254 across at least act 1 and 3 (the only ones that I've tested). The working assumption is that for some reason this value gets rounded up to index 255, which is white. Going to play around with texture filtering and wrapping and if need be, clamping the 0.5f offset to prevent a possible unwanted rounding because 254 is close enough to 2^8 (256).

@collinsmith
Copy link
Owner Author

Texture filtering looks alright -- I assigned the renders to the default values. My guess is that this is caused by some rounding issue relating to the pixel (frag) shader for the upper index. This will require more extensive investigation to a more permanent suitable fix, however in the meantime I've added a workaround to the shader to translate index 255 to index 254 which has had no apparent side effects (have not tested or looked for legitimate uses of index 255). I'm uncomfortable with this fix until I can figure out why this is happening in only newest version of android.

Index 255 is the same in every included palette (0xFFFFFF). I'd like to look through all included files and see if it's ever actually used -- many palettes with a white color seem to define it elsewhere in their table -- so it may just not ever be used, or it has some other meaning like index 0, or acts as a signature/terminator for palettes. In any case, this appears to be suitable workaround until this can be explorer further.

collinsmith added a commit that referenced this issue Jan 25, 2021
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

1 participant