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.
* WIP New tone mapper API
* Implement tone mapper constructors and destructors
* Add new genertic tone mapper
* Make the generic tone mapper available in our sample UIs
* Fix warnings and crashes
* Fix generic tone mapper and graph mappers in the UI
* Add Java APIs for ToneMapper
* Implement copy/move operators for GenericToneMapper
* Generalize luminance scaling in color grading
Previously the luminance scaling step was tied to a specific tone
mapping operator, called "EVILS" in the API. This was however
somewhat misleading as EVILS really is a color handling system
that's independent of what we call tone mapping.
This change splits the luminance scaling step from the tone mapping
step, allowing the use of luminance scaling (the LICH part of EVILS)
with any tone mapping operator.
As a result, the operator known as EVILS is currently mapped to the
linear operator and renamed to "RESERVED" until it is replaced by
a proper — configurable — operator.
* Update release notes
* Fix web build
We make better use of the framegraph, by using a pass per shadowmap,
instead of generating all shadowmaps in a single framegraph pass.
This allows us to use less temporary memory when blurring, but also
simplifies the code.
* 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
- 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
* Add support for sheenColor and sheenRoughness
This work is necessary to support the glTF extension KHR_materials_sheen.
This change effectively adds the specular lobe from the cloth material
model to the base material model. The cloth model remains useful for
its extra subsurface color feature but also because it's cheaper.
* Add support for KHR_materials_sheen to gltfio
* Update documentation
* Document default shading values
- 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.
This is a technique from Naughty Dog used in TLOU2, where we compute
the "ambient" shadowing of a dominant light in screen-space.
This is currently integrated to the SSAO pass.
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.
- inScatteringSize actually cannot be set to zero because it produces
a 0^0 in the shader. So with this change, in-scattering must be
strictly > 0 to enable.
- inScatteringSize on the java side had an incorrect default value of
zero (which of course, now doesn't matter anymore).
- also clamp the fog altitude to 1mm which simplifies the shader quite
a bit for the same result.
Fixes#3069
all parameters of the bilateral blur can now be set from the CPU,
instead of being hardcoded -- this probably prevent the shader compiler
from unrolling the filter, but it's also probably not a big deal.
additionally, we now use a kernel size of 23 (12 samples) when the
SSAO quality is set to HIGH or more.
ssaogen is no longer needed
Higher quality levels used to darken the ssao a lot, now they all have
a consistant look.
Add quality control to material sandbox.
Slightly simplify shader code.
- fix a recent typo that affected SSAO quality
- add a upsampling quality checkbox in material_sandbox
- make use of textureLodOffset instead of texelFetch, so that
we emulate more closely textureGather
- don't hardcode bilateral filter edge-distance in the shader
(still hardcoded on the cpu side)
* 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.
* Add new color grading feature: shadows/mid-tones/highlights
This feature can be used to color correct specific tonal ranges.
The tonal zones can be precisely controlled.
* 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
* Prep work for proper color grading
* Bring back local colorGrading bool to drive that pass
* Fix formatting issue
* Add missing case for the color grading pass
* Fix formatting issues
* Formatting issues
Emissive was previously defined in exposure compensation stops, which
was confusing to many. It is now a value in nits, with the alpha
channel controlling how much the camera exposure affects the emissive.
At 0, the emissive value is just added to the final pixel color, at
1 the emissive value is multiplied by the exposure just like with
regular lights.
The intensity of the emissive property can be computed from an
exposure value (EV) easily with the following formula:
emissive.rgb = emissive.rgb * pow(2.0, EV - 3.0);
This formula is available as Exposure::luminance(float) already
in Filament.
- handle heightFalloff=0 (i.e. fog doesn't depend on height) correctly,
previously, a divide-by-zero on the cpu side would get in the way.
The fix is to clamp heightFalloff to a small-enough value, and to
make sure that this is handled correctly in the shader.
- default fog distance is 0 instead of 1m
- inScatteringSize parameter should be allowed to be large in samples