This basically adds two settings:
- highPrecision at the View level, which controls the bit depth
of the vsm shadow texture used. This affects all shadowmaps.
- elvsm per shadowmap, which enables Exponential Layered VSM.
the main change in the shaders is that we now always output the
"negative" EVSM, even when it's not enabled. If no shadowmap uses
ELVSM, then the texture is stil an RG texture and the calculation is
lost (with some luck culled by the shader compiler), either way it's
not a lot of math and it's done only once per shadow texel.
During the color pass, on the other hand, we compute the "negative"
EVSM only if enabled.
When the guard band is enabled, the effective rendering area is
increased by a certain amount (currently 16 pixels on each side) so
that screen-space effects (e.g. SSAO, SSR, DoF) behave better around
the edges of the screen. Of course, this comes at a performance and
memory cost.
Currently the guard band is not configurable other than being optional.
Added c++, java and js bindings.
Java callbacks are now directly dispatched to their handler, instead
of first going through filament's opportunistic dispatch, reducing
callback latency.
This is a pixel accurate implementation of picking. Picking queries
can be created on view, and upon completion a user provided callback
is called with the Entity of the renderable at the queried coordinates
in the viewport.
Picking queries typically have 1 or 2 frame of latency and may impact
performance on some drivers.
It is mostly intended for use by editors, or when latency is not a major
concern. This api should not be used for dragging/moving objects, it is
intended for initial picking only.
Picking is implemented in the structure pass.
The depth buffer value is retrieved and the fragment coordinate is
reconstructed and passed to PickingQueryResult. This can be used in
turn to calculate the view and/or world space position.
We now have an option for evaluating the bent normals from SSAO.
This is used to improve specular AO.
Currently these bent normals are not used for diffuse lighting because
they're "flat" (face normals), which is too distracting.
The bent normal buffer is stored in the SSAO texture, in a separate
layer. This is the first post processing effect that uses 2D array
in order to limit our sampler usage.
This CL also changes how we handle SPECULAR_AO_BENT_NORMALS when
material bent normals are not available: we're now using the "Cones"
algorithm with the regular normal, instead of Lagarde's approximation.
This can have a dramatic effect on SSAO and needs
to be adjusted based on the scene's scale/units.
The default value used to be about 6cm, and has
been changed to 5mm.
- use EVSM (exponential VSM), helps a lot with light bleeding
- don't apply shadow biases with VSM
- improve VSM user settings: added more controls, expose to java
- minor code cleanups:
- rename some structures
- remove unused parameters
- remove unused uniforms
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.
- 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.
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.
.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.
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.
- 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
* 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
* 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
- 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.
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.
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.
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.
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.
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).