Commit Graph

535 Commits

Author SHA1 Message Date
Benjamin Doherty
401bd8ce73 Bump version to 1.9.24 2021-05-07 21:35:30 -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
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
Benjamin Doherty
b3f43eea13 Release Filament 1.9.23 2021-05-03 10:39:26 -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
Philip Rideout
4006018907 Fix Java warnings. (#3856) 2021-04-26 13:49:49 -07:00
Benjamin Doherty
f68dbe1902 Release Filament 1.9.22 2021-04-26 10:52:37 -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
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
Mathias Agopian
f8ced1170e fix typo that broke java apps 2021-04-21 15:15:01 -07:00
Mathias Agopian
b1d877e7db Add Engine::getEntityManager() 2021-04-20 16:12:40 -07:00
Romain Guy
3f09e62f23 Fix docs 2021-04-20 14:40:04 -07:00
Benjamin Doherty
623833a5d6 Release Filament 1.9.21 2021-04-19 11:19:05 -07:00
Mathias Agopian
f7eb55f2f5 NEW API: Renderer can process standalone View
New Api:

- Renderer::renderStandaloneView() is a new method that can be used
  outside of beginFrame/endFrame on Views that have a RenderTarget
  associated. This can be used as a poor man's compute API.

Improvements to Renderer:

- more aggressively skip lighting/shadowing code that won't be
  needed by the current view

- Allow up to 64 KiB to be allocated from the render stream, up from
  1 KiB
2021-04-19 11:17:38 -07:00
Philip Rideout
b8ed546555 Fix minor warnings. 2021-04-13 13:59:02 -07:00
Benjamin Doherty
0ac2fe02dc Release Filament 1.9.20 2021-04-13 11:49:19 -07:00
Philip Rideout
c994ab9f60 sample-gltf-viewer: more improvements for zip files.
- If a resource file is missing, show toast instead of crashing.
- Allow glb files in zip files.
- Run blocking calls like createTempFile() on IO thread.
2021-04-13 11:20:08 -07:00
Mathias Agopian
600600b9af allow the public RenderTarget API to use MRT 2021-04-13 11:02:37 -07:00
Philip Rideout
965e845133 sample-gltf-viewer: Delete zip file when done reading. 2021-04-12 16:03:30 -07:00
Philip Rideout
7107afbf0f sample-gltf-viewer: Prevent OOM for large models like Bistro. 2021-04-12 16:03:30 -07:00
Mathias Agopian
cbb809e535 enable contact-shadows functionality in mobile gltf-viewer
contact-shadows needs to be enabled per object.
2021-04-12 15:11:18 -07:00
Ben Doherty
1cde9b326c Fix bad Javadoc in Texture.java 2021-04-12 11:57:18 -07:00
Philip Rideout
8fd1cefcdf sample-gltf-viewer: keep screen turned on 2021-04-07 16:39:29 -07:00
Ben Doherty
03f7ac6ef4 Fix Material and MaterialInstance Javadocs (#3778) 2021-04-07 14:21:32 -07:00
Mathias Agopian
ee9d87b543 use more reasonable near/far for gltf viewer 2021-04-06 17:55:51 -07:00
Philip Rideout
24c5cbac68 ModelViewer and Remote UI now support focal length.
The focal length slider now works over a remote connection. Also, the
slider for focus distance now controls the value in `ViewerSettings`
(which gets applied to Camera) rather than the value in
`DepthOfFieldOptions` (which is deprecated).
2021-04-06 14:17:07 -07:00
Philip Rideout
82fcb656d9 gltfio: Use BufferObject API, simplify MorphHelper. (#3737)
* gltfio: Use BufferObject API, simplify MorphHelper.

* Repair Android build.
2021-04-05 13:00:39 -07:00
Philip Rideout
a139d7fc01 Fix Java warnings.
This adds the 565 enum to a switch block (which is an actual bug),
and it fixes a JavaDoc warning about missing summary fragments (which
is just a silly warning).
2021-04-05 13:00:15 -07:00
Benjamin Doherty
3fbc4f2915 Release Filament 1.9.19 2021-04-05 11:14:51 -07:00
Thomas Gorisse
fe94f935f1 Expose TransformManager.getParent(int) (#3751)
It will be nice to have access to TransformManager EntityInstance parent.
2021-04-03 15:45:46 -07:00
Philip Rideout
ded542a543 Introduce BufferObject API.
NOTE: after Metal and Vulkan support lands, we can potentially simplify
the Driver API by removing some of the old VertexBuffer entry points.

This introduces a new API-level object called `BufferObject`, and a new
backend-level object called `HwBufferObject`. This encapsulates a single
VBO. It's especially useful when clients need to share data between
multiple VertexBuffer objects. (e.g. for morphing).

In the future, buffer objects could perhaps be used for non-vertex data
(e.g. for compute).

The existing `VertexBuffer` class can now be configured to use buffer
objects by calling `enableBufferObjects` on the builder. By default its
API is unchanged. If buffer objects are enabled, then clients should use
`setBufferObjectAt` (which takes a buffer object) rather than
`setBufferAt` (which takes CPU data).

OpenGL is the trickiest backend for this, due to existence of VAOs.
The implementation in this PR uses a version-tracking scheme to
figure out when to update the VAO.
2021-04-01 14:52:06 -07:00
Mathias Agopian
385a17b8a5 DoF: add many user settings
- native/half resolution
- gather kernel ring counts
- circle-of-confusion radius clamps
2021-04-01 14:42:10 -07:00
Mathias Agopian
625c4d8968 implement query for texture swizzle
unfortunately metal does support texture swizzle on all versions of
macos we support.
2021-03-30 14:24:17 -07:00
Philip Rideout
d2bff95c90 Easy build: add matdbg option and help message. 2021-03-30 08:14:23 -07:00
Benjamin Doherty
83ba56d3e7 Release Filament 1.9.18 2021-03-29 11:05:44 -07:00
Mathias Agopian
acb2da7759 Improvements to Camera APIs (#3701)
* move the focus distance from DofOptions to Camera

The DofOption parameter is now deprecated, but will still work if the
focus distance is not set on Camera.

* A few new helper APIs on Camera

- getFocalLength() which returns the focal length used internally for
  DoF computations.

- computeEffectiveFov() and computeEffectiveFocalLength() which can be
used to better simulate a real camera's FOV changes with the
focus distance.

Modified gltf_viewer so it uses the effective fov/focallendth when
DoF is active.

* simplify setLensProjection

We can call setProjection directly instead of converting to a fov
first, which ends up performing atan(tan(x)).

Also improve parameters names.
2021-03-25 15:22:19 -07:00
Ben Doherty
ad555d897d Expose MaterialInstance APIs that should have been public (#3703) 2021-03-25 11:29:39 -07:00
Mathias Agopian
7b0a8cf2c2 fix JNI setImage and friends buffer size calculation
- setImage() used the width of the texture for calculating the required
  user buffer size, but this was too large when only updating a
  portion of the texture. It would result in a BufferOverFlowException.

- setImage3D() had the opposite problem where it didn't take into
  account the depth of the texture.

- the offset in the user buffer was called "bottom" on the C++ JNI side,
  but it is called "top" on the java and filament side.

Fixes #3685
2021-03-24 12:20:16 -07:00
Philip Rideout
495fb14b9c Move Camera settings from gltf_viewer to SimpleViewer. 2021-03-24 08:24:00 -07:00
Mathias Agopian
4de1b0de2d DoF: add a "filter" parameter to the DoF settings
Currently the only NONE and MEDIAN are available options, at some 
point we may add a "MAX" option which is cheaper.

There is no real practical uses for this option with these only two
choices, other than for debugging.
2021-03-23 17:27:31 -07:00
Benjamin Doherty
07140cf2fa Release Filament 1.9.17 2021-03-22 10:16:02 -07:00
Romain Guy
28acd0fa6a Update build scripts to match latest AGP and Kotlin 2021-03-19 12:44:25 -07:00
Philip Rideout
0b91f3d785 Add deprecation annotation to Camera. 2021-03-19 11:04:30 -07:00
Philip Rideout
8d78b1f2e1 gltfio: Add internal MorphHelper, enable up to 255 targets. (#3661)
* gltfio: Add internal MorphHelper, enable up to 255 targets.

Previously, gltfio could not animate models with more than 4 morph
targets. Now we can handle up to 255 targets, as long as no more than
4 targets are ever used simultaneously. This allows us to handle
many more models, such as those exported by Modo, and the horse model
in #1852.

We do this by picking the highest 4 weights. The indices for these
weights are called the "primary indices", and we construct a new
VertexBuffer for each unique set of primary indices.

In the near future this will be made more efficient by adding a new
VertexBuffer API to the Filament core.

Fixes #1487.

* Code review fixups.
2021-03-17 15:52:24 -07:00
Philip Rideout
20b0972130 gltfio: Refactor the tangents job.
This cleans up the glTF tangents generator and allows it to be used
in other parts of the library.
2021-03-16 16:43:02 -07:00
Benjamin Doherty
240d9d0919 Release Filament 1.9.16 2021-03-15 10:11:11 -07:00
Philip Rideout
cf75b11cba Add missing deprecated annotations. 2021-03-12 13:33:14 -08:00
Philip Rideout
81bba4644a Remove unused imports. 2021-03-12 13:07:29 -08:00
Philip Rideout
52abe75cfd RemoteServer code cleanup and logcat cleanup.
This fixes two different logcat messages that would occur when scrubbing
a slider in the UI:

- "Discarding message, message queue overflow."
- "Downloading model..." would repeat itself needlessly
2021-03-11 07:52:32 -08:00
Mathias Agopian
e657921b5a Camera API improvements
- Add a "shift" parameter to Camera. This has the effect of translating
  the viewport, without changing its size. 
  This is an effect similar to using a shift lens.

- Camera::setScaling() now takes a double2 instead of double4, this is
  because scaling the result of the projection in the Z direction 
  can lead to very confusing problems -- it will essentially move the
  near/far planes, and we don't want to expose that as a public API.

- setCustomProjection() now allows to set a different projection for
  rendering and culling (useful for e.g. for using an infinite far 
  rendering projection matrix).
2021-03-10 16:01:29 -08:00