Improve rendering quality of imported images#11
Merged
flibber-hk merged 4 commits intosilksong-modding:mainfrom Jan 2, 2026
Merged
Improve rendering quality of imported images#11flibber-hk merged 4 commits intosilksong-modding:mainfrom
flibber-hk merged 4 commits intosilksong-modding:mainfrom
Conversation
flibber-hk
reviewed
Jan 2, 2026
Member
|
Looks good other than the one minor comment |
This was referenced Jan 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR does two things to improve the quality of custom image assets when rendered in-game: prevents textures from generating mipmaps, and adds utilities for converting textures to the premultiplied alpha format.
First: Textures/sprites loaded with UnityHelper no longer generate mipmaps. The vast majority of image assets in Silksong don't generate mipmaps, so disabling mipmap generation for custom assets makes their appearance more consistent with existing assets when scaled up or down (for example, when the player changes their game's resolution).
For demonstration, here's a custom HUD asset shown at a lower in-game resolution. The top version has mipmaps turned on; the bottom has them turned off. Compare the clarity of the edges on the custom asset to those of the masks in the health bar.

Second: it adds two utility functions for premultiplying the alpha of an image, one for
Sprites and one forTexture2Ds. Usage is simplymyTexture.PremultiplyAlpha().Unity expects the alpha format of pixels in its textures to have be premultiplied; but many image editing programs export in straight alpha format instead. This causes a lot of imported assets to have a white tint in areas of partial transparency, or a slight white halo around their edges. This can be fixed by manually converting the color data to have the correct alpha format.
For demonstration, the same custom HUD asset; the top version with straight alpha, the bottom with premultiplied alpha. Notice the white artifacts around the edges when it's in straight alpha format. (Open image in a new tab for higher resolution)
