Skip to content

Commit 043fb77

Browse files
committed
mcpg: default to MIS+Roughness and p_guiding 0.5; tests: request the features the material shaders need
Measured on the Bitterli pbrt scenes (1280x720, 3 reps, 8192-iteration reference-mode references with the reference's own MC noise subtracted): MIS+Roughness is never worse than MIS and is much better where bare glossy conductors exist (kitchen, alpha 0.05-0.1: relMSE -27 % at 1024 iterations with p=0.5, -55 % with p=0.9); it is a tie on living-room, whose glossy surfaces are either gated off or diffuse-dominated composites, and identical on the diffuse cornell-box. p_guiding drops 0.85 -> 0.5 (and examples/renderers/mcpg.json 0.9 -> 0.5): at p=0.9 guiding is a large net loss on both glossy scenes, +584 %/+750 % relMSE against no guiding at 4096 iterations. Quake pins 0.9 in its own quake.json (merian-plugin-quake feat/mcpg-guiding-prob). test-material-system and test-slang-hot-reload both aborted on a validation error: the material shaders declare 16-bit StorageBuffer variables and use non-uniform sampled-image indexing, but these bare test contexts requested no features (test_pbrt_scene/test_gltf_scene already do this). Pre-existing on main, unrelated to the guiding change.
1 parent fb1c592 commit 043fb77

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

examples/renderers/mcpg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"6": true,
2424
"7": true,
2525
"emission on primary": true,
26-
"guiding prob": 0.9,
26+
"guiding prob": 0.5,
2727
"lc": {
2828
"LC buffer size": 8000009,
2929
"LC probe count": 2,

include/merian-graph/nodes/render_pt_mcpg/render_pt_mcpg.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class RenderMCPG : public Node {
132132
// --- Guiding Markov chain ---
133133
float dir_guide_prior = 0.2f;
134134
int32_t mc_samples = 5;
135-
float p_guiding = 0.85f; // probability to sample the guiding distribution instead of the BSDF
135+
float p_guiding = 0.5f; // probability to sample the guiding distribution instead of the BSDF
136136
bool missing_light_heuristic = true;
137137

138138
uint32_t mc_adaptive_buffer_size = 32777259;
@@ -141,7 +141,7 @@ class RenderMCPG : public Node {
141141
uint32_t mc_locality_bits = 3;
142142

143143
GuidingDirectionalSamplingType guiding_directional_sampling_type =
144-
GuidingDirectionalSamplingType::MIS;
144+
GuidingDirectionalSamplingType::MIS_ROUGHNESS;
145145
// Guiding is skipped below this GGX alpha, where the vMF mixture cannot represent the lobe.
146146
// Compared against pow2(BSDF::roughness), so 0.05 matches Cycles' default (alpha units too).
147147
float guiding_roughness_threshold = 0.05f;

tests/test_material_system.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ class MaterialSystemTest : public ::testing::Test {
3333
static void SetUpTestSuite() {
3434
spdlog::set_level(spdlog::level::debug);
3535
ContextCreateInfo info{
36+
// Materials store fp16 (half3 tint/emission), so the shaders declare 16-bit
37+
// StorageBuffer variables; without these the validation layer rejects them.
38+
.features =
39+
VulkanFeatures({"scalarBlockLayout", "shaderInt64", "shaderInt16", "shaderFloat16",
40+
"storageBuffer16BitAccess", "uniformAndStorageBuffer16BitAccess",
41+
"storageBuffer8BitAccess", "uniformAndStorageBuffer8BitAccess",
42+
"shaderSampledImageArrayNonUniformIndexing",
43+
"runtimeDescriptorArray"}),
3644
.context_extensions = {ExtensionVkValidationLayers::name, ExtensionResources::name},
3745
.application_name = "test-material-system",
3846
};

tests/test_slang_hot_reload.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ class SlangHotReloadTest : public ::testing::Test {
3333
static void SetUpTestSuite() {
3434
spdlog::set_level(spdlog::level::debug);
3535
ContextCreateInfo info{
36+
// Materials store fp16 (half3 tint/emission), so the shaders declare 16-bit
37+
// StorageBuffer variables; without these the validation layer rejects them.
38+
.features =
39+
VulkanFeatures({"scalarBlockLayout", "shaderInt64", "shaderInt16", "shaderFloat16",
40+
"storageBuffer16BitAccess", "uniformAndStorageBuffer16BitAccess",
41+
"storageBuffer8BitAccess", "uniformAndStorageBuffer8BitAccess",
42+
"shaderSampledImageArrayNonUniformIndexing",
43+
"runtimeDescriptorArray"}),
3644
.context_extensions = {ExtensionVkValidationLayers::name, ExtensionResources::name},
3745
.application_name = "test-slang-hot-reload",
3846
};

0 commit comments

Comments
 (0)