Commit Graph

295 Commits

Author SHA1 Message Date
Romain Guy
6b529bb231 Fix typo 2021-04-02 15:16:00 -07:00
Romain Guy
bd4a207b37 Switch specular-color to CIE 1931 10 degree observer 2021-04-02 09:55:11 -07:00
Mathias Agopian
cc13420e31 add missing includes
Should fix #3633
2021-03-15 22:45:31 -07:00
Philip Rideout
1a9334e818 Modernize Python print syntax. 2021-02-23 14:43:30 -08:00
Philip Rideout
6297ef9193 Remove some Windows line endings.
These line endings cause annoying diffs when comparing Filament's GitHub
source with its twin sister within Google.
2021-02-17 10:11:22 -08:00
Philip Rideout
d669b1b26f Add null terminator to fix Windows build. 2021-02-03 14:56:34 -08:00
Philip Rideout
c2b4b6347e matc: add --raw argument for internal use.
This feature can generate SPIRV blobs and will be used by VulkanBlitter.

(#3485)
2021-02-03 14:56:34 -08:00
Romain Guy
4567b01c1d Multi-thread shaders generation when compiling materials (#3464)
* Stop using members as globals between methods

* Multi-thread shaders generation with JobSystem

* Pass JobSystem to MaterialBuilder::build()

* Fix MeshAssimp to use the new API

* Allow the Java API to pass a job system via Engine

* Update docs

* Apply suggestions from code review

Co-authored-by: Philip Rideout <philiprideout@gmail.com>
2021-01-29 09:30:37 -08:00
Philip Rideout
024910ba8e libibl: use C callback for progress 2020-12-10 11:19:36 -08:00
Philip Rideout
a50cd1f8c8 zbloat now includes chunk sizes 2020-12-06 21:54:37 -08:00
Philip Rideout
fe907398d4 resgen / zbloat fixups 2020-12-06 15:25:08 -08:00
Philip Rideout
8b6ddfe97a Add zbloat tool.
This tool makes it easy to analyze the composition of Android
applications that use Filament.

- Filament materials are shown in the treemap if `resgen --json` was
  used in the build.
- The input path can be a so file, folder, or zip archive (apk or aar).
- If the path is a zip or folder, helps you find the file to analyze.
- The generated web report is a self-contained HTML file.
- Reports the gzipped size of all Filament materials.

For example, from a mac, you can generate a self-contained HTML file by
typing this from the Filament repo root:

    ./tools/zbloat/zbloat.py ./android/filament-android
    open index.html

This tool uses Python, `nm`, and `objdump`.

The `nm` tool works slightly differently between macOS and Linux, so a
`Dockerfile` is provided that installs dependencies inside a Linux
container. This is also convenient if you do not have both versions of
Python on your system.

The easy way to use docker is to invoke the helper bash script. Simply
type `zbloat.sh [args...]` instead of `zbloat.py [args...]`. The first
time you run it, it will be slow but subsequent times will be fast.

Many thanks to Evan Martin for his interactive treemap widget.
2020-12-06 14:36:25 -08:00
Philip Rideout
3226b20ece resgen: add --json option.
This option embeds a small JSON string inside the resgen blob that lists
all materials and their respective sizes. This is useful when analyzing
the footprint of the binary executable.
2020-12-06 14:36:13 -08:00
Ben Doherty
90c156ebef Add fog variant filter to matc (#3286) 2020-11-12 12:47:42 -08:00
Ben Doherty
239246e221 Add ability to specify post-process material output location (#3205) 2020-10-21 12:19:46 -06:00
Ben Doherty
e7250571e7 Add subpass parameter type to materials (#3193) 2020-10-19 16:28:26 -06:00
Philip Rideout
22312b2090 cmgen / mipgen: add opt-in for ASTC / ETC support.
Block compression is currently only used when we invoke mipgen for the
suzanne demo. This PR makes it easy to disable.

Block compression is still enabled in our CMake build, but other build
systems can simply omit BlockCompression.{h,cpp} from imageio (as well
as the two third_party libs) and it will "just work".
2020-09-23 11:17:27 -07:00
Ben Doherty
d3e3974179 Add new shader variants for VSM (#2968) 2020-08-17 18:00:01 -07:00
MorphTail
4dfc78674d Add documentation for cmgen (#2966)
* Create cmgen README

* add more description for --size attribute

resolve #454

* Update README.md
2020-08-17 11:50:59 -07:00
Aleksi Sapon
e14c8258f7 Fix KTX texture format for latest version 2020-07-22 13:20:54 -07:00
Ben Doherty
b0c11c17e9 Add outputs block to material definition (#2823) 2020-07-20 16:48:00 -07:00
Philip Rideout
d3f6ce6990 Minor fixes for "matinfo --web-server" 2020-07-08 13:15:28 -07:00
Ben Doherty
1af254db43 Add matc support for command-line preprocessor defines (#2760) 2020-07-01 10:42:46 -07:00
Ben Doherty
92f2004c4b Improve matc error reporting (#2741) 2020-06-29 11:21:56 -07:00
Romain Guy
f7f86a7c56 Remove skygen
This will be replaced by a runtime implementation. skygen was
never finished to begin with.
2020-06-26 17:25:08 -07:00
Philip Rideout
d4a396d52f matinfo / matdbg: fix SPIRV version, add validation.
The value we pass to spvContextCreate() is not SPV_ENV_UNIVERSAL_1_3,
which is what we use in GLSLPostProcessor.

Also add a call to spvValidateBinary(), which would have caught this
oversight.
2020-05-19 16:48:36 -07:00
Pixelflinger
6df20f3083 Add a private property to materials to control framebuffer_fetch
this is intended to be temporary until we properly add support
for vulkan's subpasses. this PR just helps us activate
ext_framebuffer_fetch on select materials.
2020-05-19 12:25:41 -07:00
brian.wang
0187caf10f Fix minor bug in Vulkan backend on Windows
* fix compile error when vulkan

* matc:print shaders support

* fix link error

* ussage for matc print flag

Co-authored-by: brian.wang <brian.wang@noitom.com>
2020-05-12 08:59:25 -07:00
Romain Guy
14ce9e30b9 Make the build more quiet (#2457)
* Make the build more quiet

* Add mising include
2020-04-25 01:13:30 -07:00
Philip Rideout
a55b75a739 Remove monkey mesh dependency from samples.
The only apps that need this filamesh are suzanne and hellopbr. This
change allows us to modify + test Filament without re-invoking resgen.
2020-04-20 18:25:43 -07:00
Philip Rideout
cc61707cc2 Improve build turnaround by breaking dependencies.
This adds a new "backend_headers" target because small changes to any
backend cpp file was resulting in a huge build, causing materials to be
rebuilt, etc. Note that filabridge only needs DriverEnums, nothing else.
2020-04-20 15:37:21 -07:00
Romain Guy
06593a97bb Add new --mip-levels option to mipgen (#2421)
This option (short: -m) can be used to limit the number of mip
levels generated. Using -m 1 allows to use mipgen as a cheap-ish
image converter.
2020-04-18 16:43:39 -07:00
Romain Guy
c28d9ddb9d Fix support of paletted images and alpha channel in imageio (#2420) 2020-04-18 16:32:05 -07:00
Romain Guy
bf97e7e15a Add ground-truth option to cso-lut (#2398)
The ground truth is computed using a Monte Carlo simulation.
2020-04-15 14:51:52 -07:00
Romain Guy
8094955fc1 Add new tool cso-lut (#2394)
* Add new tool cso-lut

This tool is for internal usage only. It computes a 3D lookup table
for cone/sphere occlusion computations. These can be used to implement
specular occlusion, directional ambient occlusion, etc.

* Improve generated comment

* Fix Windows build
2020-04-14 18:22:56 -07:00
Romain Guy
bf0dc32ee3 Change specularAmbientOcclusion from boolean to enum (#2352)
The user can now choose amongst 3 specular AO methods:
- None, specAO is off
- Simple, specAO is inferred from roughness and diffuse AO
- Bent normals, specAO is computed accurately from cone intersections

The last method is more expensive but produces the best results.

This change also fixes a few issues:
- Rename materialRefraction() and materialRefractionType() for
  consistency
- Fixes user time in shaders
2020-04-07 09:19:48 -07:00
Ben Doherty
acc36e8d9b Deprecating Clang on Windows in CMakeLists (#2243) 2020-03-13 12:33:02 -07:00
Romain Guy
a2818037b3 matinfo can print dictionaries, shrink Metal dictionary (#2230)
This change adds new commands to matinfo to print dictionaries.
This feature is useful to debug dictionaries, and I just used
it to identify that using a shared dictionary would save ~12 KiB
in the Android build. The macOS build (GLSL + Metal) would go
down to 71 KiB from 136 KiB.

The SPIRV to Metal conversion leaves leading spaces and some
comments. This change also runs the shrinker on optimized Metal
shaders to further reduce the size of shaders.
2020-03-10 11:42:19 -07:00
Mathias Agopian
fddf51dc74 cmgen -d would force importance sampling mips generation 2020-01-06 17:43:11 -08:00
Mathias Agopian
b8d4b981e0 Better roughness remapping and comments
We were conflating two concepts in our comments about the roughness
remapping, which was confusing. Also changed the remapping so it 
matches a log2 mapping in our default configuration.
2020-01-06 17:42:56 -08:00
Romain Guy
78842b59c9 Only build FBX and OBJ importers (#2003) 2020-01-06 14:38:32 -08:00
Philip Rideout
25c4efd2db cmgen: do not create useless folder for KTX files
With KTX, we should simply create the specified output folder and put
the KTX file(s) in there. There is no need to create a subfolder of the
output folder.

This change also allows users to pick a custom name for their KTX file,
because we only use the "deployment" name when generating filenames.
2019-12-18 13:03:02 -08:00
Pixelflinger
a924fbb490 Better roughness remapping for IBLs
This greatly improves the quality of semi-rough
materials.
2019-12-14 16:36:58 -08:00
Philip Rideout
28065e36e8 Make builds less verbose.
Fixes #1956.
2019-12-10 17:19:06 -08:00
Mathias Agopian
0f16f3177e some cmgen fixes
- support equirect/octahedron save in more cases
- apply 1/pi when rendering SH so it's easier to compare 
  (this is used only for debugging anyways)
2019-12-10 12:26:52 -08:00
Mathias Agopian
cbb5d2b423 fix typos and rename refraction to refractionMode 2019-12-08 22:18:18 -08:00
Pixelflinger
1ccae61d40 shader plumbing for screen-space refraction
In this PR, the filament side is missing, so we're outputting back.
But all codepaths in the shader are implemented:
 cubemap/screenspace, solid/thin
2019-12-08 22:18:18 -08:00
Mathias Agopian
f94aa731ed Add plumbing for refraction type (solid or thin) 2019-12-08 22:18:18 -08:00
Pixelflinger
0371a805ed basic refraction 2019-12-08 22:18:18 -08:00
Mathias Agopian
dbda77b091 Improve low roughness significantly
Filament will now allow incomplete mipmap chains for the IBL and
map the roughness to the available chain.

This allows to create roughness cubemaps with a minim size for
roughness==1, instead of always mapping it to 1x1.

cmgen will now use 16x16 cubemaps for roughness==1, which
improves the quality of rough objects significantly.

The beauty of this is that there is no asset or API change. Old assets
will continue to work like before.
2019-12-08 22:17:08 -08:00