Skip to content

Slow texture indexing/color swapping (slowdown on zoom-in) #2

@mnemoli

Description

@mnemoli

Godot has no support for indexed textures or shader arrays. Because of this, the frag shader works out the index of each color by looping over a palette texture and selecting the x value of the color which most closely matches the texture color. This is a 'good enough' solution for modern graphics cards but causes extremely poor performance on older machines.

Goost has indexed image support https://goost.readthedocs.io/en/latest/classes/class_imageindexed.html#class-imageindexed
The only really necessary bit is being able to get index_data.
Possibly generate a new image+texture from the indexed data to get around not being able to pass a raw array.

Note some textures like LWH don't use the actual petz palette and the game appears to be forcing the palette on them using nearest color matching. I did support this in the existing frag shader but if this turns out to be a pain I could drop it again for now.

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