Commit Graph

43 Commits

Author SHA1 Message Date
Philip Rideout
6f601e6021 Update KTX files and allow glFormat = LUMINANCE 2018-12-06 10:33:49 -08:00
Sebastian Hartte
339483b8e2 Consider the correct KTX header attribute to determine the data format 2018-12-06 10:33:49 -08:00
Sebastian Hartte
cfa486275a Install the image library as well 2018-12-05 17:57:20 -08:00
Philip Rideout
af799e734a FilamentApp can now use KTX environments.
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).
2018-11-30 14:09:04 -08:00
Philip Rideout
7366bdb500 More KtxUtility improvements.
This makes it easier for C++ clients to use KTX files and simplifies
the JavaScript bindings.
2018-11-30 13:16:47 -08:00
Philip Rideout
bcfe03c8e1 KtxUtility improvements.
This makes it easier for C++ clients to use KTX files and simplifies
the JavaScript bindings.
2018-11-29 16:39:30 -08:00
Philip Rideout
ee5b0268fd Introduce KtxUtility to make it easier to translate enum values. 2018-11-07 16:12:55 -08:00
Ben Doherty
29119c7248 Add iOS support to Filament (#360) 2018-10-18 12:42:13 -07:00
Philip Rideout
06fc8e2f4c Add compression support to cmgen. 2018-10-08 09:25:09 -07:00
Philip Rideout
23efe17380 mipgen: fix dark miplevels in normal maps.
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].
2018-10-04 14:28:44 -07:00
Philip Rideout
551fe7ef8b Suzanne now uses LINEAR_MIPMAP_LINEAR. 2018-10-04 08:02:53 -07:00
Philip Rideout
cc61e4649b Add ETC support to mipgen / imageio / suzanne.
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
```
2018-10-02 21:57:22 -07:00
Philip Rideout
3ad0574878 Add ASTC support to Suzanne. 2018-10-02 07:46:51 -07:00
Philip Rideout
3185d0f237 Add S3TC support to imageio and Suzanne.
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.
2018-10-01 14:34:21 -07:00
Philip Rideout
462f55e2b4 Add KTX support to roughness-prefilter. 2018-09-25 15:56:12 -07:00
prideout
be04ea843c Fix test by add missing code to recent commit. 2018-09-25 12:54:00 -07:00
Philip Rideout
fc7b5872a0 Add metadata support to KtxBundle.
The KTX spec allows for arbitrary key-value pairs, we are interested in
using this to stash spherical harmonics coefficients.
2018-09-25 11:53:48 -07:00
prideout
3c59ed2c4b Fix bad size in KTX reader. 2018-09-21 10:45:51 -07:00
Philip Rideout
46b99b7565 KtxBundle now uses contiguous memory for blobs.
This will make uploading KTX cubemaps to the GPU easier and more
efficient.
2018-09-20 17:39:43 -07:00
Philip Rideout
01590fde91 Combine some ColorTransform funcs with a template.
Tested this with "./build -u" and mipgen.
2018-09-19 12:28:50 -07:00
Philip Rideout
14e1bbdf3d Add --linear to mipgen. 2018-09-19 12:28:50 -07:00
prideout
52ee8e570d mipgen can now generate KTX files.
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.
2018-09-18 12:42:47 -07:00
Philip Rideout
21906a1096 Simplify KtxBundle by using unique_ptr. 2018-09-14 16:55:05 -07:00
Philip Rideout
e4b60e47cb Introduce KtxBundle to libimage and add unit test.
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.
2018-09-14 16:55:05 -07:00
Philip Rideout
1dbe386268 Add WebAssembly to the build. (#145)
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.
2018-08-24 17:18:12 -07:00
Ben Doherty
255b6a903c Fix Windows build (#137) 2018-08-24 10:35:21 -07:00
Philip Rideout
aa518369b4 Move deprecated Image out of libs. (#125)
This moves the old Image class into cmgen because it is the only client
that still uses it. We can migrate cmgen to LinearImage in the future.
2018-08-23 10:19:02 -07:00
Philip Rideout
e45e7b256d Introduce mipgen frontend. (#120)
* 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.
2018-08-21 17:54:27 -07:00
Philip Rideout
07e4db795f Remove lots of reinterpret_cast. (#112)
* Remove lots of reinterpret_cast.

* Improve terseness with auto.
2018-08-17 12:01:32 -07:00
Philip Rideout
044387308a Migrate imageio to LinearImage. (#111) 2018-08-17 11:22:05 -07:00
Philip Rideout
6d9668ccf6 Add unit test for cross cube images. (#101) 2018-08-15 15:36:17 -07:00
Romain Guy
65a42a518c Add material_testbed application (#97)
* 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
2018-08-14 18:01:31 -07:00
Philip Rideout
5a027ca5a2 Replace deprecated color xform funcs. (#96) 2018-08-14 15:19:40 -07:00
Philip Rideout
b5b90b83f8 Add test_cmgen and promote the "updateOrCompare" function. (#95) 2018-08-14 13:47:31 -07:00
shartte
e6d5a85ec8 clang-cl warning fixes (#83)
* Disable certain MSVC-specific deprecation warnings

* clang-cl.exe warning fixes
2018-08-14 12:55:04 -07:00
Philip Rideout
acffdb328a Fix release-only warnings. (#88) 2018-08-13 15:26:51 -07:00
Philip Rideout
1f380a6ec6 Introduce new image library, Phase I. (#80)
* 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.
2018-08-13 10:39:57 -07:00
Philip Rideout
07c34ee833 Simplify Image by flipping RADIANCE images. (#63)
* Simplify Image by flipping RADIANCE images.

Unit test for the new flip() method is forthcoming.

* Optimize image flipping.
2018-08-09 17:30:17 -07:00
Philip Rideout
69b65d9e2d Rename ColorSpace header to ColorTransform. (#61) 2018-08-09 15:54:18 -07:00
Philip Rideout
9ed20705ec Refactor color space utilities. (#58)
* Refactor color space utilities.

* Repair Android build.
2018-08-09 13:58:58 -07:00
Philip Rideout
f8a8098e0f Split off imageio lib from image. (#36)
* Split off imageio lib from image.

* Remove duplicated math funcs.
2018-08-07 16:38:04 -07:00
Rich Wareham
a9153d9ce1 libs/image: fix structure-packing pragma warning
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
2018-08-04 09:47:01 -07:00
Romain Guy
b3d758f3b3 Initial commit 2018-08-03 10:38:22 -07:00