qsb-dev / quantum-space-buddies

Quantum Space Buddies ( QSB ) is a multiplayer mod for Outer Wilds.
https://outerwildsmods.com/mods/quantumspacebuddies
GNU Affero General Public License v3.0
90 stars 22 forks source link

use shaders for skin colors #665

Closed JohnCorby closed 6 months ago

JohnCorby commented 6 months ago

currently, coloring skins are done via a different 2k texture per skin. not only did this almost double the file size of the mod, but required rewriting a part of how async loading worked to support loading it because sync loading caused too much lag.

the process for making these images is simple. nebula simply greyscaled the part of the image he wanted to tint, and then multiplied it with the tint color.

this is TRIVIAL to do with a shader, using a mask and partially greyscale image. if we cannot do that (because the existing shader is not Standard or otherwise has special behavior) then we can create the images at runtime on the cpu with setpixels.

we could keep the user facing section the same, and just have each setting map to a color (or potentially a set of colors, and then have the mask use multiple channels to filter which color goes where).

this would bump our texture usage down to just a single extra texture for the mask, alongside the now-greyscaled color textures. it should improve download and load times and we can revert the changes we did to the async loading system

JohnCorby commented 6 months ago

i forgot about face diffuse/normals, which account for the majority of the file size of the bundle