Commit Graph

3050 Commits

Author SHA1 Message Date
Philip Rideout
dc74ee2ddc Refactor CallbackUtils. 2020-08-05 17:27:12 -07:00
Philip Rideout
2727cddd7a TextureHelper: add overload with a release callback.
Fixes #2909.
2020-08-05 17:27:12 -07:00
Pixelflinger
4f239c3e3c fix a moveResource which was broken recently
a recent fix actually badly broke moveResource, we were using the
index of the newly created resource instead of the pass index.
2020-08-05 13:10:16 -07:00
Philip Rideout
4bf0d0c0a8 Web: Remove broken webpack example.
This example has fallen out of date, I tried to resurrect it but it
turned out to be non-trivial, given the special nature of emscripten's
generated JavaScript wrappers.

It might be better to provide an example that uses rollup, since that's
the bundler that model-viewer uses, or a simple TypeScript example.

For now, I think our simple HTML + raw JS samples are sufficient.
2020-08-05 11:19:08 -07:00
Pixelflinger
d70f1c0ab2 Infrastructure for frame history data
We can now save an arbitrary (but decided at compile time) number of
entries containing information about previous frames and it for while
drawing the current frame. Typically this is used for such effects as
TAA, screen-space reflection, building probes over time, etc...

Currently the frame history consists of one frame per View. FView 
provides a new (internal) getFrameHistory() method used to access
previous frames entries as well as to save the current's frame
information.

