Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditorImporterTexturePlugin to tweak how textures are imported #24381

Open
Zylann opened this issue Dec 15, 2018 · 1 comment
Open

EditorImporterTexturePlugin to tweak how textures are imported #24381

Zylann opened this issue Dec 15, 2018 · 1 comment

Comments

@Zylann
Copy link
Contributor

Zylann commented Dec 15, 2018

As discussed with @reduz on IRC, there could be a EditorImporterTexturePlugin API to allow tweaking the texture import process, and do things like changing how mipmaps are computed, before compression takes on.

The initial use case I have is the use of a splatmap with a repeating texture. Over the distance, it looks really bad:
image

I tried changing the bias of mipmaps, but it also looks bad, and for some reasons mipmaps don't converge to a single color:
image

So instead, I decided to blend towards a solid color, taken from the center of the highest mip. This looks a lot better:
image

Unfortunately, doing this has a pretty high cost, because it doubles the required texture fetches in a shader that already has a lot to do. So I figured out a very nice alternative would be to bake that color blend into the mipmaps themselves, resulting in that fix being free and nicely integrated.
Doing that requires to alter the texture importing process, and that's where such API would be needed.

Also, as @Calinou mentionned, there are other effects depending on custom mipmaps, mentionned here https://www.youtube.com/watch?v=exp1Yrxt50A (8:00)

And this could even make channel packing easier, which I currently achieve manually by making this plugin: https://godotengine.org/asset-library/asset/230

@Zylann
Copy link
Contributor Author

Zylann commented Nov 8, 2020

I'm coming back to this issue with yet another terrain-related use case.

I wish to make an importer for packed textures. This means the importer matches a special lightweight file type describing how channels are combined from various sources, along with a few extra operations, and then feeds the result to the regular StreamTexture import process.
Unfortunately, to do this I have to re-implement the entire texture importer in GDScript (and there is a LOT going on there, especially to handle VRAM formats), and yet it's incomplete because some functions are not even exposed.

Then I also need the same for TextureArray, which again requires a rewrite.

Perhaps this would end up as a proposal nowadays, however I'm running out of time to make one for now, until I get to the end of my journey...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants