* Stop using members as globals between methods
* Multi-thread shaders generation with JobSystem
* Pass JobSystem to MaterialBuilder::build()
* Fix MeshAssimp to use the new API
* Allow the Java API to pass a job system via Engine
* Update docs
* Apply suggestions from code review
Co-authored-by: Philip Rideout <philiprideout@gmail.com>
I tested this by viewing CesiumMan with our `gltf_instances` sample app.
There is now a need for some general refactoring in gltfio. I feel that
the high-level objects have become too tightly coupled to each other.
Fixes#3137.
By default, the demo now reflects the camera instead of the renderable.
However this can be changed via the command line. Users can now change
the backend too.
When we removed the old "ghetto bloom" demo, we ceased to have any
samples demonstrating the RenderTarget API. This demo is a fairly simple
demonstration of planar reflection.
* 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
Note that this API is on the loader rather than the asset. This is
because the loader knows how to create Filament entities by traversing
a cgltf node hierarchy.
Animation on dynamically added instances is not yet supported.
We did not add destroyInstance() because gltfio favors flat arrays for
long term storage of entity lists and instance lists, which would be
slow to shift. We also wish to discourage create/destroy churn since it
is more efficient to pre-allocate instances and selectively add them
into the scene.
Fixes#3137.
The Filament View that gets passed to tick() is retained briefly when
screenshots are enabled, but it may be destroyed by the time the
PixelBufferDescriptor callback is invoked. So, we needed a way of
notifying the AutomationEngine.
This adds a `material` key to `Settings`, as a sister to `view`.
Here's an example of an automation spec that manipulates material
parameters:
[{
"name": "metallic_vs_roughness",
"permute": {
"material.scalar.roughnessFactor": [0.0, 0.5, 1.0],
"material.scalar.metallicFactor": [0.0, 1.0]
}
}]
Currently this is limited to float, vec3, and vec4 parameters.
This adds `AutomationEngine` to libs/viewer, which iterates through
`Settings` instances that were generated from a JSON spec and applies
them to a Filament `View`. It can be configured to sleep between tests
using a time delay or a frame count.
This also adds command line arguments and user-interface elements to
`gltf_viewer` for automated testing.
- 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 introduces the `viewer::Settings` struct, and a JSON reader /
writer.
This will be used for automated testing and for client / server
communication.
Note that `viewer::Settings` is closely associated with the
`filament::View` API; when updating the latter we will often need to
update the former, as well as some serialization code. This increases
the maintenance burden and I think we should consider using a parser
library like libclang or a macro-based reflection utility.
This PR also migrates SimpleViewer into libs/viewer and un-inlines its
implementation. It does not belong in gltfio because it has an imgui
dependency.
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
.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.
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)
This also adds a -t flag to the easy build script for convenience.
SwiftShader on Vulkan can now be used as follows.
git clone https://github.com/google/swiftshader.git
cd swiftshader/build
cmake .. && make -j && export SWIFTSHADER_LD_LIBRARY_PATH=`pwd`
cd ../filament
./build.sh -t debug && ./out/cmake-debug/samples/gltf_viewer -a vulkan
Note that third_party/swiftshader does not need to exist since we
already have Vulkan headers. I will remove it in a subsequent PR.
* Add quality option to ColorGrading
Low: 16x16x16 LUT in 10 bit
Medium: 32x32x32 LUT in 10 bit
High: 32x32x32 LUT in 16 bit
Ultra: 64x64x64 LUT in 16 bit
* Move comment
- Allow JavaScript and Java / Kotlin clients to configure this setting.
- Opt in by default (this was disabled in #2621)
- Optimize large assets like Bistro by iterating through prims only when
the asset actually has skins.
Fixes#2714.