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

S3TC textures appear with bad artifacts #8550

Closed
ghost opened this issue Apr 26, 2017 · 6 comments
Closed

S3TC textures appear with bad artifacts #8550

ghost opened this issue Apr 26, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Apr 26, 2017

According to the current plans, Godot will require GL3.3 on desktop which doesn't mandate ETC texture support. Currently, only S3TC textures are used on desktop.

Current S3TC encoder can produce bad artifacts: (uncompressed vs VRAM for the 512x512 albedo texture, prepared in substance painter, from #8457)

yuxocz
cyv2qx

@ghost ghost changed the title S3TC encode produces bad results S3TC encoder produces bad artifacts Apr 26, 2017
@ghost
Copy link
Author

ghost commented Apr 28, 2017

Godot currently uses an old version of libsquish, with a low quality setting (kColourRangeFit). The problem persist even with the latest version of libsquish (1.15), and using the best compression kColourIterativeClusterFit.

@akien-mga
Copy link
Member

Actually Godot uses the latest version of libsquish: https://github.com/godotengine/godot/blob/master/thirdparty/README.md#squish
But it's almost the same as the previous 1.14: fa2d5b9

@ghost
Copy link
Author

ghost commented Apr 28, 2017

I think I got the version number from a wrong place: this is the repository link from the original author's blog, and it adds stuff on top of what currently comes with Godot please ignore what I just said.

But using it it still doesn't solve the issue. I'm not 100% sure about this yet but it seems like the output of libsquish is fine, the problem is somewhere else in Godot.

@ghost
Copy link
Author

ghost commented Apr 28, 2017

So far I tried using squishpng (in sourceforge repo) on that texture, and it is indeed giving fair results at all quality settings. So it does seem like the problem is within Godot.

@ghost ghost changed the title S3TC encoder produces bad artifacts S3TC texture appear with bad artifacts Apr 28, 2017
@ghost ghost changed the title S3TC texture appear with bad artifacts S3TC textures appear with bad artifacts Apr 28, 2017
@ghost
Copy link
Author

ghost commented Apr 29, 2017

Within Godot, I confirmed that the generated S3TC is OK, so the problem is definitely somewhere else, possibly within the renderer.

This, however, led me to discover that Image::_decompress_bc isn't working. I added a image_decompress_squish function which wraps squish's decompressor, registered that and used that instead. Not sure why there is an alternative decompressor there. I'll submit a PR for that later on.

@ghost
Copy link
Author

ghost commented Apr 29, 2017

OK, found the problem: there is a typo on this line: _EXT_COMPRESSED_SRGB_S3TC_DXT1_NV should actually be _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV.
Things work good as expected.

I'll submit another PR for that.

I'll also make sure VRAM quality settings (introduced in #8548) effect the squish quality settings.

Just as a note to myself so that I won't forget it: Image::save_png` should be const.

@akien-mga akien-mga added this to the 3.0 milestone May 2, 2017
groscalin pushed a commit to groscalin/godot that referenced this issue Jul 15, 2017
libsquish, which is used to generate all S3TC textures, works only with RGBA textures.

Fixes godotengine#8550.
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

1 participant