Commit Graph

1115 Commits

Author SHA1 Message Date
Mathias Agopian
cd01ad06fd update SPIRV-CROSS to latest
SHA: ff61890722a91e97c44940494be5b6eed0d5ff5b
2021-05-24 13:24:54 -07:00
Ben Doherty
f4070f3fb5 Fix Automation test_settings (#4009) 2021-05-24 09:10:25 -07:00
Ben Doherty
3f9120b129 Fix focusDistance warning in gltf_viewer (#4005) 2021-05-21 15:31:46 -07:00
Philip Rideout
c71c7c70d4 imageio: split HDRDecoder into its own file 2021-05-21 12:36:43 -07:00
Philip Rideout
6607002939 ImGuiHelper: fix support for custom images.
The texture binding in the material instance needs to be restored to the
glyph atlas when a custom image is not in use.
2021-05-21 11:49:14 -07:00
Ben Doherty
5572ef8574 API CHANGE: remove some Camera, Engine, and View deprecated APIs (#3965) 2021-05-18 16:02:49 -07:00
Philip Rideout
afbd6e6606 gltfio: fix morphing bugs uncovered by MorphStressTest.
The code that determined the "base slot" (i.e. the buffer object index
for the first morphed attribute) was very fragile and buggy.
MorphHelper now simply looks up the slot index in a stored mapping,
rather than trying to mimic the AssetLoader to determine the base slot.

Until now, most of the models we tested against only morphed the
position attribute, and never had a large set of target weights that
could be non-zero in a given time slice.
2021-05-14 17:05:27 -07:00
Mathias Agopian
f0d99070e4 Use a UBO instead of a texture for froxels data structure
MATERIAL BREAKAGE: this change breaks materials

In order to use one less sampler, we now use a UBO instead of a texture
to store the "froxel records". Currently this UBO is limited to 16KiB
vs. 64KiB before with the texture.

We also handle running out of record space better, by using a predefined
record that has all the lights in the scene. This way the scene will be
rendered properly, albeit at a potentially large performance cost.
2021-05-14 11:20:24 -07:00
Philip Rideout
c1c5776439 Serialization: enforce correctness for bool.
If expecting a bool and receiving anything other than true or false,
this is invalid and should fail. This change triggered a unit test
failure which uncovered several actual problems.
2021-05-10 13:27:41 -07:00
Mathias Agopian
da418fc7f2 fix another serialization bug 2021-05-10 12:15:52 -07:00
Philip Rideout
f5ee074674 Remote UI: fix lensFlare serialization. 2021-05-10 12:11:25 -07:00
Philip Rideout
a97591a193 Fix minor logic warning. 2021-05-10 08:36:34 -07:00
Mathias Agopian
7e9a69df64 fix lens flare Settings writer 2021-05-07 16:18:52 -07:00
Mathias Agopian
c0fe2d1c09 new screen space lens flare effect
- this PR also improves bloom slightly


Note: for now this is not available on WebGL due to complications
in the bloom pass.
2021-05-07 13:20:16 -07:00
Philip Rideout
e7e19a88e6 Add missing files to BlueVK. 2021-05-07 09:22:23 -07:00
Romain Guy
c66915209e Update our build to the latest and greatest (#3902)
The new requirements are as follow:
- CMake 3.19
- Ninja 1.10
- Android Studio 4.2
- Android NDK 22.1
- Gradle 7.0
- Kotlin 1.5
2021-05-06 10:13:10 -07:00
Philip Rideout
cb4ffe39f4 Fix build break. 2021-05-05 15:00:59 -07:00
Philip Rideout
03fcbfea62 Regenerate BlueVK and update MoltenVK binaries. (#3897)
LunarG just released a new SDK so we're updating everything.
2021-05-05 14:15:52 -07:00
Mathias Agopian
1e1542fe16 ipbprefilter: simplify cpu side
- move kernel weight computation to the gpu side as a small cost, in
order to simplify the CPU side and reduce the binary size.

- skip samples with a weight of 0, which is a completely coherent 
check.

- fix a typo in move ctor
2021-05-04 13:12:39 -07:00
Mathias Agopian
ea34691625 Support a maximum of 8 render buffers (from 4)
We chose 8 renderbuffer because it seems to be commonly supported
on mobile gpu and is more than 6 which is needed for generating
cubemaps. 4 was the minimum guaranteed by ES3.0.

The main changes here are:
- TargetBufferFlags is now a uint32_t instead of uint8_t
- The number of render buffer supported by filament and supported by
  the hardware can now be different. Applications/users now must
  query this value if more than 4 is needed.
- added a backend query (used gl terminology)


This is a redo of a previous attempt. There was an issue in the GL
backend that caused MRT to fail on some devices.
2021-05-04 10:53:07 -07:00
Ben Doherty
808abdb6d7 Fix memory leak inside utils::details::SafeString (#3871) 2021-04-29 14:42:07 -07:00
Ben Doherty
037982a0ef Add gltf-viewer iOS sample (#3873) 2021-04-29 12:13:34 -07:00
Mathias Agopian
8bd73a44c9 Revert "Support a maximum of 8 render buffers (from 4)" (#3868)
This reverts commit 6f948c101f.

This is breaking rendering on Android when certain postprocessing
effects are disabled (e.g. bloom/msaa/dof).
2021-04-27 22:56:10 -07:00
Mathias Agopian
036bfa9b20 Materials now have a quality property.
We used to have that before, but it was hardcoded and depended on
mobile vs. desktop.
With this change, users can set the quality on the material itself.
The default match the current settings. There are 3 quality levels:

low: enables optimization that might not be 100% correct 
     (e.g. abs(x) instead of sqrt(x*x))

normal: like low, but doesn't sacrifices correctness.

high: could be improved upsampling, etc...
2021-04-27 14:20:50 -07:00
Mathias Agopian
2d9064d2bf Cleanup some shader #defines
- create a new FILAMENT_HAS_FEATURE_TEXTURE_GATHER, which can be used
  in the shaders to use textureGather.

- A new TARGET_GLES_ENVIRONMENT and TARGET_GL_ENVIRONMENT in addition
  to TARGET_METAL_ and TARGET_VULKAN_, for completeness.

- Rename TARGET_LANGUAGE_SPIRV to FILAMENT_VULKAN_SEMANTICS and add
  FILAMENT_OPENGL_SEMANTICS for completeness.

- expose the shader model to shaders as: FILAMENT_SHADER_MODEL_ES30 and
  FILAMENT_SHADER_MODEL_GL41

Use these new #define where appropriate.

The main change here is that TARGET_MOBILE is now only used for dealing
with the `mediump` default on mobile.

This change also enables textureGather on Metal.
2021-04-27 14:20:50 -07:00
Mathias Agopian
6f948c101f Support a maximum of 8 render buffers (from 4)
We chose 8 renderbuffer because it seems to be commonly supported
on mobile gpu and is more than 6 which is needed for generating
cubemaps. 4 was the minimum guaranteed by ES3.0.

The main changes here are:
- TargetBufferFlags is now a uint32_t instead of uint8_t
- The number of render buffer supported by filament and supported by
  the hardware can now be different. Applications/users now must
  query this value if more than 4 is needed.
- added a backend query (used gl terminology)
2021-04-27 12:15:22 -07:00
Romain Guy
9c123a59ab New experimental tone mapper (#3850)
* New experimental tone mapper

The new tone mapper proposed in this change replaces Uchimura (see
below) and is composed of two distinct algorithms:

- The first is the customizable compression curve from Timothy Lotte
  (from GDC 2015). The curve's default parameters were chosen to
  match the overall appearance (contrast) of the ACES curves used
  as our current default tone mapper. This was done to provide a
  good migration path to making this new solution the default in
  a future version of Filament.
  The compression curve can be customized via its contrast, shoulder,
  input middle gray, output middle gray, and maximum "HDR value"
  (scene referred).
  It is important to note that the compression is only applied to
  the luminance of the input scene referred value.
- The second is a novel approach by Troy Sobotka called Exposure
  Value Invariant Luminance Scaling (or EVILS). This solution works
  on the largest chromatic channel of the input value as opposed
  to mapping all RGB channels as we do in our other tone mappers.
  The algorithm effectively scales all channel by a ratio that
  depends on both the compressed luminance from the first stage
  and the luminance of input value normalized by the largest
  channel.

This new solution offers important benefits as it manages to
preserve chromaticity for high input values. It is also designed
to provide a desirable rolloff to white on overexposure. This
means that even without gamut mapping, this solution avoids many
hue skews (red to orange, blue to purple, etc.). The results
provided by this solution are much more natural and make using
other color grading tools much easier.

* Use std::pow instead of pow

* Fix Web builds
2021-04-26 18:09:37 -07:00
Mathias Agopian
02c1e1dc60 Improve libiblprefilter
- move public headers from filament/foo to filament-foo/
  to avoid confusion with libfilament's headers
- add support for equirectangular to cubemap conversion
- add support for using an .hdr file directly in all our samples
2021-04-26 12:17:42 -07:00
Mathias Agopian
d589634968 don't set sun parameters if we didn't have SH
The parameters would turn out as NaN.
We might need a better API for this, but it's
never okay to set NaN values.
2021-04-26 10:44:12 -07:00
Philip Rideout
820717df0e gltfio: Use the new Transcoder API in some cases. (#3840)
Fixes issue seen with Vulkan + the quantized version of Avocado.

We already support the quantized glTF extension, which is when this
comes up. Technically this is only needed for Vulkan but gltfio does
not (and should not) know which backend is being used, so we simply
apply these transformations assuming the worst.

In practice this code usually won't be activated, and if even when it
is, it won't hurt loading time as much as other things like large
textures.
2021-04-22 16:11:34 -07:00
Philip Rideout
6178ba4a6b Add Transcoder API for C++ clients. (#3837)
* Add Transcoder API for C++ clients.

We will add JavaScript and Java support in a later PR.

* Transcoder: use fixed inner loop in some cases.

This lets clang produce better ARM code for common cases.

* Transcoder: stronger typing in Config, etc.

* Transcoder: add UTILS_RESTRICT and noexcept.
2021-04-22 13:29:52 -07:00
Mathias Agopian
6f14c1fa91 don't hardcode drawbuffer to 4
This is the first step at trying to un-hardcode the number of drawbuffer
we support. The ultimate goal is to go from currently 4 to 8.

Until now the maximum render buffer supported was the same than the actual
number of render buffer supported. At some point in the future this will
change, it this will have to be dynamic.

This change is to allow rendering a cubemap in a single pass on h/w that
support it. Many mobile GPU support 8 draw buffers.
2021-04-22 11:59:10 -07:00
Philip Rideout
c3d6c853ab gltfio: robustness improvements for Draco meshes.
These changes are motivated by #3815.

See also:
    https://github.com/KhronosGroup/glTF-Blender-IO/issues/1326
    https://github.com/KhronosGroup/glTF-Blender-IO/issues/1345
2021-04-21 18:09:45 -07:00
Mathias Agopian
9575a7453e add an option to control the strength of the importance sampling
This is very useful either with a low sample count, or with a very
HDR image.
2021-04-21 15:41:43 -07:00
Mathias Agopian
cfd9689444 fix several bugs in the gpu prefilter code
- the miplevel wasn't computed correctly
- the random rotation was incorrect
- the default HDR compression was too aggressive
- better validation of the input cubemap
2021-04-21 15:41:43 -07:00
Mathias Agopian
c819265597 Add README.md file and fix some comments 2021-04-21 15:41:43 -07:00
Mathias Agopian
0427787cb7 Generate the kernel texture on the GPU
This avoids having to upload data from the cpu.
2021-04-21 15:41:43 -07:00
Mathias Agopian
e372cc25f2 more fixes from review comments
- get rid of createREflectionsTextures public api
- use default material instance
2021-04-21 15:41:43 -07:00
Mathias Agopian
b98d9dcff3 clarify requirements 2021-04-21 15:41:43 -07:00
Mathias Agopian
91b08705da rename library to filament-iblprefilter 2021-04-21 15:41:43 -07:00
Mathias Agopian
503abb3c94 rename a few things 2021-04-21 15:41:43 -07:00
Mathias Agopian
4b8d98af8c compute all lod kernel at once
we now store the kernel for each lod in a texture, this has several
advantages:
- the texture can be reused, so we can amortize that cost a bit
- we could generate the texture with a shader, so that we don't
  have to do any texture uplaod (TBD).
2021-04-21 15:41:43 -07:00
Mathias Agopian
ced6c3de1f GPU based IBL prefiltering library 2021-04-21 15:41:43 -07:00
Ben Doherty
a166fcdcdf Specific sampler precision only on GLES (#3829) 2021-04-21 10:11:55 -07:00
Mathias Agopian
e64e8927ce don't use TARGET_MOBILE for quality settings
Until now we were using TARGET_MOBILE in our shaders for both 
quality setting and correctness.

With this PR we introduce a new define FILAMENT_QUALITY which currently
can take two value FILAMENT_QUALITY_LOW and FILAMENT_QUALITY_HIGH and
we use that instead of TARGET_MOBILE for quality settings.

Currently, FILAMENT_QUALITY_LOW is selected when TARGET_MOBILE is set.
2021-04-20 13:39:16 -07:00
Philip Rideout
5c437d9163 matdbg robustness improvements / cleanup. (#3799)
* matdbg robustness improvements / cleanup.

* matdbg code review feedback
2021-04-14 11:39:42 -07:00
Ben Doherty
afdc3d068c Add default precision qualifiers for special sampler types (#3786) 2021-04-09 10:12:03 -07:00
Mathias Agopian
391cf2487a add missing parameters in ssao serialization 2021-04-06 17:52:01 -07:00
Philip Rideout
914503a30e gltfio: honor stride in normalizeSkinningWeights.
This fixes the issue seen with RecursiveSkeletons.gltf, which is a model
that might soon be added to the Khronos sample models repo.

Fixes #3765.
2021-04-06 15:42:21 -07:00
Philip Rideout
17b8717557 Fix unit test regression. 2021-04-06 15:04:10 -07:00