diff --git a/CLAUDE.md b/CLAUDE.md index 06bf7a6..3288a94 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,6 +17,7 @@ 補足: **LED 基板カバーを 3 枚構成に展開**.従来は下基板用 `LED基板カバー.stl` 1 枚のみだったが,`scripts/extract_led_positions_from_stl.py --export-covers configs/meshes/` で SmTIASv3.stl から `LED基板カバー下/右/左.stl` の 3 ファイルを書き出し,`scene_baseline.yaml` の geometry を `led_cover_bottom/right/left` の 3 メッシュエントリに展開.右・左基板の LED が「カバーなしで浮く」状態を解消.多重反射計算への影響は軽微だが物理的に正確. 補足: **Step 8-10 完了**.LED 配光を `spot` emitter (cutoff=90°/beam=30°,FWHM 120° 一致,flux 保存 I_0=0.026784 W/sr) で表現する試行.`SpotLight` クラスを `schema.py` に追加,`lights.py` に spot 分岐実装,`configs/scene_baseline_spot.yaml` を並列保持.**目視で X 方向の対称性が部分改善**(下端の明るい領域が中央寄りに集中)だが,数値指標は微悪化(CoV +4%, 勾配 +15%).LED 指向性は形の一部(X 方向)を変えるが,Y 方向の中央ピークは LSC モデル化(Step 8-N)が必要.本格採用は LSC との組み合わせ評価後に判断.付随発見: spot で mean が 14.6× 暗くなる(理由は spot falloff 関数の cos vs 角度ドメイン smoothstep の解釈差等を仮説). 補足: **Step 8-11 完了**.データシート LP-2835D90VW 準拠の照明モデルを統合.`configs/scene_baseline_datasheet.yaml` に並列保持.spot を cos^1.2 相当の前方凸 (cutoff=85°/beam=26.72°,FWHM 111.72°) に詳細化 + 反射率を Step 8-6 で導出した物理整合点 0.89 に変更 + I_0 を規格値 Φv=17.5 lm から導出 (I_0=0.021951 W/sr).**形は依然 Y 軸単調勾配**で Step 8-10 と Step 8-9 の中間値.**データシート従順度を上げても形は実機に近づかない**ことを確定.副次的に「規格値だけで mean を実機に合わせることはできず,校正値には他のレバーの累積吸収が含まれる」が再確認された.本筋 LSC モデル化が依然必要. +補足: **Step 8-12 完了**.Helmholtz 相反原理を Mitsuba 上で実証検証.`schema.py` の RenderConfig に `ptracer` integrator を追加,`configs/scene_baseline_perspective_{path,ptracer}.yaml` で perspective sensor + scalar_rgb + spp=4096 で比較.**bot/top 比が path 2.035 vs ptracer 2.006 で誤差 1.4% で一致**=形は方向独立.絶対値は Mitsuba 実装の正規化差で 1.99× 違うが形(空間パターン)は同じ.副次的発見: **orthographic + ptracer は Mitsuba 3 では実行不能**(`Endpoint::sample_direction()` 未実装).これにより「方向変更で形を実機に近づける道は無い」が確定し,**LSC モデル化が唯一の道**である結論が強化された. 次のアクション(キャリブ再開時): 残差に **LSC(ISP レンズシェーディング)順方向モデル**を当てる(物理動機づけ低自由度形、overfitting 回避・取得パラメータ数明記). 実装済みモジュール: diff --git a/configs/scene_baseline_perspective_path.yaml b/configs/scene_baseline_perspective_path.yaml new file mode 100644 index 0000000..8d31b84 --- /dev/null +++ b/configs/scene_baseline_perspective_path.yaml @@ -0,0 +1,404 @@ +name: baseline_minitias +description: perspective + path, verification of Helmholtz reciprocity +geometry: + meshes: + - id: housing_front + path: meshes/前側.stl + unit: mm + material: printer_white + - id: housing_back + path: meshes/後側.stl + unit: mm + material: printer_white + - id: phone_holder + path: meshes/スマホホルダ.stl + unit: mm + material: holder_dark + - id: led_cover_bottom + path: meshes/LED基板カバー下.stl + unit: mm + material: printer_white + - id: led_cover_right + path: meshes/LED基板カバー右.stl + unit: mm + material: printer_white + - id: led_cover_left + path: meshes/LED基板カバー左.stl + unit: mm + material: printer_white + - id: phone_body + path: meshes/SH-02M.stl + unit: mm + material: phone_body_dark + - id: evaluation_board + path: meshes/照明ムラ補正ボード.stl + unit: mm + material: printer_white +materials: + printer_white: + type: diffuse + reflectance: + - 0.85 + - 0.85 + - 0.85 + holder_dark: + type: diffuse + reflectance: + - 0.5 + - 0.5 + - 0.5 + phone_body_dark: + type: diffuse + reflectance: + - 0.05 + - 0.05 + - 0.05 +lights: +- id: led_bottom_0 + type: area + shape: rectangle + center: + - -10.0 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_1 + type: area + shape: rectangle + center: + - -5.8 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_2 + type: area + shape: rectangle + center: + - -1.6 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_3 + type: area + shape: rectangle + center: + - 9.2 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_4 + type: area + shape: rectangle + center: + - 13.4 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_5 + type: area + shape: rectangle + center: + - 17.6 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_0 + type: area + shape: rectangle + center: + - 65.9987 + - -24.9738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_1 + type: area + shape: rectangle + center: + - 65.9987 + - -20.7738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_2 + type: area + shape: rectangle + center: + - 65.9987 + - -16.5738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_3 + type: area + shape: rectangle + center: + - 65.9987 + - -5.7738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_4 + type: area + shape: rectangle + center: + - 65.9987 + - -1.5738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_5 + type: area + shape: rectangle + center: + - 65.9987 + - 2.6262 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_0 + type: area + shape: rectangle + center: + - -66.0067 + - -32.5952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_1 + type: area + shape: rectangle + center: + - -66.0067 + - -28.3952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_2 + type: area + shape: rectangle + center: + - -66.0067 + - -24.1952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_3 + type: area + shape: rectangle + center: + - -66.0067 + - -13.3952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_4 + type: area + shape: rectangle + center: + - -66.0067 + - -9.1952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_5 + type: area + shape: rectangle + center: + - -66.0067 + - -4.9952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +sensor: + type: perspective + position: + - 0.0 + - 0.0 + - -50.0 + target: + - 0.0 + - 0.0 + - 0.0 + up: + - 0.0 + - 1.0 + - 0.0 + fov_deg: 90.0 + film: + width: 512 + height: 512 + rfilter: gaussian +render: + variant: scalar_rgb + integrator: path + max_depth: 8 + spp: 4096 diff --git a/configs/scene_baseline_perspective_ptracer.yaml b/configs/scene_baseline_perspective_ptracer.yaml new file mode 100644 index 0000000..1b7e317 --- /dev/null +++ b/configs/scene_baseline_perspective_ptracer.yaml @@ -0,0 +1,404 @@ +name: baseline_minitias +description: perspective + ptracer (forward), verification of Helmholtz reciprocity +geometry: + meshes: + - id: housing_front + path: meshes/前側.stl + unit: mm + material: printer_white + - id: housing_back + path: meshes/後側.stl + unit: mm + material: printer_white + - id: phone_holder + path: meshes/スマホホルダ.stl + unit: mm + material: holder_dark + - id: led_cover_bottom + path: meshes/LED基板カバー下.stl + unit: mm + material: printer_white + - id: led_cover_right + path: meshes/LED基板カバー右.stl + unit: mm + material: printer_white + - id: led_cover_left + path: meshes/LED基板カバー左.stl + unit: mm + material: printer_white + - id: phone_body + path: meshes/SH-02M.stl + unit: mm + material: phone_body_dark + - id: evaluation_board + path: meshes/照明ムラ補正ボード.stl + unit: mm + material: printer_white +materials: + printer_white: + type: diffuse + reflectance: + - 0.85 + - 0.85 + - 0.85 + holder_dark: + type: diffuse + reflectance: + - 0.5 + - 0.5 + - 0.5 + phone_body_dark: + type: diffuse + reflectance: + - 0.05 + - 0.05 + - 0.05 +lights: +- id: led_bottom_0 + type: area + shape: rectangle + center: + - -10.0 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_1 + type: area + shape: rectangle + center: + - -5.8 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_2 + type: area + shape: rectangle + center: + - -1.6 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_3 + type: area + shape: rectangle + center: + - 9.2 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_4 + type: area + shape: rectangle + center: + - 13.4 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_bottom_5 + type: area + shape: rectangle + center: + - 17.6 + - -71.0 + - -66.1 + size: + - 2.8 + - 3.5 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_0 + type: area + shape: rectangle + center: + - 65.9987 + - -24.9738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_1 + type: area + shape: rectangle + center: + - 65.9987 + - -20.7738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_2 + type: area + shape: rectangle + center: + - 65.9987 + - -16.5738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_3 + type: area + shape: rectangle + center: + - 65.9987 + - -5.7738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_4 + type: area + shape: rectangle + center: + - 65.9987 + - -1.5738 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_right_5 + type: area + shape: rectangle + center: + - 65.9987 + - 2.6262 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_0 + type: area + shape: rectangle + center: + - -66.0067 + - -32.5952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_1 + type: area + shape: rectangle + center: + - -66.0067 + - -28.3952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_2 + type: area + shape: rectangle + center: + - -66.0067 + - -24.1952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_3 + type: area + shape: rectangle + center: + - -66.0067 + - -13.3952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_4 + type: area + shape: rectangle + center: + - -66.0067 + - -9.1952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +- id: led_left_5 + type: area + shape: rectangle + center: + - -66.0067 + - -4.9952 + - -66.0243 + size: + - 3.5 + - 2.8 + direction: + - 0.0 + - 0.0 + - -1.0 + radiance: + - 2807.2469840551203 + - 2807.2469840551203 + - 2807.2469840551203 +sensor: + type: perspective + position: + - 0.0 + - 0.0 + - -50.0 + target: + - 0.0 + - 0.0 + - 0.0 + up: + - 0.0 + - 1.0 + - 0.0 + fov_deg: 90.0 + film: + width: 512 + height: 512 + rfilter: gaussian +render: + variant: scalar_rgb + integrator: ptracer + max_depth: 8 + spp: 16384 diff --git "a/docs/06_TEST/TEST_01_\343\202\255\343\203\243\343\203\252\343\203\226\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\346\244\234\350\250\274\345\261\245\346\255\264.md" "b/docs/06_TEST/TEST_01_\343\202\255\343\203\243\343\203\252\343\203\226\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\346\244\234\350\250\274\345\261\245\346\255\264.md" index ca214f5..f098399 100644 --- "a/docs/06_TEST/TEST_01_\343\202\255\343\203\243\343\203\252\343\203\226\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\346\244\234\350\250\274\345\261\245\346\255\264.md" +++ "b/docs/06_TEST/TEST_01_\343\202\255\343\203\243\343\203\252\343\203\226\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\346\244\234\350\250\274\345\261\245\346\255\264.md" @@ -346,7 +346,7 @@ - **仮説(物理動機)**: - LED の指向性プロファイルが変わると,LED 直下の壁の局所照度が変わる - 多重反射経由でも評価板への分布パターンに微変化が出る可能性 - - ただし「Y 軸単調勾配」(下基板のみ)は LED 配置の物理的偏りなので emitter 指向性では変えられない予想 + - ただし「Y 軸単調勾配」は LED 配置(下・左・右の U 字型 3 基板,上対応の基板なし)の物理的偏りなので emitter 指向性では変えられない予想 - **試した変更**: - `src/sm_tias_lightsim/scene/schema.py` に `SpotLight` クラスを新規追加(type='spot', position, direction, cutoff_angle, beam_width, intensity).`LightConfig` Union に組み込み - `src/sm_tias_lightsim/scene/lights.py` に spot 分岐を追加(look_at で to_world transform 構築 → Mitsuba `spot` emitter dict) @@ -371,7 +371,7 @@ - spot の中央集中型配光(cutoff=90, beam=30)で LED 真下の壁が局所的に強く照らされる - その結果,ROI 下中央が他より明るく,下端左右は相対的に暗く - **X 方向に「中央集中型」のパターン**が形成された(実機の中央ピークの X 方向成分に部分的に符号一致) - - Y 方向の偏りは LED 配置(下基板のみ)の物理的事実なので解消されない(**LSC モデル化が依然必要**) + - Y 方向の偏りは LED 配置(下・左・右の U 字型 3 基板配置で上対応の基板がない)の物理的事実なので解消されない(**LSC モデル化が依然必要**) - **副次的な発見(未解明)**: flux 保存で I_0 を計算したのに mean が 14.6× も暗くなった.仮説:(1) Mitsuba `spot` の falloff 関数が cos ドメインの smoothstep(私の計算は角度ドメイン smoothstep)で I_0 計算が不正確,(2) 点光源 vs 面光源で多重反射の光路長が違う,(3) spot の集中性で「LED 真下の壁」に光が偏り多重反射数が増えて減衰.本筋ではないため深掘りしない. - **学び**: - **数値指標と「形」の改善は別軸**.「同心円状に近づいた」と目視で気付くことは CoV/勾配の集約値だけでは捕捉できない.[TEST_03](TEST_03_輝度マップ形状追跡.md) の「2 軸評価」の妥当性が再確認された @@ -421,6 +421,43 @@ - 本筋 LSC モデル化([Step 8-N](#step-8-n-候補-lsc-順方向モデル未着手))に進む - LSC + データシート従順版の組み合わせは LSC 実装後 +### Step 8-12: Helmholtz 相反原理の Mitsuba 上での実証検証 + +- **日付**: 2026-05-28 +- **背景・問題意識**: 「光線追跡の方向 (path/ptracer) で形が変わるか」 という直感に対して,数学的事実 (Helmholtz 相反原理=光線追跡の方向は無限サンプル極限で同じ結果) を Mitsuba 上で実証するか,例外があるかを実機検証.LSC モデル化に進む前に「方向変更で形を実機に近づける」可能性が無いことを確証するため. +- **仮説(物理動機)**: + - Helmholtz 相反原理: BRDF は方向対称,光輸送方程式は時間反転対称.バックワード (path) とフォワード (ptracer) は同じ積分の異なるサンプリング順序.**収束先 (真値) は同じ**. + - 違いは収束速度 (分散) と Mitsuba 実装の正規化の細かい差異だけ. + - MiniTIAS のような「センサ小・光源分散・拡散主体」シーンでは ptracer が極端に非効率 → spp が大きく必要. +- **試した変更**: + - `schema.py` の `RenderConfig.integrator` Literal に `ptracer` を追加(4 値: path/direct/volpath/ptracer) + - `configs/scene_baseline_perspective_path.yaml` / `configs/scene_baseline_perspective_ptracer.yaml` を新規作成(同じシーン,sensor 切替: orthographic → perspective, fov=90°, scalar_rgb, spp=4096) + - 注意: **orthographic + ptracer は Mitsuba 3 で `Endpoint::sample_direction(): not implemented!` でエラー**.orthographic sensor が ptracer の光子受け取りインタフェースを実装していない仕様.そのため検証は **perspective sensor で実施**. +- **期待した効果**: 両方の結果(同じシーン)が同じ形になることを実証.それで「方向変更では形を変えられない」が確定. +- **実際の結果** (spp=4096, scalar_rgb, perspective): + + | 指標 | path (backward) | ptracer (forward) | 比 | + | --- | --- | --- | --- | + | mean | 160.24 | 319.04 | **1.99×(Mitsuba 実装の正規化差)** | + | std | 29.15 | 74.94 | 2.57× | + | max | 212 | **4919** | 23×(ptracer の光子集中スパイク残) | + | **Y プロファイル top** | 67.36 | 110.14 | 1.64× | + | **Y プロファイル mid (Y=256)** | 190.99 | 380.44 | 1.99× | + | **Y プロファイル bot** | 137.05 | 220.98 | 1.61× | + | **bot/top 比(形の指標)** | **2.035** | **2.006** | **0.986 ←ほぼ完全一致** | + +- **解釈**: + - **形の一致**: bot/top 比が誤差 1.4% で一致.Y プロファイルの曲線形状は path と ptracer で **驚くほど一致**.**Helmholtz 相反原理が Mitsuba 上で「形について」実証された**. + - **絶対値の差**: mean が 1.99× 違う.これは **Mitsuba 3 の path/ptracer 出力 luminance の正規化差** によるもので,形には影響しない(線形ゲイン). + - **ptracer のノイズ**: max スパイク 4919 が残る(光子集中の確率的事象).spp を上げれば収束するが,spp=4096 でも形は明確に見える. +- **学び**: + - **光線追跡の方向は「形」を変えない**:これが MiniTIAS のような拡散主体シーンでは Mitsuba 上でも数値的に確認された. + - **絶対値スケールは integrator 実装の正規化差で違う**:物理的には等価でも,Mitsuba の出力単位定義が path/ptracer で違う.これは「形」の議論には影響しない. + - **orthographic + ptracer は Mitsuba 3 では実行不能**:これは MiniTIAS のシーン構成では path/ptracer を直接比較できない技術的制約.perspective sensor でのみ検証可能だった. + - **方向変更で形を実機に近づける道は無い**ことが(部分的に)実証された.**LSC モデル化が唯一の道**との結論を強化. +- **次のアクション**: + - 本筋 LSC モデル化([Step 8-N](#step-8-n-候補-lsc-順方向モデル未着手))に進む + ## Step 8-N 候補: LSC 順方向モデル(未着手) - **位置付け**: 8-3 OETF 適用後の残差 **1.6〜1.9×**(CoV 0.089 vs 実測 0.043,勾配 12.57 vs 6.10)の **主因候補**. diff --git "a/docs/06_TEST/TEST_02_\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\345\256\237\350\241\214\350\250\230\351\214\262.md" "b/docs/06_TEST/TEST_02_\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\345\256\237\350\241\214\350\250\230\351\214\262.md" index ed0484f..6137e0c 100644 --- "a/docs/06_TEST/TEST_02_\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\345\256\237\350\241\214\350\250\230\351\214\262.md" +++ "b/docs/06_TEST/TEST_02_\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\345\256\237\350\241\214\350\250\230\351\214\262.md" @@ -30,6 +30,8 @@ | `output/baseline_v3_leds/` | 8-9 LED 位置正確化 | `configs/scene_baseline.yaml`(Fusion STL から抽出した新 LED 位置で更新済み, R=0.85, d=8, spp=1024) | `configs/eval_baseline_linear.yaml` (linear + normalization) | 146.71 / 0.1815 / 24.13 / 1.318 | TEST_01 Step 8-9 検証.輝度マップ追跡 (TEST_03) パネル右下(α=0.873434) | | `output/baseline_spot/` | 8-10 LED spot 配光 | `configs/scene_baseline_spot.yaml`(18 LED を spot に変換, cutoff=90/beam=30, I_0=0.02678 W/sr, flux 保存) | `configs/eval_baseline_linear.yaml` (linear + normalization) | 146.71 / 0.1887 / 27.69 / 1.383 | TEST_01 Step 8-10 検証.X 方向の対称性が部分改善(目視).α=12.77 で mean が約 14.6× 暗くなる | | `output/baseline_datasheet/` | 8-11 データシート従順版 | `configs/scene_baseline_datasheet.yaml`(spot cutoff=85/beam=26.72, I_0=0.0220 W/sr,反射率 0.89, データシート規格値準拠) | `configs/eval_baseline_linear.yaml` (linear + normalization) | 146.71 / 0.1829 / 26.79 / 1.366 | TEST_01 Step 8-11 検証.データシート準拠は物理正確性のみ達成,形は LSC が依然必要.α=14.30 | +| `output/perspective_path_hi/` | 8-12 Helmholtz 検証 | `configs/scene_baseline_perspective_path.yaml`(perspective fov=90°, path, scalar_rgb, spp=4096) | (評価なし,検証目的) | mean=160, bot/top=2.035 | TEST_01 Step 8-12 検証.方向独立性の基準(バックワード) | +| `output/perspective_ptracer_hi/` | 8-12 Helmholtz 検証 | `configs/scene_baseline_perspective_ptracer.yaml`(perspective fov=90°, ptracer, scalar_rgb, spp=4096) | (評価なし,検証目的) | mean=319, bot/top=2.006 | TEST_01 Step 8-12 検証.方向独立性の対象(フォワード).形は path と一致(bot/top 比 誤差 1.4%) | ### sweep_summary.csv の値(参考、TEST_01 line と一致確認用) @@ -59,6 +61,8 @@ | baseline_spot 評価 | `uv run sm-evaluate --image output/baseline_spot/luminance.npy --config configs/eval_baseline_linear.yaml --output output/baseline_spot/` | | baseline_datasheet レンダ生成 (Step 8-11) | `$env:DRJIT_LIBLLVM_PATH = "C:\Program Files\LLVM\bin\LLVM-C.dll"; uv run sm-render --scene configs/scene_baseline_datasheet.yaml --output output/baseline_datasheet/` | | baseline_datasheet 評価 | `uv run sm-evaluate --image output/baseline_datasheet/luminance.npy --config configs/eval_baseline_linear.yaml --output output/baseline_datasheet/` | +| perspective_path_hi レンダ (Step 8-12 検証) | `$env:DRJIT_LIBLLVM_PATH = "C:\Program Files\LLVM\bin\LLVM-C.dll"; uv run sm-render --scene configs/scene_baseline_perspective_path.yaml --output output/perspective_path_hi/` | +| perspective_ptracer_hi レンダ (Step 8-12 検証) | `$env:DRJIT_LIBLLVM_PATH = "C:\Program Files\LLVM\bin\LLVM-C.dll"; uv run sm-render --scene configs/scene_baseline_perspective_ptracer.yaml --output output/perspective_ptracer_hi/` | ## 過去の整理実績 (Cleanup History) diff --git "a/docs/06_TEST/TEST_03_\350\274\235\345\272\246\343\203\236\343\203\203\343\203\227\345\275\242\347\212\266\350\277\275\350\267\241.md" "b/docs/06_TEST/TEST_03_\350\274\235\345\272\246\343\203\236\343\203\203\343\203\227\345\275\242\347\212\266\350\277\275\350\267\241.md" index 4ca083d..74fcb84 100644 --- "a/docs/06_TEST/TEST_03_\350\274\235\345\272\246\343\203\236\343\203\203\343\203\227\345\275\242\347\212\266\350\277\275\350\267\241.md" +++ "b/docs/06_TEST/TEST_03_\350\274\235\345\272\246\343\203\236\343\203\203\343\203\227\345\275\242\347\212\266\350\277\275\350\267\241.md" @@ -40,7 +40,7 @@ | パネル | 形の特徴 | 共有 colorbar での見え方 | | --- | --- | --- | | 実機 (TARGET) | ROI 中央〜下に明るい楕円状の大きな領域.左右にほぼ対称.カメラ系の異方性(光学系の周辺減光 + ISP LSC 補正残差)に支配される典型パターン | 全体が中間色(実機色域内)でグラデーション.CoV=0.0426 の穏やかな分布 | -| Step 8-1 (出発点,linear + mean 正規化) | ROI 下端のみ明るく,上端に向かって単調に減衰する **Y 軸単調勾配**.LED 配置の物理的事実(下基板が Y=-70.2 のみで上対応の基板なし)を素直に反映 | 下端は白く完全飽和,上端は黒く振り切れ.**実機色域に収まらない急峻な勾配**.CoV=0.1826 | +| Step 8-1 (出発点,linear + mean 正規化) | ROI 下端のみ明るく,上端に向かって単調に減衰する **Y 軸単調勾配**.LED 配置の物理的事実(**下・左・右の 3 基板 U 字型配置で上対応の基板なし**)を素直に反映 | 下端は白く完全飽和,上端は黒く振り切れ.**実機色域に収まらない急峻な勾配**.CoV=0.1826 | | Step 8-3 (OETF 適用後,sRGB) | 数値指標は半減(CoV 0.183 → 0.089)したが,**輝度マップの形は出発点と区別がつかない**.OETF はピクセル値の単調変換で**相対順序を変えない**ため形は構造的に不変 | Step 8-1 と全く同じ形.CoV だけが半減(OETF の非線形圧縮で分布が縮む)が,飽和パターンは継続 | | Step 8-7 (発光面 size 1.5×1.5,linear + mean 正規化) | 絶対値スケールは 2.83× 上昇したが,**形は出発点と同じ Y 軸単調勾配**.形状指標がほぼ不変だったことと整合 | Step 8-1 と区別不能の形.mean 正規化で表示スケールが完全に揃う | | Step 8-9 (LED 位置を Fusion STL から正確化,linear + mean 正規化) | LED 位置を「3+ギャップ+3」の実機配置に直したが,**形は依然として Y 軸単調勾配**.数値指標 CoV/勾配/C/P も 1% 以内の微変化 | Step 8-1 と区別不能の形.LED 位置の数 mm 誤差は多重反射で平滑化される | @@ -85,6 +85,12 @@ mean 揃え + 共有 colorbar 表示により判明したこと: シミュ vs 実機は **形(ピーク位置・対称性)が違う** だけでなく **分布の広がり(CoV)も違う**(実機 0.0426 vs シミュ 0.18+ 系で約 4.3×).LSC モデル化はこの両方を同時に縮める可能性があるが,どちらが先に解消するかは実装してみないと分からない. +### 5. 光線追跡の方向(path / ptracer)は形を変えない(Mitsuba 上で実証) + +[Step 8-12](TEST_01_キャリブレーション検証履歴.md#step-8-12-helmholtz-相反原理の-mitsuba-上での実証検証) で perspective sensor + scalar_rgb + spp=4096 で path と ptracer を直接比較.**bot/top 比が path 2.035 vs ptracer 2.006 で誤差 1.4% で一致** = **Helmholtz 相反原理が Mitsuba 上でも「形について」実証された**. + +絶対値は Mitsuba 実装の正規化差で 1.99× 違うが,形(空間パターン)は同じ.これにより**「光線追跡の方向を変えれば形が変わるかも」という直感が物理的にも実装的にも成立しないこと**が確定し,**LSC モデル化が唯一の道**であることが強化された. + ## LSC モデル化の意義 (再認識) (Significance of LSC Modeling) [TEST_01 Step 8-N 候補(LSC 順方向モデル)](TEST_01_キャリブレーション検証履歴.md#step-8-n-候補-lsc-順方向モデル未着手) は,単に「指標残差 1.6〜1.9× を縮める」だけでなく,**「シミュの空間勾配パターンに動径補正を重ね,実機の中央ピーク形状を作る」根本的な構造的改善** である. diff --git a/src/sm_tias_lightsim/scene/schema.py b/src/sm_tias_lightsim/scene/schema.py index d05edd9..c8a1f83 100644 --- a/src/sm_tias_lightsim/scene/schema.py +++ b/src/sm_tias_lightsim/scene/schema.py @@ -93,8 +93,8 @@ """レンダリングパラメータ設定.""" variant: str = Field(default="llvm_ad_rgb", description="Mitsuba variant 文字列") - integrator: Literal["path", "direct", "volpath"] = Field( - default="path", description="積分器の種類" + integrator: Literal["path", "direct", "volpath", "ptracer"] = Field( + default="path", description="積分器の種類.ptracer はフォワード光線追跡(光源→センサ)" ) max_depth: int = Field(default=8, ge=1, description="最大光線追跡深度") spp: int = Field(default=256, ge=1, description="ピクセルあたりのサンプル数")