3D engine that AI agents drive
Add sheen lobe probes, multi-bounce glass furnace, and batched dispatches
Nguyen Xuan An48fc50930647
diff --git a/bench/cycles-parity/test-lobes.mjs b/bench/cycles-parity/test-lobes.mjsindex be9bf0a6..9983a91f 100644--- a/bench/cycles-parity/test-lobes.mjs+++ b/bench/cycles-parity/test-lobes.mjs@@ -313,6 +313,44 @@ export const LOBE_PROBE_CASES = [flags: MATERIAL_FLAG_MULTISCATTER_GGX | MATERIAL_FLAG_F82_METALLIC,},},+ {+ id: 'sheen-over-diffuse-rough',+ family: 'sheen',+ wo: [0.6, 0.0, 0.8],+ frontFace: true,+ expectWhiteFurnace: true,+ expectChiSquare: true,+ material: {+ baseColor: [1.0, 1.0, 1.0],+ metallic: 0.0,+ roughness: 0.5,+ ior: 1.0,+ specularIorLevel: 0.0,+ sheenWeight: 1.0,+ sheenRoughness: 0.5,+ sheenTint: [1.0, 1.0, 1.0],+ flags: MATERIAL_FLAG_MULTISCATTER_GGX,+ },+ },+ {+ id: 'sheen-over-diffuse-grazing',+ family: 'sheen',+ wo: [0.95, 0.0, 0.31225],+ frontFace: true,+ expectWhiteFurnace: true,+ expectChiSquare: true,+ material: {+ baseColor: [1.0, 1.0, 1.0],+ metallic: 0.0,+ roughness: 0.5,+ ior: 1.0,+ specularIorLevel: 0.0,+ sheenWeight: 1.0,+ sheenRoughness: 0.3,+ sheenTint: [1.0, 1.0, 1.0],+ flags: MATERIAL_FLAG_MULTISCATTER_GGX,+ },+ },];export const FURNACE_SCENE_CASES = [@@ -336,6 +374,10 @@ export const FURNACE_SCENE_CASES = [id: 'furnace-scene-coat',material: { color: [1.0, 1.0, 1.0], metallic: 0.0, roughness: 0.5, clearcoat: 1.0, clearcoatRoughness: 0.2 },},+ {+ id: 'furnace-scene-sheen',+ material: { color: [1.0, 1.0, 1.0], metallic: 0.0, roughness: 0.5, sheenColor: [1.0, 1.0, 1.0], sheenRoughness: 0.4 },+ },];function writeVec3(view, byteOffset, rgb) {@@ -536,17 +578,20 @@ async function runFurnaceSceneCase(sceneCase, sphereGeometry, whiteEnvironment,}];const traceScene = buildTraceScene(parts, whiteEnvironment);const camera = createCamera(cameraDescriptor, options.sceneWidth, options.sceneHeight);+ const furnaceBounces = 64;const traceOptions = {width: options.sceneWidth,height: options.sceneHeight,samples: options.sceneSamples,- bounces: 8,+ samplesPerDispatch: Math.min(options.sceneSamples, 16),+ bounces: furnaceBounces,seed: options.seed,kernel: 'cycles',filterType: 'box',filterWidth: 1.0,clampDirect: 0.0,clampIndirect: 0.0,+ filterGlossy: 0.0,fireflyClamp: 1e9,noiseThreshold: 0.0,maxSeconds: 300,@@ -564,7 +609,7 @@ async function runFurnaceSceneCase(sceneCase, sphereGeometry, whiteEnvironment,width: options.sceneWidth,height: options.sceneHeight,samples: options.sceneSamples,- bounces: 8,+ bounces: furnaceBounces,cameraEyeZ: 3.2,cameraFovDegrees: 40,sphereRadius: 1.0,@@ -594,7 +639,7 @@ async function runCli() {if (!options.skipScenes) {const selectedScenes = FURNACE_SCENE_CASES.filter((item) => !options.filter || item.id.includes(options.filter));if (selectedScenes.length > 0) {- const sphereGeometry = sphere(64, 40);+ const sphereGeometry = sphere(128, 96);const constantWhite = new Float32Array(8 * 4 * 3).fill(1.0);const environmentMap = createEnvironmentMap({ width: 8, height: 4, data: constantWhite, showBackground: true });const whiteEnvironment = {diff --git a/bench/cycles-parity/trace-native.mjs b/bench/cycles-parity/trace-native.mjsindex 51ae3614..b157f13b 100644--- a/bench/cycles-parity/trace-native.mjs+++ b/bench/cycles-parity/trace-native.mjs@@ -74,6 +74,7 @@ function parseTraceArguments(argumentList) {filterWidth: parseNumberOption(argumentList, '--filter-width', 1.0, 0.01),clampDirect: parseNumberOption(argumentList, '--clamp-direct', 0, 0),clampIndirect: parseNumberOption(argumentList, '--clamp-indirect', 0, 0),+ filterGlossy: parseNumberOption(argumentList, '--filter-glossy', 1.0, 0),fireflyClamp: parseNumberOption(argumentList, '--firefly-clamp', 1e9, 0),noiseThreshold: parseNumberOption(argumentList, '--noise-threshold', 0, 0),maxSeconds: parseNumberOption(argumentList, '--max-seconds', 1800, 1),@@ -112,12 +113,14 @@ async function runCli() {const traceSource = await reconstructTraceSceneSource(description);const traceScene = buildTraceScene(traceSource.parts, traceSource.environment);const camera = createCamera(traceSource.camera, options.width, options.height);- const nativeInput = packSceneForKernel(traceScene, camera, { ...options, parts: traceSource.parts });+ const samplesPerDispatch = options.noiseThreshold > 0 ? 8 : Math.min(options.samples, 16);+ const nativeInput = packSceneForKernel(traceScene, camera, { ...options, samplesPerDispatch, parts: traceSource.parts });const sceneBuildSeconds = (performance.now() - buildStarted) / 1000;const traced = renderNative.traceNative(nativeInput, {width: options.width,height: options.height,samples: options.samples,+ samplesPerDispatch,bounces: options.bounces,seed: options.seed,maxSeconds: options.maxSeconds,@@ -126,6 +129,7 @@ async function runCli() {filterWidth: options.filterWidth,clampDirect: options.clampDirect,clampIndirect: options.clampIndirect,+ filterGlossy: options.filterGlossy,});const totalTraceSeconds = (performance.now() - totalStarted) / 1000;const postTraceRssMegabytes = process.memoryUsage().rss / (1024 * 1024);