- remove PCF "low" quality, we only use "HARD" now, when using PCF.
Higher quality levels are achieved by using VSM.
- added a version of PCF that doesn't use a shadowSampler for future
use.
The normal bias is now computed correctly, this requires to compute
the z in lightspace in the shader.
Note that this would not work as well if we used LISPSM, but we'll
cross that bridge when we get there.
- constant bias and normal bias default values in java didn't match
C++ or the documentation
- stable shadows were enabled by default in java
- polygon offset biases were missing from the java API
- document and don't apply polygon offset to VSM
- remove unused code
We now cull the shadow casters before computing the near/far plane
for spotlights -- we can do that because we know the light's frustum.
So only these casters that contribute to the shadow are accounted for
when calculating the near/far plane.
This PR also include more cleanup and simplifications.
Near/far plane is now computed dynamically, this significantly
improves the shadowmap depth resolution.
Quite a bit of refactoring was necessary to get all the right data
in the right place, in particular SceneInfo is now passed around for
both directional and spot shadows.
The froxel code was failing when a spotlight cone was too narrow. This
is fixed here by never using a cone smaller than 0.5 degrees during
forxelization.
Additionally we now silently clamp the cone angles to 0.5 degrees at
the API level because, the falloff was also failing due to floating
point precision in the shader.
Finally, we clamp the inner cone upper value to the outer cone's
instead of the other way around. i.e. the outer cone defines the
spotlight while the inner cone just controls the falloff.
When calculating the linear depth for VSM, we were using the whole
range between 0 and the far plane, the near plane wasn't taken into
account.
This can be a problem is the light is very far, but it's near plane is
closer to the camera/scene, in this case the depth precision wasn't
used optimally.
Note that we don't hit this problem currently, because the directional
light is constructed such that its origin is at the near plane, and the
spotlights have a fixed near plane (which is a problem and will be
fixed at a later time).
The bug that prevented them to work has been worked around, but we
don't know when or how. The original bug still exists as demonstrated
by our standalone test apk.
For now, we reenable MSAA VSM on Adreno.
* Perform sanity check when combining static libraries
This is a small modification that simplifies Debian packaging when one
or more vendored dependencies are replaced by system shared libraries
and no longer need to be combined with a Filament library.
* Verify vendoring before including license texts
This is another small modification to simplify Debian packaging when one
or more vendored dependencies are removed and replaced by system
libraries, so they no longer need to be considered when compiling the
license texts.
- remove PCF MEDIUM and HIGH quality -- these were never used in
practice, and "quality" really meant "blurriness", now we have VSM
for doing that with much more control and more efficiently.
PCF_HARD is now the default. PCF_LOW is still available at compile time
for now. It shouldn't be needed though because VSM can achieve the same.
Moved the divide-by-w of light space into the shadow() method -- which
known if it should be done or not.
The codebase needs only a few additional standard #includes to compile
against libstdc++ on Linux; presumably those headers are implicitly
included with MSVC's and Clang's standard C++ library, but even if
libstdc++ compatibility is not a goal, it is advisable to have them
included directly.
in particular add a terminate() method to FrameSkipper instead of
destroying driver objects in the destructor -- this matches all other
objects.
also remove dependency on FEngine which wasn't needed.
- move the control code out of FrameInfo and into
View itself. FrameInfo now just gathers information about the
frames instead of also doing part of the control.
- the control code has been refactored into a more formal PIDController.
- a few bugs were fixed in the control loop and default parameters
tuned.
The control loop itself now outputs a relative scale factor instead
of an absolute one. The relative scale factor seems easier to
control and is less jittery, and doesn't have to rely on the "integral"
term of the PID.
It's possible that more tuning is needed, but the scaling is now
more stable.
- remove getProperties() we'll put it back if we need it some day
- use unordered_map because it generates less code than robin_map and
here performance is not critical
- defaults to 31 history points instead of 3, this gives a much better
estimate of the frame rate.
- make sure the calculations work for any definition of our internal
duration<> (it's useful to use milliseconds when dealing with
refresh periods).
- don't round to 8 pixels if the scale factor is exactly 1
- fix a few comments and warnings
* mipgen: Linearized PNG bitmaps (such as normal maps) no longer perform gamma transform on read.
* mipgen: Using "-k normals" argument now works for all file types, not just KTX
* Web: Exposed SurfaceOrientation functions getQuatsHalf4() and getQuatsFloat()
Unfortunately this bug appeared in recent drivers on some devices, it's
virtually impossible to know which device/drivers have this issue, so
the workaround is active for all Adreno GPUs.
glInvalidateFramebuffer is too aggressive and prevents loading of the
GMEM even if it's only called at the end of the render pass.