update dispersion documentation (#9567)

* add dispersion parameter to material_sandbox

* frame_generator fixes

- fix skybox
- for baseColor to white (workaround)

* update dispersion documentation source
This commit is contained in:
Mathias Agopian
2026-01-05 13:54:24 -08:00
committed by GitHub
parent 43dd8fa1cc
commit dcb78c7144
8 changed files with 26 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ to perform a number of URL replacements in addition to the copy. These replaceme
described in [`docs_src/build/duplicates.json`].
### Core concept docs
The primary design of Filament as a phyiscally-based renderer and details of its materials
The primary design of Filament as a physically-based renderer and details of its materials
system are described in `Filament.md.html` and `Materials.md.html`, respectively. These two
documents are written in [`markdeep`]. To embed them into our book, we
1. Convert the markdeep into html

View File

@@ -161,7 +161,7 @@ The type and range of each property is described in table [standardPropertiesTyp
vertex. `microThickness` represent the thickness of the thin layer of an object, and can
generally be provided as a constant value. For example, a 1mm thin hollow sphere of radius 1m,
would have a `thickness` of 1 and a `microThickness` of 0.001. Dispersion controls the angular
separation of colors transmitting through a volume, and can be set by a contant value.
separation of colors transmitting through a volume, and can be set by a constant value.
Currently `thickness` and `dispersion` are not used when `refractionType` is set to `thin`.
### Base color
@@ -671,6 +671,9 @@ Water | 55 | 0.36
Crown Glass | 59 | 0.33
[Table [commonMatDispersion]: Dispersion of common materials]
![Figure [dispersionProperty]: `dispersion` varying from 0.0
(left) to 5.0 (right)](images/materials/dispersion.png)
## Subsurface model
### Thickness

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 MiB

View File

@@ -333,14 +333,18 @@ static void setup(Engine* engine, View* view, Scene* scene) {
scene->addEntity(g_light);
}
// FIXME: we need a better way to set the defaults.
if (g_material->hasParameter("baseColor")) {
g_materialInstance->setParameter("baseColor", float3{ 1, 1, 1 });
}
for (const auto& p : g_parameters) {
g_materialInstance->setParameter(p.name.c_str(), p.start);
}
if (!g_skyboxOn) {
auto ibl = FilamentApp::get().getIBL();
if (ibl) ibl->getSkybox()->setLayerMask(0xff, 0x00);
} else {
auto ibl = FilamentApp::get().getIBL();
if (!ibl || !g_skyboxOn) {
g_skybox = Skybox::Builder().color({
((g_clearColor >> 16) & 0xFF) / 255.0f,
((g_clearColor >> 8) & 0xFF) / 255.0f,

View File

@@ -395,6 +395,7 @@ static filament::MaterialInstance* updateInstances(
Color::absorptionAtDistance(color, params.distance));
materialInstance->setParameter("ior", params.ior);
materialInstance->setParameter("transmission", params.transmission);
materialInstance->setParameter("dispersion", params.dispersion);
materialInstance->setParameter("thickness", params.thickness);
}
}
@@ -571,6 +572,7 @@ static void gui(filament::Engine* engine, filament::View*) {
if (hasRefraction) {
ImGui::SliderFloat("IOR", &params.ior, 1.0f, 3.0f);
ImGui::SliderFloat("Transmission", &params.transmission, 0.0f, 1.0f);
ImGui::SliderFloat("Dispersion", &params.dispersion, 0.0f, 5.0f);
ImGui::SliderFloat("Thickness", &params.thickness, 0.0f, 1.0f);
ImGui::ColorEdit3("Transmittance", &params.transmittanceColor.r);
ImGui::SliderFloat("Distance", &params.distance, 0.0f, 4.0f);

View File

@@ -131,6 +131,7 @@ struct SandboxParameters {
float specularAntiAliasingVariance = 0.0f;
float specularAntiAliasingThreshold = 0.0f;
float transmission = 1.0f;
float dispersion = 0.0f;
float distance = 1.0f;
float ior = 1.5;
float emissiveExposureWeight = 1.0f;

View File

@@ -56,6 +56,10 @@ material {
type : float,
name : transmission
},
{
type : float,
name : dispersion
},
{
type : float4,
name : emissive
@@ -80,6 +84,7 @@ fragment {
material.thickness = materialParams.thickness;
material.ior = materialParams.ior;
material.transmission = materialParams.transmission;
material.dispersion = materialParams.dispersion;
material.emissive = materialParams.emissive;
}
}

View File

@@ -56,6 +56,10 @@ material {
type : float,
name : transmission
},
{
type : float,
name : dispersion
},
{
type : float4,
name : emissive
@@ -80,6 +84,7 @@ fragment {
material.thickness = materialParams.thickness;
material.ior = materialParams.ior;
material.transmission = materialParams.transmission;
material.dispersion = materialParams.dispersion;
material.emissive = materialParams.emissive;
}
}