Skip to content

Blurry icons with Texture Quality set to Medium #5

@hexabits

Description

@hexabits

This happens with Texture Quality when it is not on High

Blurry
This doesn't appear to happen to any other mods' atlas sprites, just Prop/Tree Anarchy's. My friend and I both had this issue, so I investigated it and found that other atlas helpers such as MacSergey's use a different method of loading textures from assembly, and his method appears to have fixed the issue for me:

Fixed

I modified UIIndicator.dll to do this instead:

private static Texture2D LoadTextureFromAssembly(string filename)
{
	Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("UIIndicator.Icons." + filename);
	byte[] array = new byte[manifestResourceStream.Length];
	manifestResourceStream.Read(array, 0, array.Length);
	return new Image(array).CreateTexture(); // Image is from ColossalFramework.Importers
}

This is also an issue for the resources loaded from PropAnarchy assembly:
PLT

I applied the same change to LoadTextureFromAssembly in PropAnarchy.dll, but it seems to break the icons (while still fixing the resolution):
PLT-fixed

Unfortunately this is because Image().CreateTexture() does not appear to support PNG8, which most of the icons in PropAnarchy.dll are. The PNG images in UIIndicator.dll are PNG32, so they do not have this issue. I've confirmed re-saving the PNG as PNG32 fixes the issue, though I only converted a few.

The PNG8 get loaded into Unity as ARGB32 anyway, so there is not really any benefit other than a few less KBs DLL size. (And the drawback of worse looking colors)

Maybe you can find a way to keep them as PNG8 but fix the resolution issue, if you want. I don't have the original full-color PNG sources nor the UIIndicator repo, so I didn't just make this a pull request.

Also, this doesn't seem to have any relevance or effect on anything, but CreateTextureAtlas in UIIndicator has uitextureAtlas.AddTextures(array); whereas the CreateTextureAtlas in Prop/Tree Anarchy do not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions