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

Problem with Mipmaps in ReVC #128

Open
shoddydev opened this issue Jan 1, 2024 · 4 comments
Open

Problem with Mipmaps in ReVC #128

shoddydev opened this issue Jan 1, 2024 · 4 comments

Comments

@shoddydev
Copy link

I'm running it on a PlayStation Classic which is a armv7 device similar to a raspberry pi 3. When I have the engine convert the textures to optimal format like this:
2023-12-24 02-31-16 mp4_snapshot_00 52 484

It would produce corrupt textures like this. It seems to be a mipmap problem:
2023-12-16 18-52-08 mp4_snapshot_01 37 931
2023-12-16 18-52-08 mp4_snapshot_01 43 325
2023-12-16 18-52-08 mp4_snapshot_29 33 479
2023-12-16 18-52-08 mp4_snapshot_29 39 169
2023-12-16 18-52-08 mp4_snapshot_29 44 310

Seems like when it's in closer view, it looks correct, but when at a further distance it is skewed like its going bigger instead of smaller or something
2023-12-24 04-18-08 mp4_snapshot_00 00 272
2023-12-24 04-18-08 mp4_snapshot_00 06 727

Originally I followed MastaG's solution of disabling the convert textures and having it use the stock gta3.img.
#71

This works however the game crashes often, like every 13 minutes. In this video clip it crashed 4 times in the span of 47 minutes
https://www.youtube.com/watch?v=Eyuo2HqkHb4

The PSC only has 1gb of ram so I assume maybe it ran out of memory. However i found a solution by using magictxd. basically I have it clear the mipmaps and reconstruct the IMG archives
Untitled

When I do this I am able to play for 2+ hours without crashing. Though it may still occasionally crash when there's a lot going on
https://youtu.be/dzQbEmjE-Qk

So I was wondering if there's a way to edit the source code so that it generates the mipmaps properly? My theory is that it's going in the opposite direction, like a negative value is going the opposite direction. I don't know anything about programming I'm just guessing

@aap
Copy link
Owner

aap commented Jan 1, 2024

My guess would be that the auto-generated mipmaps are buggy on that implementation of OpenGL.
You could try getting rid of this code and see if it fixes anything:

                        if(level == 0 && natras->autogenMipmap)
                                glGenerateMipmap(GL_TEXTURE_2D);

@shoddydev
Copy link
Author

shoddydev commented Jan 2, 2024

My guess would be that the auto-generated mipmaps are buggy on that implementation of OpenGL. You could try getting rid of this code and see if it fixes anything:

                        if(level == 0 && natras->autogenMipmap)
                                glGenerateMipmap(GL_TEXTURE_2D);

Sadly it still produce corrupt textures when I delete the code above. Got any other possible fixes? What's weird is Re3 and ReLCS convert textures and it has no issues

@klaymen1n
Copy link

Have you found the solution? I have the same one. It just crops mipmaps instead of downscaling. And only on gles

@sr-tream
Copy link
Contributor

sr-tream commented Oct 26, 2024

If this textures stores in DXT1, its may be produced by this bug:

librw/src/image.cpp

Lines 430 to 439 in 895556f

if(height == 2){
uint8 *s = src;
uint8 *d = dst;
for(x = 0; x < bw; x++){
flipBlock_half(dst, src);
s += 8;
d += 8;
}
}else
memcpy(dst, src, 8*bw);

flipBlock_half(dst, src);

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

No branches or pull requests

4 participants