Commit Graph
2368 Commits
Author SHA1 Message Date
Romain Guy 8b2ea72be2 Fix emissive in unlit shaders
This change applies exposure compensation just like with
lit shaders.
2020-02-25 09:47:06 -08:00
Romain Guy 8eaa1f5e88 Add options to skip samples (#2163)
-DFILAMENT_SKIP_SAMPLES=ON with CMake
-Pfilament_skip_samples with gradle

This change also renames CMake options specific to Filament
to avoid clashes with subprojects.
2020-02-24 18:15:33 -08:00
Pixelflinger c72f622a87 Minor changes to SAO
- minor uniform optimizations (saves ~0.1ms)
- fix some missing highp precision qualifers
- make it easier to tweak the blur filter
- make sure samples's radius goes from 0 to 1
- update comments
2020-02-24 18:06:49 -08:00
Ben Doherty 8a0505eb6f Fix Metal crash on Catalina (#2161) 2020-02-24 17:18:43 -08:00
Romain Guy 799e837f35 Upgrade to latest AGP 2020-02-24 12:28:29 -08:00
Philip Rideout 4690ce5602 WebGL: Improve the callback API for glTF.
After the native async functionality landed, there was no way for web
clients to be notified that the decoding has finished. This PR changes
the existing `onDone` callback so that it gets called after all textures
have been decoded. (Previously it was called after downloading rather
than decoding.)

This has the side effect of simplifying the API because clients no
longer need to call a finalize function.
2020-02-24 11:38:55 -08:00
Philip Rideout e972126cea Add missing TypeScript declarations.
This patches up all the holes discovered when I tried porting the
fidelity tests in `model-viewer` to our TypeScript declarations.
2020-02-24 09:35:22 -08:00
Mathias Agopian db40fd8983 More accurately evaluate the size of MSAA textures 2020-02-22 00:18:30 -08:00
Mathias Agopian c2db7b8afd fix a crasher when enabling bloom from java 2020-02-21 16:55:59 -08:00
Philip Rideout f403876784 Fix JNI signature for RenderTarget API.
Fixes #2151
2020-02-21 15:08:47 -08:00
Mathias Agopian 3a9d4c7c77 Another SSAO optimization saving another ~16%
During the SSAO pass, we pack the decoded depth to the GB channels of
the AO texture, which reduces our bandwidth requirements during the
blurring pass, as well as some ALU usage.
It puts SSAO at about 2ms on pixel4/1080p.
2020-02-21 14:15:06 -08:00
Mathias Agopian e737ece570 rollback misguided "optimization"
use gpu's sin/cos instead of approximation
2020-02-21 14:15:06 -08:00
Philip Rideout 948d19c446 Fix typo in upload script. 2020-02-20 16:31:57 -08:00
Philip Rideout ee81c9516a gltfio full flavor should use the old aar and maven names.
This should fix the Android build break. We do not want to change the
maven package name for existing gltfio clients.
2020-02-20 15:05:31 -08:00
Pixelflinger 675012a2eb Added a quality level parameter for SSAO
Currently it only selects how many samples are used.
Low,medium,high and ultra respectively map to 7,11,16 and 32 samples.
The default is "low", which is sufficient for most mobile applications.
2020-02-20 11:26:10 -08:00
Pixelflinger 31a4ef10e1 Use a smoother falloff function.
The improvement is really subtle, it makes the SSAO effect a bit 
softer.
2020-02-20 11:26:10 -08:00
Philip Rideout a0d43d51c9 Add gradle flavor for gltfio-lite.
This cribs the strategy from filamat-lite and also fixes a "more than
one file" gradle error.
2020-02-20 09:45:33 -08:00
Philip Rideout 31035d2b3c Optimize filament-utils (230 KB => 190 KB). 2020-02-20 09:45:33 -08:00
Mathias Agopian 4e8f323e47 Reduced AO processing time by 1/3
This is achieved by computing a small 2x2 box blur in the AO pass
taking advantage of quad shading, which allows to halve the size
of the bilateral blur kernel.

Reducing the size of the blur kernel has a side effect to kick Adreno
gpu into direct mode, which apparently is much faster here.

Overall we go from 3.4ms to 2.4ms on Pixel4.

The quality is impacted, but not severely. This probably assumes 
GPU that have working derivatives.
2020-02-19 22:09:53 -08:00
Pixelflinger 4dd3d7ab5e Greatly improve SSAO quality by using better samples
The power parameter now really controls the contrast. It's default value
is now 1, instead of 0.
2020-02-19 22:09:53 -08:00
Mathias Agopian 63a7bf5ee9 tweak SSAO
- got rid of all the precomputed samples for now, it makes things
  much more simple, and actually doesn't slow things down. Use the
  analytic offsets (spiral) instead.

- use textureLod instead of texelFetch in places where we need to do
  how own clamping, turns out it's faster (as measured on pixel4).

- use a interleaved gradient noise instead of a hardcoded blue noise,
  the difference isn't big.

Overall we're actually 0.2ms faster out of 3.5ms. It's not immediately
clear why, might just be noise.
2020-02-19 22:09:53 -08:00
Romain Guy 0473da9f05 Add support for ccache (#2148)
* Add support for ccache

To benefit from ccache, first install ccache (for instance with
brew install ccache on macOS). On my machine a clean build takes
~5 minutes the first time. A second clean build with ccache enabled
takes 34 seconds.

* Enable more aggressive caching
2020-02-20 11:36:36 +09:00
Pixelflinger e5447f7417 Cleanp-up PostProcessManager a bit 2020-02-19 14:41:00 -08:00
Ben Doherty 62810d8c87 Rework array texture support (#2136) 2020-02-19 10:52:12 -08:00
Philip Rideout ca81d48432 gltfio-lite: add BLEND material
This increases the size to 538K.
2020-02-18 11:55:47 -08:00
Philip Rideout b9c857130a Introduce gltfio-lite.
This is 466 KB insted of the usual 850 KB. It assumes that users do not
need spec-gloss, non-lit, or a special transparency mode.

(uncompressed SO size on arm64)

We can add a new maven project for this next week.
2020-02-18 11:55:47 -08:00
Philip Rideout a9bbc6d3c4 Fix syntax error in TypeScript annotations. 2020-02-17 09:26:27 -08:00
Pixelflinger 3a273b1837 fix a typo when thresholding for bloom
- also use step() to implement the threshold
- improve bloomOptions documentation
2020-02-15 22:19:35 -08:00
Romain Guy 5e6ff5a44f Update to a more recent version of AGP 2020-02-14 15:26:05 -08:00
Philip Rideout 65129d1b52 filament-utils-android: fix recent crash regression. 2020-02-14 14:56:38 -08:00
Philip Rideout 54d9d870ee gltfio size reduction 3/3: compile gltfio directly
This takes libgltfio-jni.so from 882 KB to 850 KB
2020-02-14 14:56:38 -08:00
Philip Rideout ffff6dd580 gltfio size reduction 2/3: proper shared linking
This takes libgltfio-jni.so from 966 KB to 882 KB
This takes libfilament-jni.so from 810 KB to 802 KB
2020-02-14 14:56:38 -08:00
Philip Rideout dc4a1ed5e5 gltfio size reduction 1/3: add more opt flags
This takes libgltfio-jni.so from 1.5 MB to 966 KB.
2020-02-14 14:56:38 -08:00
Mathias Agopian 8bbf0ce9ef Bloom can now have a dirt texture applied 2020-02-13 20:51:43 -08:00
Romain Guy a4e4021950 Update README.md 2020-02-13 20:03:51 -08:00
Mathias Agopian 87fe48225f On mobile, use a more efficient up-sampler
This doesn't affect quality significantly, but saves 30% of gpu time
on the upsampling, overall it's about 0.1 ms. This brings The bloom
effect below 2ms on Pixel4.
2020-02-13 17:40:55 -08:00
Ben Doherty af47fa9b6d Fix incorrect twoPassesOneSide rendering with Metal (#2133) 2020-02-13 17:32:26 -08:00
Mathias Agopian 3de1e197aa improve SSrefr highlights at low roughness
We untonemap/tonemap the first level of blur to reduce the very high
frequencies due to HDR highlights in the image, this produce a softer
image at higher roughness. This can programmatically be turned off,
but that setting is not exposed.
2020-02-13 12:26:25 -08:00
Mathias Agopian 2a1cbe67c6 Improve bloom performance on mobile
The very first downsample stage costs us a lot because it reads from
a full-res texture. We mitigate this by always doing a blit to
1/4 res. Blits are quite a bit faster, this saves about 1ms on
Pixel4.
2020-02-12 17:19:26 -08:00
Mathias Agopian f57404a3f0 split downsample and upsample passes 2020-02-12 17:19:26 -08:00
Mathias Agopian 87d815c659 Minor cleanup. Add FTexture::maxLevelCount()
We were computing this is many places. Validate better SSAO depth
buffer size.
2020-02-12 17:19:26 -08:00
Mathias Agopian 651ccb183e New mathfwd.h header
math/mathwfd.h forward declares all {mat|vec}{2|3|4}<> classes,
which allows us to remove their respective #include in a lot of
our public headers.
Our math headers are full of templates, so this should help build times
a bit.

Also we want to keep the public headers as minimalist as possible.
2020-02-12 15:30:13 -08:00
Philip Rideout 67406c42ec Clamp viewport width to prevent floating point exception.
To trigger an exception users could either shrink the window or enlarge
the sidebar. Constraining both of these is somewhat tricky so let's
just clamp the viewport width at a low level.
2020-02-12 12:07:51 -08:00
Philip Rideout cb953b4203 Remove usage of <regex> from Path.
There was actually no need to give special treatment to leading drive
designators since they effectively form the first path segment anyway.
To help prevent regressions, I added a few unit tests in a previous CL.

The motivation for the CL is to remove a dependency on `locale.cpp`,
which can result in shorter build times and reduced binary sizes.
2020-02-12 10:03:06 -08:00
Philip Rideout c0e2cfb684 Minor enhancements to test_Path. 2020-02-12 10:03:06 -08:00
Philip Rideout 9358c7313e Remove STL from ResourceLoader API. 2020-02-12 10:03:06 -08:00
Philip Rideout 02b377c244 gltfio: remove locale.cpp dependency
For Android and wasm we do not use the filesystem and therefore do not
need `utils::Path`.

```
libgltfio-jni.so BEFORE 1.9 MB (693 KB gzipped)
libgltfio-jni.so AFTER  1.4 MB (542 KB gzipped)
```
2020-02-12 10:03:06 -08:00
Romain Guy d2287f584a Fix comment 2020-02-11 17:33:56 -08:00
Mathias Agopian cc94820cb3 clean-up of dynamic scaling code 2020-02-11 16:31:21 -08:00
Mathias Agopian b17c51e340 Add a threshold option (enabled by default) for bloom.
Threshold can be either on or off, and only thresholds at 1.0 when 
activated (in pre-exposed mode).

This allows to use very high strengths values for the bloom without
softening the rest of the image, and is useful for artistic considerations.
2020-02-11 16:15:04 -08:00