Commit Graph
2828 Commits
Author SHA1 Message Date
Romain Guy fbb8742cbd Add new color grading feature: shadows/mid-tones/highlights (#2623)
* Add new color grading feature: shadows/mid-tones/highlights

This feature can be used to color correct specific tonal ranges.
The tonal zones can be precisely controlled.
2020-06-02 12:28:38 -07:00
Philip Rideout 6c173489d7 gltfio: Add get-by-name and get-by-prefix methods.
Java bindings will be forthcoming in a separate commit.
2020-06-02 10:17:12 -07:00
Philip Rideout 0abe262094 Patch hat-trie to remove exceptions. 2020-06-02 10:17:12 -07:00
Philip Rideout bd72f1fd6a Add hat-trie to third_party. 2020-06-02 10:17:12 -07:00
Philip Rideout 28912b6f57 filamat-android: fix string leaks 2020-06-02 10:16:41 -07:00
Philip Rideout a3e336921e gltfio: improve performance by assuming assets are well-formed.
glTF assets are required to provide min/max attributes for POSITION,
so in theory we never need to compute the AABB. However the option is
still there.

This PR also makes it so that Java clients can choose this option,
previously it was hardcoded for all non-native clients.
2020-06-01 10:30:09 -07:00
Romain Guy 524da0af28 Update RELEASE_NOTES.md 2020-06-01 09:37:21 -07:00
Philip Rideout adccf9f432 gltfio: remove details namespace 2020-06-01 09:19:18 -07:00
Romain Guy c49ffcc354 Add channel mixer and docs to ColorGrading (#2618) 2020-06-01 09:07:34 -07:00
Romain Guy 50adc1f661 Add per-view color grading LUT (#2615)
* Add the ability to set a ColorGrading LUT per View

In this change, material_sandbox allows to change the tone mapping
operator at runtime.

* Add Mathematica notebook used to explore white balance

The implementation is meant to reproduce the temperature/tint sliders
founds in Adobe Lightroom. The temperature can be offset from 2,000K
to 50,000K using a slider between -100 and +100 (-1.0 to 1.0 in our
API). The range of tint was modelled after the range used for the
temperature.

* Fix various issues

- A refactoring wrongly remamed the color grading pass
- Setting a View's ColorGrading to null selects the
  default color grading options

* Implement white balance in ColorGrading
2020-05-31 19:24:42 -07:00
Romain Guy b77e024de9 Introduce ColorGrading API (#2613)
* Introduce ColorGrading API

A ColorGrading object will eventually be settable on a View to
choose the tone mapping and other color transformations.

There is currently only a single default ColorGrading instance
used by all views.

* Use raw function pointers
2020-05-29 18:54:48 -07:00
Pixelflinger 1f77fb5995 minor cleanup of PostProcessManager ctor
make sure all fields are always initialized and the IDE stops 
complaining.
2020-05-29 18:44:48 -07:00
Philip Rideout bf1f32e308 gltfio: Use JobSystem to compute bounding boxes. 2020-05-29 18:13:49 -07:00
Philip Rideout 2c6042bd44 Add systrace markers to gltfio. 2020-05-29 18:13:49 -07:00
Philip Rideout 96c770ad9e gltfio: Use JobSystem to compute tangents. 2020-05-29 18:13:49 -07:00
Ben Doherty b1563dabe9 Metal: use render target height to adjust viewport when blitting (#2610) 2020-05-29 16:08:47 -07:00
Romain Guy 3ef37f8925 Prep work for proper color grading (#2611)
* Prep work for proper color grading

* Bring back local colorGrading bool to drive that pass

* Fix formatting issue

* Add missing case for the color grading pass

* Fix formatting issues

* Formatting issues
2020-05-29 15:29:15 -07:00
Philip Rideout ede09e28e3 gltfio: add JavaScript bindings for instancing. 2020-05-29 09:22:17 -07:00
Philip Rideout 81ea280ea9 gltfio: add Java bindings for instancing. 2020-05-29 09:22:17 -07:00
Philip Rideout 92c017bdd3 Simplify WebGL context creation. 2020-05-29 09:09:49 -07:00
Philip Rideout 6870d360cd gltfio: Simplify FilamentInstance. 2020-05-29 07:43:44 -07:00
Philip Rideout 2d62daf5e8 Add sample for testing glTF instancing.
Fixes #1513.
2020-05-29 07:43:44 -07:00
Philip Rideout 83cff32856 gltfio: Add support for instanced animation.
When animation is applied to the master asset, all instances are
animated.

Instances can also be individually animated via the Animator in
FilamentInstance.

Fixes #1513.
2020-05-29 07:43:44 -07:00
Philip Rideout 8de730f76c gltfio: Add support for simple instancing.
This adds createInstancedAsset() to AssetLoader, which creates a master
asset and a set of slave instances. Vertex buffers, index buffers,
textures, and material instances are shared. Entities and components are
duplicated.

Instances have their own API object that is very simple. Light sources
and material instances are not instanced, so are not accessible through
the instance API object.

The master-slave ownership model lets us avoid complex shared ownership
semantics. The existing cache structures in AssetLoader allow the
implementation of this feature to be fairly simple.

The master asset exposes the union of all entities and allows clients to
modify all instances en masse if they wish. This design also works
naturally with ResourceLoader, which does not need to know about
instancing. For example, asynchronous loading is completely unchanged;
the dependency graph simply contains the union of entities across all
instances.

Support for animation is added in a subsequent commit.

Fixes #1513.
2020-05-29 07:43:44 -07:00
Romain Guy 1f29df6da4 Add a note about AGP 4.0.0 2020-05-28 14:05:20 -07:00
Philip Rideout c087eb6825 gltfio: Add Java / JavaScript bindings for lights. 2020-05-28 11:51:35 -07:00
Pixelflinger 038c35fbda add a few systraces during init 2020-05-28 11:28:22 -07:00
Ben Doherty 80fcd133de Add correct scheduleDestroy calls to Metal backend (#2600) 2020-05-27 15:54:54 -07:00
Pixelflinger 62d0f9f033 perfcounters are now disabled by default
To enable some basic profiling of the gl thread using performance
counters, the "filament.perfcounters" property must be set to 1
(before the Filament Engine is created):

    adb shell setprop filament.perfcounters 1

This is so that filament doesn't interfere with simpleperf by default.
2020-05-27 15:53:45 -07:00
Pixelflinger 1e65b4d8af load post process materials lazily
We aim to reduce start-up time and memory usage.
2020-05-27 11:17:10 -07:00
Pixelflinger f3731fa797 cleanup and code reformatting
This change mostly reorders PostProcessManager's methods roughly
in order that appear in the pipeline.
2020-05-27 11:17:10 -07:00
Romain Guy 28f031e95f Update RELEASE_NOTES.md 2020-05-27 10:52:04 -07:00
Jaime Blasco 5104318fff Initialize DisplayHelper when using textureView in ModelViewer (#2598) 2020-05-27 10:10:13 -07:00
Pixelflinger 68f0ab6312 Implement ACES tone mapping
this leverages the new LUT based tone mapping
2020-05-26 23:46:37 -07:00
Pixelflinger 62a591bc73 Add a new tone mapping option using a LUT
This is now the default, and the tone mapper used
is now the same on desktop and mobile.
In the future this will allow us to implement many features such as
color grading at no cpu cost.
2020-05-26 23:46:37 -07:00
Benjamin Doherty 0f6a06a2e1 Add 3D texture support to Metal 2020-05-26 23:46:17 -07:00
Pixelflinger b620a5e358 Add support for 3D textures in the vulkan backend 2020-05-26 23:45:35 -07:00
Pixelflinger 0d652d61f8 fix typo causing textureGather to always be used 2020-05-26 17:59:01 -07:00
Ben Doherty 1b033c7de3 Implement MRT for Metal (#2590) 2020-05-26 17:38:37 -07:00
Pixelflinger eb5eb6c827 fix EGL config selection 2020-05-26 17:22:30 -07:00
Philip Rideout 0e437d244f Vulkan: fix dummy type for disabled attribs.
OpenGL allows vertex shaders to consume attributes that are never
assigned values from a vertex buffer. When this occurs, GL provides a
default zeroed-out value, or a value from the most recent call to
`glVertexAttrib*v`.

Vulkan does not allow this, so our Vulkan backend provides dummy data by
re-using the position buffer, which we know exists. This was an existing
hack, but it did not always assign a compatible type, which resulted in
validation spew with gltf_viewer + BusterDrone.

This fixes one of the two bugs reported in #2573.
2020-05-26 13:20:06 -07:00
Philip Rideout 9024b4afd7 gltfio: fix vertex attribute type mismatch.
Vulkan complains if a pipeline declares an integer vec2 attribute but
the shader consumes it as "vec2" rather than "ivec2". gltfio was doing
this when supplying dummy texture coordinates.

This fixes one of the two bugs reported in #2573.
2020-05-26 13:19:52 -07:00
Pixelflinger 62ff7b7d0a Improve AO buffer upsampling
Since AO is computed at 1/4 resolution, it is necessary to upsample
the AO buffer. Until now this was done with a bilinear tap, which is
less than ideal as it can creates jaggies at edges.

High quality upsampling can now be enabled and uses a bilateral filter.
The cost is about 2.0 ms at 250MHz on Pixel 4. ES3.1 is required.
2020-05-26 12:59:47 -07:00
Pixelflinger d1ed4f837c improve SSAO quality
SSAO starts at 1/4 resolution, and because we used derivatives
to calculate a cheap pre-blur, the output was mostly 1/4 resolution
of that, leading to 1/4 of the destination pixels being mostly identical.
This, in turn caused sampling issues when reading the SSAO buffer during
the color pass.

We fix this by getting rid of the pre-blur, and increasing slightly the
size of the gaussian blur from 9 samples to 13, which increases the
SSAO pass time by 20%, or 0.3ms at 430 MHz on Pixel 4.

With this change and bilinear filtering in the color pass, we get rid
of all the sampling artifacts.
2020-05-26 12:59:47 -07:00
Pixelflinger d62f664957 ssao: restrict the scaling to 0.5 and 1.0
until now we allowed any resolution for SSAO, but it didn't make
much sense, especially that the depth pass is now used for other things.
To keep things more manageable, we only allow 0.5 and 1.0 scale
factor settings (respectively quarter and full resolution).
2020-05-26 12:59:47 -07:00
Philip Rideout 6311b538e1 Add "if" when compiling subpass material.
This avoids error spew on some platforms such as Chrome + WebGL 2.0
2020-05-26 11:03:55 -07:00
Philip Rideout 58bb1f61e6 Add JS bindings for DoF.
Adding this for completeness, although the feature triggers a known
issue with Chrome's WebGL implementation that emits an error when
source and destination textures of a draw call are the same.
2020-05-26 10:06:40 -07:00
Mathias Agopian 8415d18401 Fix refracted objects drawing order (#2577)
Refracted objects could be drawn on top of opaque objects that were
closer to the camera.

Du to a typo, we were not reusing the existing depth buffer during the
refraction pass.

Fixes #2576
2020-05-23 17:08:53 -07:00
neshumeandneshume 6df1265bef Fix compilation issues under ubuntu 20 and latest clang (#2562)
Co-authored-by: neshume <alex.andel@gmail.com>
2020-05-23 17:08:19 -07:00
Philip Rideout dc51dc197c Gradle: update old property name.
I forgot to update this in 0b1fa7f.
2020-05-22 23:28:30 -07:00