It is legal for the app to draw a frame even when FrameSkipper
detects that a frame should be skipped. In that case we used to
overwrite the most recent fence, but this wasn't ideal. We now
proceed as if the fence had signaled, i.e. we destroy it and
move all the fences up, creating a new one at the end of the
delayed array.
This is because the shadowmap doesn't store depth values so it doesn't
work to "flatten" all casters behind de camera to the near plane.
The bulk of shadowing works but the filtering/edges don't always.
Disable depth-clamping when VSM is enabled.
vk, metal and desktop gl all support depth clamp, GLES/android also does
with ANGLE. Add support for it in the backends.
use depth clamp to improve directional shadow quality; this allows
to render everything that's behind the camera at the same "zero" depth,
so we can reduce the depth range we need.
Fixes#6293
shadow cascades where not calculated properly because part of the
calculation took the cascade near/far into account, while another
part didn't. This resulted in cascades being too large. It didn't
create wrong shadows, but reduced (and in some case canceled) the
usefulness of the cascade.
We fix the problem by always using the projection matrix only for
describing the cascade's frustum, as opposed to just passing the
near/far plane distances.
Now the calculation of each cascade is completely self contained and
identical.
We also improve the orientation of the light frustum:
We can rotate the light frustum around the light direction axis, so
it aligns with the view direction, this generally result in smaller
light frustums. This cannot be used in stable mode.
A recent change broken the optional "depth clamp" as well as the
computation of the far plane of the light frustum. There was also
a case where DEBUG builds could assert.
- The far plane was no longer being "optimized" (i.e. moved as close
as possible), which resulted in less optimal use of the shadow texture.
the far plane can be moved as close as the farthest visible shadow
caster.
- After the camera/light frustums intersection we now see of the 2D
bounds seen from the light are empty and if so we bail, which prevents
an assertion later.
- finally, the "DEPTH_CLAMP" option is also updated for the new code
structure.
We relied on layout transition to emit a barrier, but sometimes
it's skipped. In that case, we explicitly emit a barrier for the
transition from attachment -> sampler.
Without this, we'll hit read-after-write sync validation error
and produce various artifacts (e.g a fade to white effect) on
different platforms.
- the last View created was always overriding previous View's datasource
- because of lazy registering of the data source it was possible that
the registering lambda was called after the view was destroyed, leading
to crashes
- all view would share the same PID parameters and these would be
initialized to default value instead of the user provided value. so
debug build would behave differently.
With this change we improve things:
- now only the first view gets to publish its data source. it's still
not ideal, but works for our use case with gltf_Viewer
- the view can now unregister itself when it's destroyed
- only the view that successfully registered uses the debug PID values
and publishes its data source.
- the normal parameters are used until we query the datasource (from
imgui), so by default the behavior is now identical to release builds
This fixes a crash in gltf_viewer when opening the Debug panel.
Print a warning in case the sterescopic type in a compiled package is
different than what's in the engine's setting. The application may
proceed, but it could end up visual glitches when enabling stereoscopic
rendering.
This requires the stereoscopic type to be written into the package,
which needs a material version bump.
This reduces the latency of the timer query result; with the previous
code the latency could only increase, but there is no reason to wait
a whole frame for reading the next available result.
We just loop over them until we find one that has not signaled; instead
of doing one per frame.
we now have two levels of debug markers. Those that come from the "user"
(i.e. filament itself) are now always enabled and generate both
systrace and gl markers. the 2nd level is internal and always
disabled by default. Of enabled at compile time it'll emit markers for
each driver API method.