Note that the WebGL build uses filameshio, but Android does not. Our
Android samples therefore do not yet understand the compressed format.
For web, I measured the before / after:
```
BEFORE: filament.wasm = 505796, suzanne.filamesh = 521476
AFTER: filament.wasm = 510915, suzanne.filamesh = 333489
```
Issue #558
This also adds it as a dependency to filameshio. This does not seem to
increase the size of the WebGL build even though filameshio is a
dependency, perhaps because we are not using it yet.
(1)
Generating the C file (only used for WebAssembly) causes slowness in the
build so this makes it into an option. Also, we were flushing too often,
which made it even slower.
(2)
Using "static" in a header was causing symbol duplication.
This adds a couple optional features:
1) Preserve file extensions when generating symbols.
This is useful to distinguish foo.vs from foo.fs
2) Append null characters to data blobs.
Useful when treating FOO_DATA as a C string.
This tool can be used to replace inc files for built-in materials. The
inc files are unfriendly to IDE's and do not extend to non-material
resource types such as baked texture data.
The tool aggregates a sequence of binary blobs, each of which becomes a
"resource" whose id is the basename of the input file. It produces the
following set of files:
resources.h ......... declares sizes and offsets for each resource
resources.S ......... small assembly file with incbin directive
resources.apple.S ... ditto but with different rodata name
resources.bin ....... the aggregated binary blob
resources.c ......... large xxd-style array (only for WASM)
We did an experiment to test the incbin directive on a variety of
platforms in PR #510.
This removes a lot of heap allocations/deallocations, and reduces
code size. Most improvements come from using CString and
StaticString instead of std::string and better using move
semantics.
Since we use this for decoding, this adds a dependency to the core
filament renderer which in practice is only used for Vulkan. However
this is a tiny library, so it's simplest just to always include it.
The next PR will add the actual compression / decompression code to
filaflat and filamat. Here are the preliminary results.
102K => 29K aiDefaultMat.filamat
102K => 29K aiDefaultTrans.filamat
21K => 5.0K bakedColor.filamat
22K => 5.2K bakedTexture.filamat
21K => 5.0K depthVisualizer.filamat
40K => 10K groundShadow.filamat
102K => 29K sandboxCloth.filamat
125K => 36K sandboxLit.filamat
126K => 36K sandboxLitFade.filamat
126K => 36K sandboxLitTransparent.filamat
109K => 31K sandboxSubsurface.filamat
21K => 4.9K sandboxUnlit.filamat
21K => 4.9K transparentColor.filamat
Both the "before" and "after" numbers are excluding non-Vulkan targets,
and I also changed our CMakeLists to build filamat instead of inc.
* Minor clean-ups
- fix a couple usage of std::function
- fix a couple usage of std::string
- remove ALIGN_LOOP, which didn't work
- fix a couple explicit/noexcept
- virtual -> override
* Fix spelling typos and other minor clang-tidy
- move UBO declarations in UibGenerator, i.e. next
to their Uniform Interface Block definition.
This should help forgetting to update one but
not the other.
- move UniformInterfaceBlock.h and SamplerInferfaceBlock.h under
private/filament/.
- do the same things for samplers
This change will allow the skybox use a compressed texture format.
For now, the old internal format "RGBM" is still honored, but in a
forthcoming change we will replace the enum with UNUSED.
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].
Due to an assertion in etc2comp, this unfortunately uses RGB8 instead of
RG11 but it still helps quite a bit (3.3 MB savings in the unzipped KTX
size).
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.
The compression API now takes block size instead of bit rate. Otherwise
it is quite possible for the encoder to generate a block size that is
not one of the valid block sizes that graphics API's can actually
consume.
this adds a new --type (-t) parameter that is
used to specify cmgen’s output.
faces: outputs cube maps separate faces (default
and current behavior)
equirect: outputs an equirectangular image
ktx: outputs a ktx file
--format=ktx now implies —type=ktx
This was designed as a standalone tool rather than a library, so we are
renaming their "main" function to "standalone_main", which is described
in the tnt README.
We'll also be adding a wrapper to our imageio library.