Thyme
Thyme copied to clipboard
Texture LOD corruptions
Issue explanation
Viewed in the WIP W3D viewer but since it uses game code to draw everything issue is likely in game code. Somehow manifest only on Gen Alpha w3ds.... ABDetCamp in video
Screenshot(s) or video
https://user-images.githubusercontent.com/1433426/162192946-0e8daf17-a710-4ad0-b141-5affc14e6f72.mp4
This seems to be an issue with the way we handle tga files. If I put abdetcamp.w3d and abdetcamp.tga and housecolor.tga from the Generals alpha into a folder and load them, I see differences in our viewer and the Rengeade viewer. If I take ABBtCmdHQ_D.tga from the alpha and rename it to abdetcamp.tga and view the files, I see differences in our viewer and the Renegade viewer.
But if I take abarfrccmd.dds from the retail game and rename that to abdetcamp.dds (with no abdetcamp.tga file existing) and load it, I see no differences in our viewer and the Renegade viewer.
The issue is likely in BitmapHandlerClass which is used to generate mip maps for tga files (but not for dds files since those have mip maps already)
After some further digging I am 100% sure the bug is in one of these functions: BitmapHandlerClass::Copy_Image BitmapHandlerClass::Read_B8G8R8A8 BitmapHandlerClass::Write_B8G8R8A8 BitmapHandlerClass::Copy_Pixel (either of the 2 versions) Scale_Bits
Have eliminated BitmapHandlerClass::Read_B8G8R8A8, BitmapHandlerClass::Write_B8G8R8A8, BitmapHandlerClass::Copy_Pixel and Scale_Bits since none of those are called in this case. Problem is in BitmapHandlerClass::Copy_Image.