Commit Graph

105 Commits

Author SHA1 Message Date
Philip Rideout
55eaad9450 Add smol-v to third_party.
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.
2018-11-15 16:55:40 -08:00
Romain Guy
f1c2c39a3d Cleanup matc a little bit (#488) 2018-11-14 11:58:06 -08:00
Mathias Agopian
f8f24f492f minor typo / spelling / clang-tidy fixes (#468)
* 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
2018-11-08 11:50:00 -08:00
Mathias Agopian
912b301790 Try to bring some sanity to our UBO structures
- 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
2018-10-24 15:11:54 -07:00
Ben Doherty
0d709b6074 Add a few new nodes to Tungsten (#326) 2018-10-15 12:02:05 -07:00
Adrian Perez
6c66bc26e7 remove another instance of using namespace std (#354) 2018-10-09 01:51:41 +02:00
Adrian Perez
27a2d05c8a Remove 'using namespace std' (#352) 2018-10-08 20:41:08 +02:00
Philip Rideout
c6cef9ff9c NEW API: add RGBM flag to Texture.
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.
2018-10-08 11:33:06 -07:00
Philip Rideout
06fc8e2f4c Add compression support to cmgen. 2018-10-08 09:25:09 -07:00
Philip Rideout
da698f2e36 Add high level compression API to prep for cmgen integration. 2018-10-05 10:11:48 -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
37a42ee854 Enable ETC for Suzanne normal map.
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).
2018-10-03 12:35:34 -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
70a4c4f887 Add etc2comp to third_party. 2018-10-02 12:32:23 -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
Mathias Agopian
1748724826 Use “cubemap” instead of “faces”. Fixes #320. 2018-10-01 11:55:53 -07:00
Mathias Agopian
741b1a412d experimental: add octahedron output support
Octahedron output support for cmgen. use —type=octahedron.

This is still fairly experimental.
2018-10-01 11:49:29 -07:00
Philip Rideout
33e0e34aa4 Remove STB dependency from astcenc.
We give the encoder raw RGB data, so there's no reason to use its STB
functionality. This shrinks the lib footprint by a small amount.
2018-09-28 16:33:41 -07:00
Philip Rideout
395b3a398d Fix mipgen windows build. 2018-09-28 16:33:41 -07:00
Philip Rideout
b25e693f6b Add stb to mipgen license list. 2018-09-28 16:33:41 -07:00
Philip Rideout
6ed331d74c Add compression to mipgen and change bitrate to block size.
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.
2018-09-28 16:33:41 -07:00
Pixelflinger
fae92f2750 Equirectangular export support
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
2018-09-28 14:37:48 -07:00
Philip Rideout
ec31a55094 Add astcenc from ARM to third_party.
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.
2018-09-28 09:42:09 -07:00
Mathias Agopian
13e70f7afa fix typos that caused bilinear filtering in corners to be wrong 2018-09-27 21:45:21 -07:00
Mathias Agopian
cb34ab217b fix typo that could cause a crash 2018-09-27 20:11:27 -07:00
Mathias Agopian
4764eefafc improve cubemap bilinear sampling
We now handle all face corners correctly and
follow the OpenGL recommandation of averaging the
corners of all 3 adjacent faces.
2018-09-27 20:11:27 -07:00
Philip Rideout
462f55e2b4 Add KTX support to roughness-prefilter. 2018-09-25 15:56:12 -07:00
Mathias Agopian
09a753760c better cross conversion. Fix #283. (#302)
- internal cross storage is now always horizontal
  and seamless.

- source cross images are now always converted to
  internal format, conversion includes rescaling
  and sampling if scaling down.

- vertical cross is supported again

- fixes #283

- replace hardcoded constants
2018-09-25 15:40:19 -07:00
prideout
6f2455e7e3 Simplify KTX metadata. 2018-09-25 15:37:49 -07:00
Philip Rideout
6f09389d2f web / cmgen: use KTX metadata for sh coefficients. 2018-09-25 15:37:49 -07:00
prideout
1ca4fcadce Fix / simplify roughness-prefilter.
This tool was producing bad output for the monkey roughness map because
the monkey map has an (unnecessary) alpha channel, and the tool was
assuming that the source image has 3 channels.

This fixes that particular case and changes the tool so that it
operates on single-channel data instead of 3-channel data.
2018-09-25 14:54:31 -07:00
Ben Doherty
1360e8f558 Tungsten: Use blurry skybox for mesh preview (#301)
* Use blurry skybox texture for Tungsten preview

* Fix build error with GraphCompilerTest
2018-09-24 18:16:20 -07:00
Ben Doherty
13cb47eead Fix incorrect SPIR-V instructions (#297)
* Add shaders to a program and link

* Remove glslang scope

* Add call to link for preprocessor-only optimization

* Add comment
2018-09-24 16:34:50 -07:00
Mathias Agopian
3bf0d6a4ab document artifacts due to giving up mipmaps (#299)
* document artifacts due to giving up mipmaps

- also talk about lod remapping
- try to avoid to confuse alpha with roughness

* fix typos
2018-09-24 16:14:52 -07:00
Mathias Agopian
50d8240e67 improve equirectangular conversion
We use a better calculation of the number of
samples needed for a given texel.
2018-09-21 15:11:39 -07:00
Philip Rideout
99a01499d4 Remove vestigial "flip" stuff. 2018-09-21 12:56:29 -07:00
Philip Rideout
d3ad33a8f3 Fix recent cmgen KTX regression.
This fixes a KTX sizing bug that I introduced while incorporating code
review feedback.
2018-09-21 12:23:40 -07:00
Pixelflinger
9187b31279 fix debug environment labels
- front and back labels where inverted:
  +z is the front of the cube and -z is its back
  when looking at the cube from the outside
  with a camera pointing towards -z (and the cube
  in front of it). This is the GL definition.

- make the synthetic uvXXX debug environment 
  colors match those of the debug environment
  (except for -Z/back which is magenta instead
  of black).

- add some documentation about skybox and cube map.
2018-09-21 11:50:29 -07:00
Pixelflinger
09830cd126 Improvements to CMGEN handling of cubemaps
- cmgen now creates reflections maps for all input
assets by default instead of just for equirectangular 
images.

- equirectangular decode doesn't mirror -- that's
done by the mirroring code now.

- mirroring can be turned of with --no-mirror

- option --mirror is gone

- faster mirroring code (do it before generating
  mipmaps)

- added labels to faces of debug.png environment

- added a debug equirectangular image in third_party
(creative commons license)
2018-09-21 11:50:29 -07:00
Pixelflinger
1396cc751c fix constness of CubemapUtils::process 2018-09-21 11:49:56 -07:00
Philip Rideout
2e97539a30 Create exportKtxFaces function, use a switch-case. 2018-09-21 11:25:59 -07:00
Philip Rideout
0a464724c8 Fix inconsistent cube face order.
- KTX / OpenGL are PX,NX,PY,NZ,PZ,NZ.
- Cubemap::Face is NX,PX,NY,PY,NZ,PZ.

I considered changing the Cubemap::Face enum, but applying ^1 upon
export seems less intrusive.
2018-09-21 11:25:59 -07:00
Philip Rideout
68be31afaf The cmgen tool can now generate KTX files.
For each envmap/skybox pair, this will reduce the number of downloads
from 61 files to 3 files.

Note that we are still using sh.txt for coefficients, I'll see if it
would be easy to embed that in the KTX metadata.

Also, I will add KTX support to roughness-prefilter soon.
2018-09-20 15:50:21 -07:00
Ben Doherty
596c94f6f0 Tungsten: normal mapping capabilities (#274)
* Ability to add code prior to prepareMaterial

* Add normal input on shading node

* Add constant float node

* Add multiply and subtract nodes

* Split math nodes out into MathNodes.kt
2018-09-20 11:09:15 -07:00
Philip Rideout
d3e7103ee5 Fix three bugs that caused bad normals with Suzanne.
(1) Suzanne's normal map is actually linear but we were telling GL that
it is SRGB, so the shader was not reading (0.5,0.5,1.0) from a perfectly
flat normal map.

(2) --linear in mipgen was not honored when consuming PNG files.

(3) The build was not passing --linear to mipgen for the normal map.
2018-09-20 10:01: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
Ben Doherty
29e891a7b1 Tungsten: add IBL to the preview panel (#254)
* Move preview-specific files into new package

* Add venice_sunset resource

* Load IBL from resources

* Generate IBL at build time
2018-09-19 11:16:58 -07:00
Ben Doherty
2218c51306 Add color space option to texture chooser (#266) 2018-09-19 11:02:28 -07:00
Romain Guy
0d37989157 Make the procedural UV grid HDR (#265) 2018-09-18 18:28:56 -07:00