Commit Graph

43 Commits

Author SHA1 Message Date
Pixelflinger
8b3caeffb9 ssct: decouple shadow distance from sample count 2020-10-01 10:20:38 -07:00
Ben Doherty
229fdc9be5 Add View::setShadowType JNI binding (#3094) 2020-09-30 13:20:39 -06:00
Pixelflinger
583c1c07cf SSCT optimizations and fixes
- Use lower depth LOD as the cone radius increases.
  This is the same technique we use for SAO.
  The better cache access significantly improve performance.
  On a test on Pixel4 at 585MHz, SAO pass improves by 30%.
  This also helps the algorithm scale with the shadow distance.

- Shadow direction/length no longer dependent on aspect-ratio and camera
  orientation.
  This is fixed by doing all the computations in screen-space instead of 
  normalized screen space.

- Shadow parameters are no longer dependent on the field of view.

- Also rename dominantLightShadowing.fs to ssct.fs

- remove zoom parameter, it wasn't very useful.
2020-09-29 17:00:32 -07:00
Pixelflinger
075486724f Add JNI support for SSCT 2020-09-28 10:53:30 -07:00
Pixelflinger
0f2993aec7 Decouple SSAO bilateral filter from quality setting 2020-09-28 10:53:30 -07:00
Pixelflinger
c3975f2640 APIs to enable/disable screen space refraction
Just like with shadows, this is a toggle to entirely disable
screen space refraction.

Added missing getters, and minor refactoring.
2020-09-21 16:30:56 -07:00
Pixelflinger
73f1ddfebf ssao: reduce creases caused by geometry tessellation
We borrow a page from the HBAO book here and allow to limit the angle
with the horizon of SSAO samples. This can help reducing the effects
of low tessellation, which tend to create unwanted creases with SSAO.
2020-09-20 22:34:34 -07:00
Pixelflinger
dc16eb04f8 rename .blurScale to .cocScale in dof options
.blurScale was in fact a scale factor applied to the circle of
confusion (which makes it indeed a "blur scale", but let's use
a more precise language here). 

Update comments to show how to  use .cocScale to control the DoF
effect independently from the camera aperture, which can be useful for
artistic reasons.
2020-09-14 22:22:52 -07:00
Pixelflinger
bb8cd6677d optionally compress highlights before bloom
This avoid unrealistic looking bloom halos from very strong highlights.
This is enabled by default.
2020-09-01 09:46:23 -07:00
Pixelflinger
08e411aeac API CHANGE: make ssao options work like all other options
setAmbientOcclusion (and associates) is now deprecated (but still works),
in favor of the new .enabled field in AmbientOcclusionOptions.
2020-08-10 17:23:03 -07:00
Pixelflinger
8155bf04a8 Implement variance clamping
variance clamping further shrinks the min/max AABB
2020-08-10 11:14:34 -07:00
Pixelflinger
05bfa632ff Add TAA java bindings 2020-08-10 11:14:34 -07:00
Romain Guy
132e94b3bb Add vignette post-processing effect (#2743)
* Add a vignette post-processing effect

* Use numeric limits instead of hard coded values
2020-06-26 17:44:17 -07:00
Romain Guy
1935598a7d Add Java bindings for ColorGrading (#2638) 2020-06-04 11:03:15 -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
e80ea979a4 improvements to DoF
- bokeh rotates with the aperture diameter
- match sample count on cpu and cpu sides which affects CoC calculation
- feather blur radius to avoid visible "steps" in bokeh size
2020-05-05 11:38:32 -07:00
Pixelflinger
4e873e8007 A new depth of field (DoF) post-process effect 2020-04-30 13:22:28 -07:00
Mathias Agopian
1b36f82c1e API BREAKAGE: this change aims to fix multi-view support (#2376)
* API BREAKAGE: this change aims to fix multi-view support


What has changed:
- View doesn't have a notion of clear color anymore
- View doesn't have a notion of discard flags anymore
- The clear color and color-buffer discard/clear flags are moved to Renderer
- Skybox can now be set to a constant color
- View have a blend-mode

What does is all mean:
"Clearing" (i.e.) setting its background is now handled by Skybox, by
setting a constant color to the Skybox. This should take care of
drawing views side by side.

When a view needs to be drawn on top of another, it's BlendMode needs to
be set to TRANSLUCENT and of course and, generally, it wither won't have
a skybox, or will have one that sets some translucent pixels.

As an optimization, a View with BlendMode::OPAQUE will have its
background cleared with the color specified in Renderer.

If the SwapChain already has some content, it's now possible to set
the Renderer to not discard the content, together with TRANSLUCENT views,
it's possible to draw on top of that content.


It is NOT possible to share depth/stencil buffers between views.

Fixes: #2369, #2372, #2364

* Address reviewers comments.

Note: WebGL is still broken with this PR
2020-04-10 15:54:14 -07:00
Romain Guy
1ef3535ba7 Expose Java API to control discard flags (#2368)
* Expose Java API to control discard flags

This change also adds the new sample sample-multi-view that shows
how to use discard flags to render multiple views.

* Disable clears
2020-04-08 16:03:49 -07:00
Pixelflinger
746e273336 rework how dynamic resolution scaling is specified
- now the DynamicResolutionOptions don't specify the target frame rate,
  they only specify how to scale this given view

- there is a new FrameRateOptions setting on Renderer, which is used
  to specify the desired target frame rate for the whole Renderer

- the frame rate is now specified as a "frame interval" in units of
  the display frame period.

- the display frame period is (indirectly) set via DisplayInfo.

In other words, the use must set (and update) DisplayInfo properly
(the default are reasonable, but assume 60 Hz). They must also set the
desired interval (default is 1, which is probably what you want).
Finally they must enable dynamic scaling per View, the defaults are
also reasonable.

Currently Renderer doesn't attempt (yet) to actually target the
requested frame rate, so it's up to the caller to push frames at the
desired speed. however, dynamic resolution, like before, will attempt
to shrink work to fit the target.
2020-04-06 16:55:24 -07:00
Pixelflinger
b4f5a4a0a0 Fog improvements
- optimized the fog computations
- fixed issues with the skybox
- added the option of getting the fog color modulated by the IBL envmap
2020-03-24 22:29:25 -07:00
Mathias Agopian
0c6d96c407 Add support for basic fog (#2256)
* Add support for basic fog

* address reviewers comments
2020-03-19 18:01:07 -07:00
Pixelflinger
8866e2829f Add a quality option to dynamic-scaling
It controls the quality of the upsampling filter. This can help a lot
if heavy scaling is needed to maintain performance, it also helps if
MSAA is not enabled.

There are 3 quality levels, low, medium and high. 1, 4 and 9 bilinear
taps are used for each level respectively. The high quality setting
employs a tent filter.
2020-03-08 22:28:10 -07:00
Pixelflinger
675012a2eb Added a quality level parameter for SSAO
Currently it only selects how many samples are used.
Low,medium,high and ultra respectively map to 7,11,16 and 32 samples.
The default is "low", which is sufficient for most mobile applications.
2020-02-20 11:26:10 -08:00
Mathias Agopian
4e8f323e47 Reduced AO processing time by 1/3
This is achieved by computing a small 2x2 box blur in the AO pass
taking advantage of quad shading, which allows to halve the size
of the bilateral blur kernel.

Reducing the size of the blur kernel has a side effect to kick Adreno
gpu into direct mode, which apparently is much faster here.

Overall we go from 3.4ms to 2.4ms on Pixel4.

The quality is impacted, but not severely. This probably assumes 
GPU that have working derivatives.
2020-02-19 22:09:53 -08:00
Mathias Agopian
8bbf0ce9ef Bloom can now have a dirt texture applied 2020-02-13 20:51:43 -08:00
Mathias Agopian
b17c51e340 Add a threshold option (enabled by default) for bloom.
Threshold can be either on or off, and only thresholds at 1.0 when 
activated (in pre-exposed mode).

This allows to use very high strengths values for the bloom without
softening the rest of the image, and is useful for artistic considerations.
2020-02-11 16:15:04 -08:00
Mathias Agopian
bccb8260e2 Implement a Bloom post-process effect 2020-02-11 12:15:57 -08:00
Mathias Agopian
610dca88a3 Remove everything related to the depth-prepass
depth-preass is no longer supported.
2020-01-29 13:32:45 -08:00
Mathias Agopian
3105a8330e remove unneeded includes in public headers
Replace with forward declarations if needed and includes in .cpp that
now need them.
The idea here is to have our headers have the least amount of impact as
possible on our clients (e.g. compilation time).
2020-01-24 12:13:48 -08:00
Pixelflinger
0da551c7fd More improvements to SSAO
- we add an 'intensity' parameter that allows to control the strength
  of the AO effect. This is useful for aesthetic reasons.

- the default intensity is now 2x that of before this change, which
  makes the intensity parameter match AO papers this implementation
  is inspired of.

- bias is now z-dependent, which reduces some self shadowing wrt the
  depth.
2019-11-15 09:42:37 -08:00
Philip Rideout
1139209551 Add JNI bindings for RenderTarget.
New Kotlin sample app is forthcoming.
2019-06-12 10:18:30 -07:00
Mathias Agopian
aee938b51e Added resolution quality setting for SSAO 2019-06-10 15:45:32 -07:00
Mathias Agopian
cbae6120e1 Ambient Occlusion APIs are more descriptive
Use “AmbientOcclusion” instead of SSAO in all APIs.
2019-05-09 16:36:18 -07:00
Mathias Agopian
011daa952e Add API for controlling SSAO 2019-05-09 16:36:18 -07:00
Mathias Agopian
9daf7aab64 Decouple tone-mapping, fxaa, msaa and dynamic resolution
It's now possible to enable/disable tone-mapping, fxaa, msaa and
dynamic resolution independently.

A new set/getToneMapping() method is added to View.

It's still possible to disable *all* these post-processing effects
together using setPostProcessing(). This is currently needed when
rendering a transparent view (such as UI) on top of another view.
This limitation might be addressed in the future.

This fixes #621
2019-03-19 11:38:47 -07:00
Mathias Agopian
6e4491c852 Make dithering an enum. 2019-03-12 13:32:28 -07:00
Mathias Agopian
07bb62490b Add an option to turn dithering on/off 2019-03-12 13:32:28 -07:00
prideout
5ee359cf40 Move math namespace to fix #746. 2019-02-07 09:23:07 -08:00
Romain Guy
6ae21d3825 Add View::setFrontFaceWindingInverted() API (#602)
* Add View::setFrontFaceWindingInverted() API

This API can be used to flip all meshes in a render pass
inside out. This is useful for mirrored rendering.

This change also disables face culling on the default skybox
renderable. Since it is unlit, there is no downside to this
and the mesh being in the device vertex domain it can never
be backfacing unless front face winding is inverted.

* Track face winding state in Vulkan
2018-12-07 16:36:03 -08:00
Romain Guy
bd0b752337 Add RenderQuality API (#555)
View::setRenderQuality gives the ability to control the rendering quality
of a given view. In particular this allows the app to lower the quality
of the HDR color buffer by using R11G11B10F instead of RGB(A)16F.
2018-11-29 16:55:36 -08:00
Romain Guy
34c170d4da Add Android sample app (#181)
* Add Android sample app

It’s a simple rotating triangle but provides a good overview of how to use Filament on Android

* Remove unnecessary files
2018-08-29 09:01:28 -07:00
Romain Guy
b3d758f3b3 Initial commit 2018-08-03 10:38:22 -07:00