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.
- 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.
- use the same code on both ends of updating the free space. i.e.
both side compute the "used" space in exactly the same way.
the math was the same before, but the code was different which
could be confusing.
- assert for overflow before queuing the buffer. It wouldn't matter
anyways, because it's done with the condition lock held, so the
consumer would never have a chance to deuque it. still, less
confusing.
This commit 730bc99025 introduced a new
dependency on ResourceAllocator because of the new field
`std::unique_ptr<ResourceAllocator> mResourceAllocator{};` in
details/Renderer.h
This requires cpp files including details/Renderer.h to include
ResourceAllocator.h as well.
This compile issue only happens on the Windows compiler, Visual Studio.
This function attempts to set texture parameters in these two cases, but the
texture is not guaranteed to be bound. Perhaps it once was, but the assumption
broke at some point.
this change shouldn't have any impact on ARM, however, according
to cppreference it's not safe to mix seq_cst with other memory
orders:
"as soon as atomic operations that are not tagged memory_order_seq_cst
enter the picture, the sequential consistency guarantee for the program
is lost"
Value of mCgltfBuffersLoaded is sometimes retained across creation of FAssetLoader which skips loading the buffer in AssetLoaderExtended#createPrimitive leading to null pointer crash
This fixes a crash introduced by a8ace2891d
The refactored FrameInfoManager can cause a crash when IBL resource loading
happens because now the getLastFrameInfo() references an invalid value via the
`front` method. Return the default FrameInfo to resolve this.
Also fix a null pointer reference bug for OpenGLTimer::State, which
happenes when the renderer for IBLPrefilterContext is destroyed.