When cmgen creates ktx files, it creates a pair: one with an _ibl suffix
and one with _skybox. This convention is now honored by FilamentApp.
Note that we already have several KTX environments in the repo, so you
can clone a fresh repo and do:
gltf_viewer --ibl={FILAMENT}/docs/webgl/pillars_2k DamagedHelmet.gltf
Note that we have several hundred files in samples/envs, we should
consider replacing those or copying the environments in docs/webgl
(which git would internally de-dup, due to content hashing).
When using GAUSSIAN_NORMALS, image::resampleImage automatically unitizes
its output. This means that clients (e.g. mipgen) need to ensure that
the source image is in [-1,+1] rather than [0,+1].
This shrinks file size as follows, although it seems to darken the
rendered result.
```
1398209 Oct 2 16:22 ao.ktx
699172 Oct 2 16:20 ao_etc.ktx
1398209 Oct 2 16:22 metallic.ktx
699172 Oct 2 16:19 metallic_etc.ktx
1398209 Oct 2 16:22 roughness.ktx
699172 Oct 2 16:20 roughness_etc.ktx
```
At build time, mipgen now creates several compressed and non-compressed
variants for albedo.
For ASTC we use the ARM encoder, for S3TC we use the STB encoder. The
latter is somewhat limited so we may wish to investigate other libraries
in the future (e.g., AMD Compressenator).
At run time, we detect which of these variants to download, based on
available WebGL extensions. In practice, this means that desktop
browsers will use the S3TC variant and mobile browsers will use the ASTC
variant.
The makes unzipped albedo go from ~4 MB to 682 KB using S3TC.
Mobile support (ASTC and ETC2) is coming in a future PR, stay tuned.
I tested the validity of the resulting KTX files by using macOS Preview,
which can read some types of KTX files. (!)
This CL also adds mipgen to the WebGL build, although its outputs are
not yet used by the sample apps.
KtxBundle is basically an in-memory representation of a KTX file.
Our primary motivation for introducing this class is to have a
structured container for block-compressed textures.
Note that this class is defined in libimage rather than libimageio.
There are several reasons for this:
1. The texel data in a KtxBundle is not meant to be decoded by the CPU.
2. It has no dependendencies on any libraries (stb_image tinyexr etc).
3. We wish to use it with WebGL, which needs to avoid using imageio.
This does not add any samples or continuous integration, but it at least
allows developers to do a "-p webgl" and check if an actual wasm file
for the core Filament library can be succesfully built.
* Introduce mipgen frontend.
For now this is fairly simple although it does let you choose a filter.
Another cool feature is that an HTML file is generated which makes it
easy to review the generated miplevels.
This does not expose the Boundary enum to users because it has not yet
been implemented in the core Image library.
* Fix up mipgen per code review.
* Add material_testbed application
This application can be used to automatically vary material parameters over multiple frames and capture each frame as a PNG file. This makes it easier to test/compare/etc. It's also useful to generate documentation examples.
* Rename material_testbed to frame_generator
* Overhaul the image library, Phase I.
The preps for our upcoming mipgen command line tool by adding filtering
capabilities and unit tests for a new LinearImage class, which will
subsume Image (deprecated).
Filament's new image library is composed of three components:
- LinearImage....simple 3D tensor of floats
- ImageOps.......free functions for simple transforms
- ImageSampler...high quality filtering
The old Image class was a simple untyped data blob and is now
deprecated. The new LinearImage class is always float32, and always
stores pixels in packed scanline order. This makes it easier to
implement image-based algorithms because they can be agnostic of the
underlying format.
Remaining refactorings:
- Phase II will migrate imageio to LinearImage
- Phase III will migrate all downstream tools to LinearImage
- Phase IV will remove old the Image class
* Image library code review feedback.
When compiling with clang on Linux, the following warning is generated:
../../libs/image/src/ImageDecoder.cpp:487:13: warning: unterminated '#pragma pack (push, ...)' at end of file [-Wpragma-pack]
#pragma pack(push, 1)
^
According to [1], the correct pragma to pop the packing state from the
internal stack is "#pragma pack(pop)" rather than "#pragma pop()" which
is used currently. This commit replaces "#pragma pop()" with "#pragma
pack(pop)".
[1] http://gcc.gnu.org/onlinedocs/gcc-4.2.3/gcc/Structure_002dPacking-Pragmas.html