The FrameGraphPassResources (which is available in the execute closure
of a FrameGraph pass) has a new detach() method which can be used to
remove that resource from the FrameGraph lifetime management, at which
point it becomes the responsibility of the caller. Typically this
resource will be stored in the frame history.
2020-08-04 15:01:09 -07:00
Pixelflinger
991861a512 make fg resources creation/destruction more generic
creation/destruction now takes a ResourceAllocatorInterface instead of
a FrameGraph.
2020-08-04 15:01:09 -07:00
Pixelflinger
d0367a359b move ResourceAllocator out of the fg namespace 2020-08-04 15:01:09 -07:00
Mathias Agopian
d2be23045f fix a FG crasher when we have more than 32 passes (#2911)
The FrameGraph cannot store pointers internally because all objects
are stored in vectors. Unfortunately we were storing the writer of
resources as a pointer. 

This is fixed by storing an index instead.
2020-08-04 15:00:38 -07:00
Ben Doherty
4cb903a09e Fix variant-limiting bug in matdbg (#2903) 2020-08-03 11:16:33 -07:00
Philip Rideout
3ca0a8cd8d Transmission should use FADE. (#2908)
Fixed #2907.
2020-08-03 10:51:26 -07:00
Philip Rideout
2c18d7f576 Revert "Transmission should use FADE."
This reverts commit 379f92417f.
2020-08-03 10:45:46 -07:00
Philip Rideout
379f92417f Transmission should use FADE.
Fixed #2907
2020-08-03 10:44:15 -07:00
Ben Doherty
13574f793c Run MergeReturnPass only on mobile (#2901) 2020-07-31 18:40:47 -07:00
Ben Doherty
f69ba63046 Don't crash for invalid Metal programs when using matdbg (#2902) 2020-07-31 18:39:57 -07:00
Pixelflinger
a13620c66d reorganize material folder
Sets of post-process materials are in their own folder now.

Also moved fxaa.fs from shaders/ to materials/ so it's next to the 
material that includes it. This file is not shared with any other
material.
2020-07-31 10:36:44 -07:00
Pixelflinger
b4a35c3ee2 fxaa: highp precision seems overkill 2020-07-30 23:46:09 -07:00
Ben Doherty
a4e3e0c2d1 Ignore commented-out #includes in material files (#2897) 2020-07-30 18:46:16 -07:00
Ben Doherty
1a85c93894 Fix DEBUG identifier used in Log.h (#2895) 2020-07-30 16:43:42 -07:00
Philip Rideout
2c114a9a9f Add mask smoothing to the unlit path. 2020-07-30 15:14:46 -07:00
Philip Rideout
f4d8753c24 MASKED mode now leaves destination alpha intact.
This prevents strange behavior with semi-transparent render targets,
which the model viewer team discovered when testing against the Khronos
alpha test conformance model.
2020-07-30 15:14:46 -07:00
Ben Doherty
6f28da4798 Fix Podspec for 1.8.1 (#2894) 2020-07-30 13:54:12 -07:00
Philip Rideout
a6390355da Fix typos. 2020-07-30 13:50:51 -07:00
Romain Guy
a120e0a4bb Filament 1.8.1 2020-07-30 12:25:53 -07:00
Romain Guy
642fb5859b Filament 1.8.1 v1.8.1 2020-07-30 12:18:38 -07:00
Philip Rideout
b4623c9afc Add lightroom IBL, enable ColorGrading by default in gltf_viewer.
The non-legacy ACES is now default, it looks much better.

I also tested this IBL with WebGL and Android.
2020-07-30 11:39:36 -07:00
ruitaocai
c4546f1777 fix typo (#2892) 2020-07-29 22:46:50 -07:00
Pixelflinger
ea5e8c2d14 fix refraction roughness when specular AA is active 2020-07-29 16:36:24 -07:00
Philip Rideout
440687e05a Add JavaScript bindings for Fog and Vignette. 2020-07-29 15:01:05 -07:00
Mathias Agopian
bd30abb168 attempt to reduce code size in PostProcessManager (#2880)
* attempt to reduce code size in PostProcessManager

The two main changes are:
- materials are now stored in a hash map which allows us to
  automatically destroy all of them using one loop -- instead of
  having to call terminate() for each of them.

- factored a very common sequence of code:
  commit()
  use()
  beginRenderPass()
  draw()
  endRenderPass()

  This makes the code easier to write and also results in less code.

There are also minor other changes, e.g. RenderPass constructor is not
inline anymore.
2020-07-29 13:01:23 -07:00
Pixelflinger
d15a906855 multithread the conversion to RGB10_A2
we just move the conversion code into the already existing jobs.
2020-07-29 12:59:55 -07:00
Philip Rideout
7584a7bebe Merge pull request #2885 from google/pr/jscolorgrading
WebGL: use color grading in demo, expose destroy.
2020-07-29 12:22:11 -07:00
Philip Rideout
8f3f30e9cd gltfio: fix depth writes for transmissive materials.
This fixes the depth fighting in the column of red spheres in the test
model while in filamat mode. Thanks Romain for catching this.

It also makes filamat mode more consistent with ubershader mode.
2020-07-29 11:55:21 -07:00
Philip Rideout
664e7b8a8d ColorGrading: add JavaScript and TypeScript bindings.
This is not tested but seems fairly straightforward.
2020-07-28 14:45:51 -07:00
Philip Rideout
aa5f88ae0f WebGL: Add workaround for skinning with Emscripten.
So...we use integers for bone indices, and that makes them special. :)

On May 26, the emsdk WebGL 2.0 wrapper for the integer variant of
VertexAttribPointer was broken due to an incomplete renaming operation
from an emscripten contributor.

I have a pending upstream fix to the emscripten repo (#11742) but for
now we can workaround this with a simple monkeypatch.

Fixes #2856.
2020-07-28 09:21:27 -07:00
Pixelflinger
6f5e04d489 enforce correct type with printf-style logs 2020-07-27 14:06:48 -07:00
Ben Doherty
2113c9a3be Fix Metal crash when >16 samplers are bound (#2873) 2020-07-27 13:18:13 -07:00
Pixelflinger
b0d4934d02 Add validation for Texture::setImage()
We now validate supported combinations of internalFormat vs. format/type.
We currently follow the GLES specification, but we could be more 
restrictive if needed for vulkan/metal.

The validation terminates in debug builds and logs (and becomes a no-op)
in release builds.
2020-07-27 11:22:41 -07:00
Philip Rideout
2f4dd0bbd4 sample-page-curl: add comments to variables, etc. 2020-07-27 07:35:58 -07:00
Pixelflinger
e34db6fc29 fix a few issues with color grading
- we were not clamping the color grading output to [0,1]

- we were not using a supported input (cpu) pixel format for the
  3d LUT in low and medium quality
2020-07-24 17:24:51 -07:00
Pixelflinger
087e2480d1 DoF: fix tiles dilate pass edges
We were using texelFetch which doesn't handle wrap modes, and this
resulted in all edge tiles to be undefined. Use textureLod() instead.
2020-07-24 11:38:26 -07:00
Ben Doherty
45efe2df75 CSM: allow setting individual split positions (#2835) 2020-07-24 11:04:28 -07:00
Ben Doherty
85ae21fa26 Remove Google-style line directives in filamat lite (#2860) 2020-07-24 11:04:01 -07:00
Pixelflinger
77939ad269 DoF: improve quality in "fast tiles"
fast tiles (i.e. where all pixels have the same circle-of-confusion)
are allowed to use bilinear filtering.
this results in better looking DoF in these areas.
2020-07-23 22:49:13 -07:00
Tim Psiaki
4a59e6e1ce Fix node hierarchy corruption when a node is set to parentless. 2020-07-23 22:48:40 -07:00
Pixelflinger
ca68ef22e1 update glslang to latest
glslang repo SHA: f3cb1896971f449706bb1df5053d0e8fad6b0675


This fixes another highp bug.
2020-07-23 16:11:14 -07:00
Pixelflinger
7067500a9c DoF: improve quality
Using a ring density of 4 was wrong -- apparently I can't add.
With a density of 8 we can guarantee we don't have gaps between samples
when using mips properly (or at least gaps are consistant and 
predictable).
2020-07-23 13:52:24 -07:00
Romain Guy
6ed1fb3b7b Add quality option to ColorGrading (#2858)
* Add quality option to ColorGrading

Low: 16x16x16 LUT in 10 bit
Medium: 32x32x32 LUT in 10 bit
High: 32x32x32 LUT in 16 bit
Ultra: 64x64x64 LUT in 16 bit

* Move comment
2020-07-23 13:49:01 -07:00
Romain Guy
1613c1bb0e Ensure we respect the desired size on layout change (#2859) 2020-07-23 12:45:02 -07:00
Richard Chang
1162ae4ddc Fix typo in SurfaceOrientation jni wrapper (#2853) 2020-07-23 09:06:26 -07:00
Ben Doherty
a25179b91e Update imgui to v1.77 (#2834) 2020-07-22 16:15:31 -07:00