271
Projects, demos, and games Information / Re: STICKY: 2020 King's Field II port progress report
« on: September 09, 2020, 12:59:42 PM »
Yesterday I tried (for a second time) to change the behavior of the "Bilinear" filter mode since it's pretty much useless. I would like it to keep the pixel look like the Point mode up close but do normal filtering from a distance, but this is impossible it seems (maybe it works on Nvidia drivers sometimes) without doing something radical in the shaders.
So I tried to hack something (for a second time) by forgoing anisotropic filtering and dynamically adjusting the mipmap sampling bias, but to no avail. In the process, in the aftermath really, I thought it might be simple enough to enlarge the textures in video memory, just for games with texture's like KF2's.
When I started looking into it I remembered SOM already does something like this, so it turned out to be very easy. It's something that could've been done a long time ago except that it only makes sense for games with small pixel art style textures like KF2.
It's not the final goal I have in mind, but it's a good middle ground for the time being, until I can figure out a more high-definition approach to upscaling KF2's textures.
I chose to call this mipmaps_pixel_art_power_of_two, which can only accept 0, 1, or 2 to enable 1x or 2x or 4x texture enlargement.
I guess it's a very niche extension, but it's worth sharing that this will let the forthcoming demo use the do_anisotropy extension and present a middle ground between the Point filter mode that's like the PlayStation (but more shimmering because much higher resolution presentation) and is more of a curiosity, and the regular mipmaps/anisotropic filtering mode that is too blurry up close with the original textures.
I'm setting it to 1, and this definitely gives it a more "pixel art" vibe, but it's like the original's, except there is a soft halo around the pixels that you can get rid of with 4x upscaling if you want. You might even want to see it without upscaling, which removes the pixel chunkiness entirely.
But the reality is the upscaling helps to hide seems on the tiles where they don't quite line up, like on the sandy beach floor corners. This misalignment is in the original game, but you don't notice it so much since the textures aren't filtered. This will eventually let me focus on straightening out the seams in the UV coordinates before moving on to try to perfect the textures and remap some problem cases.
Right now there's even a problem with the MDL format because it can't wrap textures and it's stuck to 8-bit UV coordinates. So this makes it too difficult to export models with mappings that cover the entire UV map since that looks ambiguous without wrapping. I could fix this by analyzing the triangles, but I don't want to do that, so the result right now is I tend to just stay away from the edges of the texture with MDL work.
Ultimately I want to replace the geometry with MDO fiels that don't have these problems. In the meantime it's pretty much impossible to be seamless with MDL files. So I plan to double back at some point and focus on texture maps, but for now I'm just working as fast as I can, quick and dirty.
There's no shortage of problems in converting KF2's data to SOM. Yesterday I had to rebuild the floor and ceiling around the small fountain because it can't work the way it is in the original data. The bottom of the fountain is flush with the ground, and the hole in the center goes through the ground. I actually extended the drain clear through the lower level so you can't see it when looking down into the drain, something you can't do in the original since you can't climb onto things.
The PlayStation doesn't have a depth-buffer solution, so it's like every polygon is sorted by depth like transparent polygons have to be sorted when they overlap. For that reason it doesn't matter that it sits flush on the ground, or goes through the ground, since the fountain simply replaces the ground irrespective of detph.
So I tried to hack something (for a second time) by forgoing anisotropic filtering and dynamically adjusting the mipmap sampling bias, but to no avail. In the process, in the aftermath really, I thought it might be simple enough to enlarge the textures in video memory, just for games with texture's like KF2's.
When I started looking into it I remembered SOM already does something like this, so it turned out to be very easy. It's something that could've been done a long time ago except that it only makes sense for games with small pixel art style textures like KF2.
It's not the final goal I have in mind, but it's a good middle ground for the time being, until I can figure out a more high-definition approach to upscaling KF2's textures.
I chose to call this mipmaps_pixel_art_power_of_two, which can only accept 0, 1, or 2 to enable 1x or 2x or 4x texture enlargement.
I guess it's a very niche extension, but it's worth sharing that this will let the forthcoming demo use the do_anisotropy extension and present a middle ground between the Point filter mode that's like the PlayStation (but more shimmering because much higher resolution presentation) and is more of a curiosity, and the regular mipmaps/anisotropic filtering mode that is too blurry up close with the original textures.
I'm setting it to 1, and this definitely gives it a more "pixel art" vibe, but it's like the original's, except there is a soft halo around the pixels that you can get rid of with 4x upscaling if you want. You might even want to see it without upscaling, which removes the pixel chunkiness entirely.
But the reality is the upscaling helps to hide seems on the tiles where they don't quite line up, like on the sandy beach floor corners. This misalignment is in the original game, but you don't notice it so much since the textures aren't filtered. This will eventually let me focus on straightening out the seams in the UV coordinates before moving on to try to perfect the textures and remap some problem cases.
Right now there's even a problem with the MDL format because it can't wrap textures and it's stuck to 8-bit UV coordinates. So this makes it too difficult to export models with mappings that cover the entire UV map since that looks ambiguous without wrapping. I could fix this by analyzing the triangles, but I don't want to do that, so the result right now is I tend to just stay away from the edges of the texture with MDL work.
Ultimately I want to replace the geometry with MDO fiels that don't have these problems. In the meantime it's pretty much impossible to be seamless with MDL files. So I plan to double back at some point and focus on texture maps, but for now I'm just working as fast as I can, quick and dirty.
There's no shortage of problems in converting KF2's data to SOM. Yesterday I had to rebuild the floor and ceiling around the small fountain because it can't work the way it is in the original data. The bottom of the fountain is flush with the ground, and the hole in the center goes through the ground. I actually extended the drain clear through the lower level so you can't see it when looking down into the drain, something you can't do in the original since you can't climb onto things.
The PlayStation doesn't have a depth-buffer solution, so it's like every polygon is sorted by depth like transparent polygons have to be sorted when they overlap. For that reason it doesn't matter that it sits flush on the ground, or goes through the ground, since the fountain simply replaces the ground irrespective of detph.