Commit Graph

838 Commits

Author SHA1 Message Date
Philip Rideout
5c64ed5125 gltfio: use highp for UV coords.
Fixes #2500.
2020-06-17 17:27:53 -07:00
Philip Rideout
ebd195f8e4 matdbg: Add support for Android.
See the matdbg README for details.
2020-06-14 22:42:55 -07:00
Romain Guy
a2ce57ade3 Fir applyAnimation() when scale is close or equal to 0 2020-06-13 14:48:07 -07:00
Romain Guy
a019de3363 Add (improved) color grading UI to gltf-viewer (#2676) 2020-06-12 08:30:43 -07:00
Ben Doherty
fde2d2e483 Fix MeshReader material bug (#2674) 2020-06-11 14:49:25 -07:00
Ben Doherty
b2c63b6cd2 Add support to gltfio for glTF cameras (#2663) 2020-06-11 13:57:01 -07:00
Philip Rideout
1f9d073a64 gltfio: enable unused UV attributes when possible.
Reproduced the issue by hacking the TexturedCube glTF file.

Verified the fix by viewing TexturedCube in ubershader mode, then
hacking the shader with matdbg in order to visualize texture
coordinates.

Fixes #2659
2020-06-11 12:05:43 -07:00
Philip Rideout
fa0f5e0501 Prep the build for multi-platform matdbg. 2020-06-10 20:00:24 -07:00
Philip Rideout
fee6a2f075 Miscellaneous matdbg improvements
matdbg
    - Materials are now sorted by name and the sha id is hidden.
    - PostProcess materials now separated from Surface materials.
    - PostProcess details now hide the non-existing properties.
    - Larger default pane size for the material list.
    - Use nicer font.

matinfo
    - Print out the Material Domain.

filament
    - get*Slow methods in FMaterial are now private.
2020-06-10 20:00:24 -07:00
Pixelflinger
00b522669c minor fixes for matdbg
- don't crash when a material doesn't have a name
- don't cache the program in PostProcessManager so we can do live
  editing. Not needed anyways, because Material has a cache.
2020-06-09 13:27:56 -07:00
Romain Guy
3e6ee4ca5e Fix libimageio's HDR format decoder (#2653)
See https://cbloomrants.blogspot.com/2020/06/widespread-error-in-radiance-hdr-rgbe.html
2020-06-08 11:48:11 -07:00
Pixelflinger
ee6ddf675e syscall (futex) errors are returned in errno
this fixes a problem where our implementation of Condition would not
handle timeouts properly
2020-06-06 15:50:38 -07:00
@roxlu ☾
7e6c38d098 Fix: cannot use parts index for material index. (#2652)
* Fix: cannot use parts index for material index.

* Fix formatting

Co-authored-by: Romain Guy <romainguy@curious-creature.com>
2020-06-06 10:42:53 -07:00
Ben Doherty
7a8755b5b2 Implement framebuffer fetch for Metal backend (#2648) 2020-06-05 17:31:12 -07:00
Romain Guy
2fcca9677d Add Ushimura tone mapping operator
Also fix potential negative values when applying white balance
during color grading.
2020-06-04 15:17:08 -07:00
Philip Rideout
a4094193c3 gltfio: fix AABB when instancing is enabled
If a client opts in to AABB computation and uses instancing, the AABB
would be clobbered with an infinite box.

Fixes #2639
2020-06-04 14:06:50 -07:00
Romain Guy
23b62e2d12 Add ASC CDL (Color decision list) to color grading (#2635)
A CDL is made of slope/offset/power, and is roughly equivalent
to lift/gamma/gain.
2020-06-03 19:01:22 -07:00
Romain Guy
1aa57fc425 Color grading: add saturation and contrast (#2627)
* Add transforms for ACEScct and enabling/disabling color grading in sample

* Add saturation and contrast adjustments

* Rename ACES to ACES_LEGACY and introduce ACES

ACES_LEGACY is ACES with a brightness boost to match our old
tone mapping operator.
2020-06-02 22:54:00 -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
adccf9f432 gltfio: remove details namespace 2020-06-01 09:19:18 -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
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
Philip Rideout
ede09e28e3 gltfio: add JavaScript bindings for instancing. 2020-05-29 09:22:17 -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
Pixelflinger
68f0ab6312 Implement ACES tone mapping
this leverages the new LUT based tone mapping
2020-05-26 23:46:37 -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
Philip Rideout
0e38cc770d filamat: generate spirv 1.0 rather than spirv 1.3
Since we are still on Vulkan 1.0, we cannot use SPIR-V 1.3.
If we try to do so, this error is generated:

    Invalid SPIR-V binary version 1.3 for target environment SPIR-V 1.0

In non-optimized builds, we were already generating spirv 1.0, but
when we enabled the shader optimizer, we generated spirv 1.3.

This bug has actually been around forever, but we did not notice because
we were only invoking the optimizer in release builds, which does not
enable validation.

We cannot upgrade Vulkan 1.1 because the latest LunarG SDK for macOS
does not support it.
2020-05-21 08:41:53 -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
c619f089e7 add support for 3D textures
Only gl backend in this PR.
2020-05-19 14:09:16 -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
Philip Rideout
92048e6b65 filagui: Fix "1 leaked FScene" warning.
Fixes #2542.
2020-05-18 11:51:23 -07:00
Ben Doherty
1ac6f5bbfe Cast shadows by default in gltf_viewer (#2538) 2020-05-15 09:43:21 -07:00
Philip Rideout
764d4198bc Add headless support to FilamentApp and frame_generator.
These changes make it easier to test headless rendering in macOS.

I verified that this works using the frame_generator tool, however
it requires the fixes in PR #2529.
2020-05-14 16:41:39 -07:00
Philip Rideout
fb8b9af8fd FilamentApp: do not recreate SwapChain upon resize.
This is done for consistency with the Android samples. Tested with
gltf_viewer against Vulkan, Metal, and OpenGL. Dragged window between
high DPI and low DPI displays.

Since resizing does not trigger the "NSView has changed" handler in
PlatformCocoaGL, it now must to detect a resize in order to make the
required call to NSOpenGLContext::update() as per the following
documentation.

https://developer.apple.com/documentation/appkit/nsopenglcontext/1436135-update

Fixes #2528
2020-05-14 16:38:07 -07:00
Ben Doherty
f26b556fce Metal: allow swapchain size to change (#2535) 2020-05-14 15:47:49 -07:00
Pixelflinger
79995349d8 use systrace when EXT_debug_marker is not supported
EXT_debug_marker is not supported GL debuggers won't show these
markers, so as an alternative, we dump them in systrace.
2020-05-13 19:36:03 -07:00
Pixelflinger
b4f09325f1 PerViewUib header and .cpp padding didn't match
It wouldn't really cause any issues, because still.
2020-05-13 10:58:23 -07:00
Mathias Agopian
ee3c3d0965 debug option to track Entities (#2526)
* debug option to track Entities

Set FILAMENT_UTILS_TRACK_ENTITIES to true when building libutils to
activate entity tracking. This adds two public methods:

getActiveEntities() and dumpActiveEntities() the later displays the
stack trace of where the remaining entities were allocated.

This is useful for tracking leaks.

* Update libs/utils/include/utils/EntityManager.h

Co-authored-by: Philip Rideout <philiprideout@gmail.com>

Co-authored-by: Philip Rideout <philiprideout@gmail.com>
2020-05-12 17:55:39 -07:00
Philip Rideout
072d17d64f gltfio: use the new material name feature.
To see proof that this works, use gltf_viewer with -u and examine the
node hierarchy. You will now see the correct material names instead of
the ubershader names.
2020-05-08 11:24:38 -07:00
Ben Doherty
3c42ace496 Fix, don't sample from cascades without visible shadows (#2501) 2020-05-07 16:50:34 -07:00
Ben Doherty
0e00dbb967 Add up and down movement to free flight camera (#2494) 2020-05-06 18:30:43 -07:00
KJ Liu
920dc6b167 AssetLoader now loads names for mesh-free nodes. 2020-05-06 17:59:20 -07:00
Ben Doherty
4701945c87 Add rudimentary cascading shadow map support (#2482) 2020-05-06 17:20:04 -07:00
Philip Rideout
cc29359897 gltfio: fix unbound texture warnings in ubershader mode. 2020-05-06 15:24:21 -07:00