A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(render): what a shiny thing reflects indoors is the room, not the sky
esengine59edd358e52c
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 76042a341..14b7c8af1 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -29,7 +29,7 @@ env:test_registry_ondestroy test_view_api_matrixtest_shader_device test_draw_params test_texture_fb test_buffer_devicetest_compressed_format test_batch_builder test_boundary_span test_webgpu_device- test_clip_depth test_sort_key test_sprite_mask_range test_shadow_atlas test_particle_shapes test_lod_selection test_hdr_format test_probe_store test_occlusion_view+ test_clip_depth test_sort_key test_sprite_mask_range test_shadow_atlas test_particle_shapes test_lod_selection test_hdr_format test_probe_store test_occlusion_view test_reflection_storetest_text_edit test_render_graph test_device_loss test_physics_interpolationtest_bitmap_font test_texture_cache test_mesh_recovery test_aot_host test_aot_conformancetest_touch_streamdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3853eceea..5ed4e2f71 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -97,6 +97,40 @@ published separately; it ships inside the editor.Per-instance, not per-object-record, because the record was out of room at thetime. The entry below is the change that moved it.+- **What a shiny thing reflects indoors is the room, not the sky.** A+ `ReflectionProbe` is a box inside which reflections come from a bake — the+ specular half of the question `LightProbeVolume` already answered for the+ diffuse one. Bake Lighting captures a sphere from each probe, prefilters it+ with the environment importer's own code, and packs every probe into ONE atlas+ whose column 0 is the sky the scene was baked under. A surface carries which+ column it reflects as a number per instance, so a room full of shiny things is+ still one draw; a texture per probe would have been a bind per draw.++ The reflection is PROJECTED onto the probe's box, which is what slides it+ across a wall as the eye moves instead of painting it on. Outside every box the+ sky answers exactly as before, and a scene with no bake is byte-for-byte the+ frame it always was.++ Both bake doors produce it — `bake-scene` on the command line and the editor's+ Bake Lighting — and both write the same two files beside the lightmap.++- **The bake's ray tracer walked its own tree wrong.** The traversal took the+ left child to be the node after the parent, which is true only of the root: a+ left subtree allocates everything under it first. Held against brute force over+ 600 rays, the tree missed 154 of them — it reported open sky where a triangle+ stood. Every bake in the corpus carried it: shadows that leaked, bounces that+ never arrived, probes gathering light through walls. The tree now stores the+ left child and reads the right beside it, and agrees with brute force on every+ ray; the shipped bakes are rebaked.++- **A material-shaded surface shaded itself at z = 0.** The Model shader passed+ `vec3(v_worldPos, 0)` as the place it stands — which a directional light cannot+ tell from the truth, and a point light, a probe volume and a reflection's box+ projection all can. It uses the position the vertex stage already hands it.+ On WebGPU the same shader never told the injected header which instance it was,+ so every material-shaded draw read instance 0's indirect light — one probe+ volume's worth for the lot.+- **A wall can stop a frame from drawing what is behind it.** `Occluder` declaresa box sight does not pass through. Every camera rasterises the ones it can seeonto a small depth grid before collecting, and a renderable whose bounds arediff --git a/desktop b/desktopindex 6207b2ec7..d666c90d9 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit 6207b2ec785ad763c05507b141bce3bf0e118e64+Subproject commit d666c90d9e8f8288264728770269cdf62d58bd13diff --git a/docs/astro/src/content/docs/graphics/lighting.mdx b/docs/astro/src/content/docs/graphics/lighting.mdxindex c9fa7ee05..deac3602c 100644--- a/docs/astro/src/content/docs/graphics/lighting.mdx+++ b/docs/astro/src/content/docs/graphics/lighting.mdx@@ -386,12 +386,44 @@ An object whose geometry carries the channel but has no `MeshLightmap` draws exait did before: the rectangle is zero, and the shader reads that as "no bake" rather thanas an atlas of black.-:::caution-Estella has no lightmapper yet — nothing in the editor *produces* an atlas. The reading-side is what shipped here, so a bake authored elsewhere (Blender's Cycles, a Substance-bake, any renderer that writes a lightmap and its UV layout) can be brought in and read-today. Baking from inside the editor is the next piece.-:::+The editor bakes one: **Lighting → Bake Lighting** writes the atlas beside the scene+and fills in every `MeshLightmap`, and `node pipeline/bin/estella.mjs bake-scene+<scene>` does the same thing from the command line. A bake authored elsewhere+(Blender's Cycles, a Substance bake, any renderer that writes a lightmap and its UV+layout) is still read exactly as well — the component is the contract, not the baker.++### What a shiny surface reflects indoors++A lightmap is the diffuse half. The other half is what a **mirror** shows, and without+a probe that is always the sky — indoors, a chrome ball reflects the clouds through+the ceiling.++`ReflectionProbe` is the answer, and it is the same shape as `LightProbeVolume`: a box,+filled by the same bake.++```typescript+world.insert(room, ReflectionProbe, { halfExtents: { x: 400, y: 220, z: 400 } });+```++The baker captures the sphere seen from the probe's position, prefilters it for every+roughness, and writes every probe of the scene into ONE atlas beside the lightmap —+`reflection` names it and `slot` says which column is this one's. Both fields are the+baker's to write; what you place is the box.++Three things worth knowing:++- **The reflection is projected onto the box**, so it slides across a wall as the eye+ moves instead of being painted on. Size the box to the room, not to the object.+- **Where two boxes overlap the smaller wins** — a cupboard inside a hall reflects what+ the cupboard was baked to say.+- **Do not put a probe inside a shiny object.** The capture is taken from that point;+ standing inside the ball, all it sees is the inside of the ball.++<Aside type="tip">+The probe reads what the bake solved, so bake the lighting first and the reflections+follow. Moving a probe changes the bake's fingerprint, and the Lighting panel says the+scene is out of date.+</Aside>Skinned meshes take no bake: bones move a character, and a bake cannot hold one stilllong enough to light it. A character in a baked room is lit in real time, by the lightsdiff --git a/docs/astro/src/content/docs/zh-cn/graphics/lighting.mdx b/docs/astro/src/content/docs/zh-cn/graphics/lighting.mdxindex c1be44a46..88874bf6d 100644--- a/docs/astro/src/content/docs/zh-cn/graphics/lighting.mdx+++ b/docs/astro/src/content/docs/zh-cn/graphics/lighting.mdx@@ -300,11 +300,37 @@ cmds.spawn()几何带着这条通道、却没有 `MeshLightmap` 的对象,画出来和以前一模一样:矩形是零,着色器把它读成「没有烘焙」,而不是读成一张全黑的图集。-:::caution-Estella 目前还**没有烘焙器**——编辑器里没有任何东西会*产出*一张图集。这里落地的是读取的那一端,所-以别处烘出来的图(Blender 的 Cycles、Substance 的烘焙、任何写出 lightmap 与其 UV 布局的渲染器)-今天就能拿进来读。在编辑器里烘焙是下一块。-:::+编辑器会烘:**Lighting → Bake Lighting** 把图集写在场景旁边并填好每个 `MeshLightmap`,命令行+`node pipeline/bin/estella.mjs bake-scene <场景>` 做同一件事。别处烘出来的图(Blender 的+Cycles、Substance 的烘焙、任何写出 lightmap 与其 UV 布局的渲染器)照样读得一样好——契约是组件,+不是烘焙器。++### 室内的镜面反射的是什么++lightmap 是漫反射那一半。另一半是**镜子**里看到的东西,而没有探针时那永远是天空——在室内,一颗+铬球会隔着天花板反射云。++`ReflectionProbe` 就是答案,形状和 `LightProbeVolume` 完全一样:一个盒子,由同一次烘焙填。++```typescript+world.insert(room, ReflectionProbe, { halfExtents: { x: 400, y: 220, z: 400 } });+```++烘焙器从探针所在的位置拍下整个球面,按每一档粗糙度预过滤,并把场景里每个探针写进**同一张**图集+(就放在 lightmap 旁边)——`reflection` 指向它,`slot` 说这是哪一列。这两个字段都由烘焙器写;+你摆的是那个盒子。++三件值得知道的事:++- **反射会被投影到这个盒子上**,所以视角一动,墙上的反射会跟着滑,而不是像贴上去一样不动。+ 盒子按房间来定大小,不要按物体。+- **两个盒子重叠时小的赢** —— 大厅里的柜子反射的是柜子那次烘焙说的东西。+- **不要把探针放在镜面物体里面**。拍摄就在那个点进行;站在球里面,它看见的只有球的内壁。++<Aside type="tip">+探针读的是烘焙解出来的东西,所以先烘光照,反射跟着就有了。移动探针会改变烘焙的指纹,+Lighting 面板会说场景已经过期。+</Aside>蒙皮网格不吃烘焙:骨骼在动角色,而烘焙抓不住一个动着的角色去照亮它。烘焙好的房间里的角色,由留下来的那些实时光点亮。diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.jsonindex 6e0a87db2..98008e19e 100644--- a/docs/astro/src/data/apiStability.generated.json+++ b/docs/astro/src/data/apiStability.generated.json@@ -2,11 +2,11 @@"note": "Generated by tools/api-stability.mjs from sdk/etc/*.api.md — do not edit.","counts": {"public": 114,- "beta": 102,- "experimental": 1989,+ "beta": 103,+ "experimental": 1994,"deprecated": 3},- "total": 2205,+ "total": 2211,"subsystems": [{"id": "ecs",@@ -2368,6 +2368,18 @@"minigame"]},+ {+ "name": "ReflectionProbeData",+ "kind": "interface",+ "deprecated": false,+ "entries": [+ "index",+ "index.node",+ "index.native",+ "wechat",+ "minigame"+ ]+ },{"name": "SceneConfig","kind": "interface",diff --git a/docs/astro/src/data/componentDocs.ts b/docs/astro/src/data/componentDocs.tsindex aa99dcf9f..2c6300a60 100644--- a/docs/astro/src/data/componentDocs.ts+++ b/docs/astro/src/data/componentDocs.ts@@ -85,6 +85,7 @@ export const COMPONENT_DOCS: Record<string, ComponentDoc> = {SpriteMask: { category: 'graphics', summary: "Turns this entity's Sprite into a stencil that cuts the sprites drawn after it — a window, or a hole.", doc: 'graphics/sprites', anchor: 'sprite-masks', anchorZh: '精灵遮罩' },SortingGroup: { category: 'graphics', summary: 'Makes an entity and its whole subtree sort as one unit — the group states the layer and order, members state their place inside it.', doc: 'graphics/sprites', anchor: 'sorting-groups', anchorZh: '排序组' },LODGroup: { category: 'graphics', summary: 'Cheaper stand-in meshes for a MeshRenderer, chosen by how much of the screen the object covers.', doc: 'performance/level-of-detail', anchor: 'the-lodgroup-component', anchorZh: 'lodgroup-组件' },+ ReflectionProbe: { category: 'graphics', summary: 'A box inside which reflections come from a bake rather than from the sky — the specular half of what a light probe volume answers.', doc: 'graphics/lighting', anchor: 'baked-light', anchorZh: '烘焙光照' },Occluder: { category: 'graphics', summary: 'A box sight does not pass through — what stands behind it is not collected, and the picture is unchanged.', doc: 'performance/occlusion-culling', anchor: 'the-box-is-authored-and-it-belongs-inside-the-wall', anchorZh: '盒子是创作出来的而且它要在墙的里面' },Video: { category: 'graphics', summary: 'Plays a video stream onto a surface in the world or the UI.', doc: 'graphics/video', anchor: 'the-video-component', anchorZh: 'video-组件' },diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.jsonindex bfb1f3ecc..663e596a3 100644--- a/docs/astro/src/data/components.generated.json+++ b/docs/astro/src/data/components.generated.json@@ -3452,6 +3452,39 @@"blendDistance"]},+ {+ "name": "ReflectionProbe",+ "source": "cpp",+ "fields": [+ {+ "key": "reflection",+ "type": "Asset<environment>",+ "default": "none",+ "doc": "The scene's baked reflections (the baker writes this)."+ },+ {+ "key": "halfExtents",+ "type": "Vec3",+ "default": "(200, 200, 200)",+ "doc": "Half the box this probe answers inside, from the entity's position.",+ "range": "≥ 0"+ },+ {+ "key": "slot",+ "type": "number",+ "default": "0",+ "doc": "Which column of the atlas this probe occupies (the baker writes this).",+ "range": "≥ 0",+ "advanced": true+ },+ {+ "key": "enabled",+ "type": "boolean",+ "default": "true",+ "doc": "Off: what stands inside this box reflects the sky again."+ }+ ]+ },{"name": "Replicated","source": "ts",diff --git a/fixtures/scenes/mat-env/rough.esmaterial b/examples/physics-3d/assets/materials/chrome.esmaterialsimilarity index 66%rename from fixtures/scenes/mat-env/rough.esmaterialrename to examples/physics-3d/assets/materials/chrome.esmaterialindex d91eb6cfa..f7d36e7cb 100644--- a/fixtures/scenes/mat-env/rough.esmaterial+++ b/examples/physics-3d/assets/materials/chrome.esmaterial@@ -3,9 +3,10 @@"type": "material","shader": "builtin:model","blendMode": 0,- "depthTest": false,+ "depthTest": true,+ "depthWrite": true,"properties": {"u_metallic": 1,- "u_roughness": 1+ "u_roughness": 0.12}}diff --git a/examples/physics-3d/assets/materials/chrome.esmaterial.meta b/examples/physics-3d/assets/materials/chrome.esmaterial.metanew file mode 100644index 000000000..8ea86ba39--- /dev/null+++ b/examples/physics-3d/assets/materials/chrome.esmaterial.meta@@ -0,0 +1,6 @@+{+ "uuid": "2874aeeb-ae5f-45fc-bde6-54ac07398171",+ "version": "2.0",+ "type": "material",+ "importer": {}+}diff --git a/examples/physics-3d/assets/scenes/main.esscene b/examples/physics-3d/assets/scenes/main.essceneindex 70fbf3304..42d1d5384 100644--- a/examples/physics-3d/assets/scenes/main.esscene+++ b/examples/physics-3d/assets/scenes/main.esscene@@ -1037,8 +1037,8 @@"scaleOffset": {"x": 0.033203125,"y": 0.033203125,- "z": 0.7431640625,- "w": 0.2900390625+ "z": 0.810546875,+ "w": 0.322265625}}}@@ -1522,7 +1522,7 @@"bounces": 2,"samples": 64,"probeSamples": 128,- "bakedFrom": "d5774992810126ae"+ "bakedFrom": "5a02a75515a28e41"}}]@@ -1613,6 +1613,90 @@}}]+ },+ {+ "id": 60,+ "name": "Chrome",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -360,+ "y": 70,+ "z": -150+ },+ "scale": {+ "x": 0.9,+ "y": 0.9,+ "z": 0.9+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "builtin:sphere",+ "lit": true,+ "opaque": true,+ "cullBackfaces": true,+ "color": {+ "r": 1,+ "g": 1,+ "b": 1,+ "a": 1+ },+ "material": "assets/materials/chrome.esmaterial"+ }+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "@uuid:b55cdc1e-9d77-4868-aa6e-e24c4156a10f",+ "scaleOffset": {+ "x": 0.0673828125,+ "y": 0.0673828125,+ "z": 0.7431640625,+ "w": 0.2900390625+ }+ }+ }+ ]+ },+ {+ "id": 61,+ "name": "RoomProbe",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -360,+ "y": 100,+ "z": -150+ }+ }+ },+ {+ "type": "ReflectionProbe",+ "data": {+ "reflection": "@uuid:5d7cf6c2-c34e-46f0-849b-3be348db3ff6",+ "halfExtents": {+ "x": 320,+ "y": 220,+ "z": 320+ },+ "slot": 1,+ "enabled": true+ }+ }+ ]}]}diff --git a/examples/physics-3d/assets/scenes/main_lightmap.png b/examples/physics-3d/assets/scenes/main_lightmap.pngindex fff03c2f1..318c71abb 100644Binary files a/examples/physics-3d/assets/scenes/main_lightmap.png and b/examples/physics-3d/assets/scenes/main_lightmap.png differdiff --git a/examples/physics-3d/assets/scenes/main_probes_50.esprobes b/examples/physics-3d/assets/scenes/main_probes_50.esprobesindex db44f4b7a..3063786cf 100644--- a/examples/physics-3d/assets/scenes/main_probes_50.esprobes+++ b/examples/physics-3d/assets/scenes/main_probes_50.esprobes@@ -1,5 +1,5 @@{"version": 1,"resolution": [7,3,5],- "irradiance": [0.784199,0.942269,1.21392,-0.0142376,-0.0165754,-0.0212008,-0.0245614,-0.028769,-0.0361766,-0.0244906,-0.0283473,-0.0367389,-0.00665394,-0.00767136,-0.00994106,-0.00701993,-0.00822114,-0.0103364,-0.00276686,-0.00336581,-0.00380017,-0.0117273,-0.0136756,-0.0174229,-0.00418741,-0.00477321,-0.0063521,0.754259,0.909105,1.16567,-0.0345292,-0.0391108,-0.0533632,-0.0501601,-0.0571411,-0.0775201,-0.0088015,-0.0102453,-0.0136023,-0.00117761,-0.00132565,-0.00181995,-0.018883,-0.0213939,-0.0291829,-0.00813457,-0.00932471,-0.0125716,-0.00544638,-0.00635937,-0.00841712,0.0000724218,0.0000144798,0.000111941,0.738265,0.891448,1.14096,-0.0415297,-0.0469878,-0.0641821,-0.0613031,-0.0693331,-0.0947412,-0.00666444,-0.00754115,-0.0102996,-0.000164009,-0.000158209,-0.000253467,-0.0219174,-0.0247971,-0.0338723,-0.00980345,-0.0110879,-0.0151508,-0.00276039,-0.00312344,-0.00426606,-0.00145615,-0.00164875,-0.0022504,0.744343,0.89828,1.15104,-0.03519,-0.0398193,-0.0543158,-0.0558161,-0.0631664,-0.0856054,0.000189076,0.000184484,0.000743749,0.00124699,0.00143617,0.0019597,-0.0181382,-0.0205242,-0.0279844,-0.00841612,-0.00953069,-0.0128094,0.00111209,0.00123831,0.00202939,-0.00399545,-0.00452841,-0.00607028,0.742763,0.896543,1.14791,-0.0353461,-0.0399907,-0.0546252,-0.0573173,-0.0648191,-0.0885785,-0.000871625,-0.000992239,-0.00135044,0.0011701,0.00135073,0.00180801,-0.018246,-0.0206427,-0.028198,-0.00887104,-0.0100326,-0.0137096,0.000384958,0.000432524,0.000593141,-0.00423153,-0.00478725,-0.00653856,0.738265,0.891448,1.14096,-0.0416913,-0.0471706,-0.0644319,-0.0603309,-0.068233,-0.0932387,0.000216157,0.000243746,0.00033406,0.000435549,0.000520148,0.000673122,-0.021933,-0.0248148,-0.0338965,-0.00877747,-0.00992704,-0.0135652,0.00134987,0.00152703,0.00208617,-0.00202098,-0.00228781,-0.00312331,0.79544,0.955654,1.22912,-0.00940559,-0.0107506,-0.0145809,-0.0152349,-0.0172778,-0.0235728,0.0183886,0.0213473,0.0286434,0.00559651,0.0064483,0.00868594,-0.00430449,-0.00488046,-0.00665698,-0.000572243,-0.000514363,-0.000830958,0.00848739,0.00965783,0.0131397,-0.00373633,-0.00444115,-0.00586229,0.772995,0.92721,1.19073,0.0156568,0.0187821,0.0243505,-0.0304957,-0.0368945,-0.0501687,-0.0329498,-0.0398915,-0.0543751,0.00939764,0.0112841,0.0146848,0.00606617,0.00727504,0.00945592,-0.00326612,-0.00395759,-0.00544392,-0.0134409,-0.0163278,-0.0227269,-0.00654415,-0.00797784,-0.0112697,0.737739,0.883698,1.13571,0.0502358,0.0603404,0.0781974,-0.0521571,-0.0641002,-0.0840785,-0.0194365,-0.0233208,-0.0345867,0.00868505,0.0104803,0.01388,0.0222874,0.0267773,0.0347541,-0.00208196,-0.00297235,-0.00369737,-0.00446887,-0.00527781,-0.00951411,0.00303563,0.0034651,0.00362123,0.735961,0.881039,1.12779,0.0590688,0.0710825,0.0926497,-0.0481937,-0.0596633,-0.0838551,-0.00854988,-0.00949225,-0.0156736,0.00316073,0.00373754,0.00501625,0.0263225,0.0317281,0.0417299,0.00323935,0.00344181,0.0018006,-0.00115812,-0.00100151,-0.00317411,0.00433423,0.0048066,0.00558303,0.714247,0.855221,1.09368,0.06859,0.0825754,0.108054,-0.0689963,-0.0840343,-0.11344,0.00276033,0.00348374,-0.000307282,0.00000670818,0.0000754151,0.000816506,0.0321691,0.0387326,0.0506588,-0.00281841,-0.0035513,-0.00572177,-0.00238017,-0.00259134,-0.00391107,0.00376683,0.00404903,0.00364189,0.734335,0.878646,1.11513,0.0610943,0.0739989,0.100608,-0.0501035,-0.0623038,-0.0958982,0.0166474,0.0196178,0.0187282,-0.00387643,-0.00444879,-0.00413205,0.0272609,0.0331659,0.0462326,0.00267804,0.00262673,-0.00185161,0.00691217,0.00800603,0.0070264,0.00496906,0.00564523,0.00629537,0.766586,0.916199,1.1574,0.0355324,0.0444834,0.0700594,-0.0271072,-0.0359082,-0.0661516,0.0343287,0.0406591,0.0459899,-0.0115031,-0.0134864,-0.0145026,0.0139961,0.0179476,0.030892,0.00452149,0.00444707,0.000564079,0.0128677,0.0152393,0.0166112,0.00203075,0.00255397,0.00448063,0.807805,0.966265,1.22377,0.00640457,0.00892532,0.0210773,0.00357563,0.00164713,-0.0170758,0.017284,0.0222929,0.0370407,-0.00532931,-0.00680186,-0.0118873,-0.00043037,0.000269435,0.00643293,0.00845229,0.00949207,0.00654081,0.00308294,0.00451171,0.0110695,-0.00497992,-0.00612681,-0.00759717,0.796579,0.955355,1.2261,0.0188647,0.0228383,0.0309956,-0.0111487,-0.013681,-0.0200058,-0.0108242,-0.0134996,-0.0214125,0.00722447,0.0088065,0.0124232,0.0069183,0.00838324,0.0114375,0.00148119,0.00182296,0.00270685,-0.00316506,-0.00400486,-0.00678846,0.00354749,0.00410948,0.00412924,0.781209,0.933057,1.19376,0.03891,0.0484258,0.0654506,-0.0117539,-0.0169952,-0.0282949,-0.011117,-0.0165785,-0.0257551,0.00814059,0.0106279,0.0149025,0.00998522,0.012837,0.0183826,0.00832184,0.00991642,0.0113832,-0.00250387,-0.00431323,-0.00756037,0.0113409,0.0127375,0.0155265,0.767462,0.918146,1.17093,0.0514351,0.0629985,0.0861086,-0.016532,-0.021992,-0.0377673,-0.00382119,-0.00467636,-0.0140137,0.00351939,0.00420428,0.00794936,0.0131131,0.016424,0.024176,0.0109369,0.0127794,0.0145259,-0.0000799089,-0.000162786,-0.0041708,0.0141417,0.0166999,0.0204783,0.771396,0.923642,1.17305,0.050376,0.0615198,0.0881349,-0.0159891,-0.0207714,-0.0394943,0.00643533,0.0066681,0.000172818,-0.00270073,-0.00281661,-0.000176066,0.013557,0.0168586,0.0265791,0.00989844,0.0115653,0.0124726,0.00240895,0.00242648,-0.000584461,0.0164391,0.0196565,0.0249405,0.76076,0.907035,1.15219,0.0563835,0.0711325,0.101368,-0.0203383,-0.0292334,-0.0518636,0.0174632,0.0203628,0.0218053,-0.007993,-0.00908902,-0.00959919,0.0154576,0.0206553,0.0325931,0.0117701,0.013106,0.0130732,0.00634608,0.00703338,0.00716447,0.0146574,0.0178473,0.0244963,0.792702,0.94451,1.19034,0.0263686,0.0359672,0.0665118,-0.00508029,-0.0116303,-0.0334027,0.0159928,0.0198603,0.0232139,-0.00932277,-0.0112423,-0.0126261,0.00507186,0.00849597,0.0202364,0.0079036,0.00826282,0.00853673,0.00362481,0.0049074,0.00611633,0.00635199,0.00837685,0.0157786,0.807851,0.966315,1.22379,0.0067131,0.0102113,0.0290539,0.00233406,0.000733921,-0.0130576,0.01488,0.0193004,0.0327989,-0.00625796,-0.00810349,-0.0144711,-0.00105614,-0.000302662,0.00673953,0.00608864,0.00722108,0.00845138,0.001834,0.00290547,0.00779555,-0.00360499,-0.00402375,-0.00177022,0.756818,0.909566,1.17457,-0.0398756,-0.0471264,-0.0587807,-0.0134871,-0.0159045,-0.0188887,-0.0404375,-0.0475938,-0.058847,-0.0183207,-0.0216288,-0.0267031,-0.00425106,-0.00492478,-0.00598229,0.00198342,0.00245402,0.00294342,-0.00527483,-0.00626629,-0.00733988,0.00117488,0.00149262,0.00220849,0.750162,0.89968,1.16172,-0.031071,-0.0389917,-0.0469475,0.0177649,0.0186769,0.0271083,-0.00512136,-0.0034418,-0.0104419,0.00471313,0.00687444,0.00632632,0.00587031,0.00618493,0.00889823,-0.00420915,-0.00453919,-0.00686184,0.00439858,0.00501944,0.00687251,-0.00670441,-0.00709621,-0.00962245,0.579456,0.70952,0.89488,-0.156838,-0.17811,-0.242633,0.00628009,0.00521146,0.00921227,-0.0208579,-0.022875,-0.0317688,-0.00366041,-0.00384332,-0.00552483,0.00301846,0.00303845,0.00453058,0.00468273,0.00482789,0.00716455,-0.00943599,-0.0103705,-0.0143374,0.0104681,0.0115661,0.0160859,0.556705,0.685291,0.860314,-0.163754,-0.18529,-0.253021,-0.00290044,-0.00363065,-0.00460464,-0.00149607,-0.0016517,-0.00208774,0.000109404,0.000191911,0.000218934,-0.000362332,-0.000453049,-0.000576245,0.00599904,0.00687268,0.0092531,-0.00381695,-0.00412866,-0.00582922,0.00416029,0.00437663,0.00638839,0.548019,0.674761,0.847143,-0.167725,-0.190516,-0.259122,-0.00739549,-0.00878545,-0.0113116,-0.00437296,-0.00675094,-0.00689015,-0.00223183,-0.00312691,-0.00347981,-0.00137237,-0.00171972,-0.00208143,0.00632284,0.00738162,0.00976003,-0.00393683,-0.00489132,-0.00612822,0.0026806,0.00272464,0.00418396,0.564293,0.694816,0.872222,-0.163012,-0.184389,-0.251897,-0.000647106,-0.000677531,-0.000982319,0.0105591,0.0117138,0.0161692,0.00111864,0.00125392,0.00170365,-0.000219864,-0.000243505,-0.000336944,0.00517692,0.00580601,0.00796509,0.0000497696,0.0000335091,0.0000624096,0.00715478,0.00818434,0.0111156,0.735067,0.886074,1.13601,-0.0426551,-0.0497094,-0.0659214,0.00384984,0.00458429,0.00594976,0.0681741,0.0782958,0.10536,0.0240135,0.0278921,0.0371118,0.00243659,0.00289348,0.00376564,0.00721582,0.00843961,0.0111517,-0.00139218,-0.00162909,-0.00215155,-0.0112601,-0.0125901,-0.0174019,0.689005,0.827576,1.06977,0.0253091,0.0299982,0.0367148,-0.0219841,-0.025837,-0.030473,-0.118137,-0.141315,-0.17968,0.0155026,0.0184169,0.0227596,0.00159506,0.00177835,0.00159113,0.010682,0.0129119,0.0171105,-0.00940035,-0.0110806,-0.013241,-0.0336557,-0.0403724,-0.0519206,0.704671,0.835057,1.07982,0.0639723,0.0787988,0.100946,0.0340203,0.0386964,0.046929,-0.0254329,-0.0220496,-0.0380291,0.0185792,0.0213045,0.0288242,-0.0185148,-0.0219933,-0.0275792,0.011089,0.0137907,0.015684,0.00793668,0.00991749,0.0107483,-0.00790899,-0.0117555,-0.0135104,0.639521,0.76157,0.972264,0.146348,0.176683,0.230596,0.0439026,0.0504146,0.0586845,-0.0209996,-0.0253951,-0.04393,0.0148265,0.0181458,0.0255004,-0.0208126,-0.0246462,-0.0302359,0.0236861,0.0290691,0.0366895,-0.000612633,-0.000837605,-0.00515884,0.0233896,0.0260396,0.0318889,0.608601,0.726983,0.919215,0.172032,0.20775,0.274165,0.027132,0.0308657,0.026704,0.00581201,0.00630415,-0.00352678,-0.00117408,-0.000899663,0.00163941,-0.00918514,-0.0105668,-0.00989441,0.0294681,0.0353578,0.0428089,-0.00535005,-0.0067663,-0.0132471,0.0253411,0.0298891,0.0366262,0.680766,0.80332,0.983593,0.114641,0.146818,0.220816,0.0532381,0.0573682,0.0443223,0.0449448,0.0512281,0.0432908,-0.0151866,-0.0172412,-0.0131355,-0.0238193,-0.0259531,-0.0217786,0.015635,0.019451,0.0242179,0.00555879,0.00501545,0.00020741,0.0195749,0.0241786,0.0314057,0.791637,0.933388,1.10524,0.0100088,0.0235932,0.111019,0.0382651,0.0389334,0.0263243,0.0385535,0.0479598,0.0603231,-0.0194996,-0.0232905,-0.02619,-0.0171562,-0.0184372,-0.014595,-0.00523236,-0.0062387,0.00197848,-0.0135169,-0.0141765,-0.0112281,-0.00740195,-0.00719552,0.00710642,0.832447,0.991389,1.2243,-0.0156281,-0.0139204,0.0193378,0.0104725,0.0108226,0.00433424,-0.00605524,-0.00209579,0.0315365,0.00661951,0.00574571,-0.00959056,-0.00369894,-0.00401105,-0.0023597,-0.00403869,-0.00421518,-0.000590428,-0.00223625,-0.00198632,0.000257681,-0.00439418,-0.00539281,-0.00562498,0.777707,0.932328,1.19284,0.0367069,0.0444527,0.0607281,-0.00635955,-0.00836281,-0.0164995,-0.0225506,-0.0277589,-0.0419051,0.0148615,0.0180474,0.0251489,0.00468073,0.00585822,0.00943793,0.00661405,0.00787512,0.00982991,-0.000429273,-0.000926866,-0.00440924,0.00682454,0.00806019,0.00916061,0.75801,0.907335,1.16111,0.0545247,0.066961,0.0890903,0.0179765,0.0204984,0.0209569,-0.0206822,-0.0252076,-0.0395494,0.011754,0.0140535,0.0204486,-0.0111132,-0.0129703,-0.0149124,0.0131412,0.015822,0.0201448,0.00140203,0.00133499,-0.00152726,0.00936203,0.0113393,0.012979,0.774245,0.922986,1.15997,0.0535366,0.0679377,0.10371,0.0237292,0.0258226,0.0165064,0.00489379,0.00434907,-0.0143887,0.00129581,0.00220614,0.0107599,-0.0130477,-0.0145427,-0.0116795,0.0142642,0.0175928,0.0226185,0.00514687,0.00569378,0.00184287,0.020644,0.0242334,0.0289235,0.744603,0.889259,1.1161,0.0795205,0.0981954,0.146978,0.0187648,0.0202168,0.00685522,0.00308343,0.00320685,-0.00874973,-0.000770667,-0.000541343,0.00570633,-0.00985563,-0.0107257,-0.00442851,0.0214318,0.0257354,0.0317745,0.00193204,0.00197316,-0.00112685,0.0249731,0.0299661,0.0408241,0.765929,0.909764,1.12573,0.0538454,0.0720939,0.130694,0.0254219,0.0252826,0.00660351,0.0286347,0.0333314,0.0369937,-0.0163754,-0.0185136,-0.0191672,-0.0154001,-0.0155627,-0.00581817,0.0167572,0.0205833,0.0279289,0.00203534,0.00220456,0.00306382,0.013631,0.0177269,0.0309783,0.815468,0.965139,1.18442,0.00501852,0.0175747,0.0744477,0.0364174,0.0358531,0.0167162,0.0181562,0.0243681,0.0346216,-0.0109871,-0.0144941,-0.019222,-0.0220188,-0.0218843,-0.011639,0.00860509,0.0106241,0.017003,-0.004041,-0.00336585,-0.00152269,-0.00175364,0.000909946,0.0154651,0.823707,0.982631,1.22374,-0.00262265,0.00129797,0.0357387,0.0195615,0.0212149,0.00970947,-0.0020998,0.000797354,0.0227982,0.00228108,0.00109977,-0.0108788,-0.0105052,-0.011464,-0.00587305,0.00301494,0.00421986,0.00914167,-0.0066456,-0.00717245,-0.00296313,-0.000524501,-0.000108323,0.00557557,0.759121,0.912943,1.18209,-0.0387468,-0.0453784,-0.0545031,-0.0000392355,0.0000459978,0.000676434,-0.0385864,-0.0449305,-0.0539448,-0.0173451,-0.0202804,-0.024188,-0.00118356,-0.00128971,-0.00155062,0.00189862,0.00225903,0.00320426,0.000280022,0.000334604,0.000818536,0.000798879,0.00105032,0.00138111,0.754148,0.903881,1.17109,-0.0291065,-0.0365479,-0.0417463,-0.00366749,-0.00454963,-0.00531384,0.00632176,0.00860221,0.00545117,0.01015,0.0127436,0.0138554,-0.00210706,-0.00231623,-0.00282712,-0.00147027,-0.00144391,-0.00251562,-0.00100784,-0.00150627,-0.00166533,-0.00666542,-0.00738159,-0.00975548,0.759903,0.910472,1.17486,-0.0169629,-0.0215613,-0.0266921,-0.0106721,-0.0136992,-0.0178573,-0.0214193,-0.0223652,-0.0318332,-0.00326604,-0.00293254,-0.0046597,-0.00394109,-0.00481396,-0.0062389,-0.00628028,-0.00702046,-0.00946679,-0.00788202,-0.00970426,-0.0120299,-0.0109719,-0.0134035,-0.016695,0.564664,0.686104,0.872997,-0.154964,-0.180723,-0.239515,-0.0173195,-0.0250877,-0.0266913,-0.0360323,-0.03893,-0.0561112,-0.0160046,-0.0177141,-0.0247297,-0.00900357,-0.0124404,-0.013909,-0.00925018,-0.010999,-0.0144412,0.00319489,0.00375951,0.00485017,0.0102366,0.0119638,0.016046,0.553438,0.681029,0.855325,-0.165166,-0.187135,-0.255254,-0.00255531,-0.00412411,-0.00395952,0.00313121,0.00414916,0.00483215,0.000691386,0.000894232,0.00106758,-0.00072079,-0.00100343,-0.00111552,0.001431,0.00123307,0.00221444,0.00305555,0.00382867,0.00472654,0.00612384,0.00677528,0.0094658,0.557238,0.686194,0.861189,-0.163951,-0.185557,-0.253378,0.00294002,0.00302823,0.00454058,0.0122891,0.0142866,0.0189893,0.00135077,0.00159318,0.00208718,0.0000598677,0.0000364867,0.0000921394,0.00285937,0.00321544,0.00441954,0.00161987,0.002041,0.00250523,0.00631282,0.00702102,0.00975702,0.728669,0.878397,1.12613,-0.0443287,-0.0517178,-0.0685079,0.0108845,0.0130259,0.0168216,0.0696847,0.0801085,0.107694,0.0243005,0.0282365,0.0375553,0.00377303,0.00449721,0.00583105,0.00413922,0.00474768,0.00639699,-0.00259844,-0.0030766,-0.00401576,-0.0112306,-0.0125547,-0.0173564,0.680688,0.818363,1.06186,0.022113,0.0257377,0.0290372,0.00911259,0.011433,0.017289,-0.11909,-0.141658,-0.175995,0.0122771,0.0142583,0.0159203,-0.000844339,-0.00114456,-0.00215075,0.0032192,0.00375643,0.00428857,0.0023945,0.00312106,0.00529537,-0.0331474,-0.0395681,-0.0498837,0.760646,0.900888,1.16136,0.0205129,0.0267529,0.0352789,0.0212318,0.0251598,0.0256152,0.0120287,0.0220573,0.0147844,-0.000548861,-0.00128484,0.00107634,-0.00646785,-0.00797874,-0.00830856,0.000655726,0.000822237,-0.000466543,0.00950674,0.0107838,0.0115738,-0.00960974,-0.0141053,-0.0175441,0.783691,0.929514,1.15822,0.0181015,0.0251767,0.0525249,0.0620003,0.0702792,0.064155,0.00457323,0.00215661,-0.0217023,0.00277962,0.00471776,0.013983,-0.0236303,-0.0270575,-0.0251823,-0.00246198,-0.0021609,-0.00554843,0.0137127,0.0153856,0.01475,-0.00160354,-0.00472825,-0.00912181,0.793663,0.937764,1.10984,0.0135792,0.0259939,0.105412,0.094456,0.108291,0.0948853,0.0187092,0.0209947,0.0000580761,-0.008031,-0.00806645,0.00142392,-0.0442926,-0.0507085,-0.0443408,-0.00398788,-0.00415225,-0.00174304,-0.00260534,-0.00315685,-0.00365232,0.001379,0.00230466,0.0119867,0.877272,1.00754,1.15513,-0.0464468,-0.0216271,0.0773539,0.0472538,0.0456855,0.0372932,0.0240753,0.0155172,0.00842059,-0.0102956,-0.00481311,-0.00194327,-0.0165968,-0.0137683,-0.0110093,-0.00458634,-0.00266547,0.00316917,-0.00586261,-0.00744361,-0.00399418,-0.0055778,-0.00274026,0.00899836,0.894485,1.03591,1.18283,-0.0723902,-0.0588954,0.043579,0.0507454,0.0570368,0.0506337,-0.00888375,0.00605988,0.0243291,0.00407405,-0.00284791,-0.00802943,-0.0172349,-0.0192989,-0.017228,-0.0167328,-0.015173,-0.00875482,-0.00419992,-0.00439708,-0.00294079,-0.0156473,-0.0173214,-0.00258329,0.868377,1.0282,1.25039,-0.0318854,-0.030866,0.00663446,0.00784719,0.00954966,0.0067862,-0.0324996,-0.0280815,0.0131178,0.0148732,0.0139925,-0.0034729,-0.00227332,-0.00269459,-0.00196257,-0.0026289,-0.00184432,0.000902002,-0.00384482,-0.0048974,-0.00356837,0.000368704,-0.00131962,-0.00317245,0.767744,0.920679,1.17969,0.0394021,0.0474519,0.0635121,0.00773625,0.00936214,0.0120654,-0.0283639,-0.0349375,-0.0524912,0.0154943,0.0188923,0.0269671,-0.00218871,-0.002682,-0.00356104,0.00285348,0.00367903,0.00676501,0.00493919,0.0058844,0.00709371,0.00559463,0.00632721,0.00542256,0.79096,0.945627,1.19319,0.0188322,0.025384,0.0491345,0.0331222,0.0384266,0.0379806,-0.0124092,-0.0158639,-0.0348611,0.0053555,0.00678712,0.0150093,-0.0184676,-0.0213341,-0.0204947,0.00039291,0.000675935,0.00145006,0.00703535,0.00821286,0.00848828,0.000699819,0.00125744,0.00178122,0.803096,0.955407,1.18603,0.0121391,0.0204999,0.0607864,0.043949,0.0503579,0.0455957,0.00413402,0.00418895,-0.018119,-0.000728054,-0.000301007,0.0115515,-0.0244086,-0.0279005,-0.024824,-0.00243725,-0.00203998,0.0015167,0.0083159,0.00961119,0.00997856,0.00341372,0.00415318,0.00875538,0.799481,0.946947,1.15305,0.013228,0.025926,0.0907462,0.0443374,0.0506992,0.045148,0.0308511,0.0326651,0.0174954,-0.0145053,-0.0145208,-0.00529874,-0.0285754,-0.0326772,-0.0295079,-0.00297784,-0.0015259,0.00567907,0.00436619,0.00495414,0.00662989,0.0036675,0.00546858,0.0184608,0.844528,0.994424,1.19564,-0.0304798,-0.0184181,0.0549125,0.0387451,0.0444511,0.0378,0.0206045,0.0232313,0.0225447,-0.0121852,-0.0130303,-0.0118503,-0.0214022,-0.0244799,-0.0204182,-0.00777075,-0.0060764,0.00301066,-0.00440128,-0.00518065,-0.0042153,-0.0119218,-0.00921166,0.00854556,0.870412,1.02487,1.2358,-0.0496881,-0.0407682,0.0253682,0.0191002,0.0218903,0.0136603,-0.0106615,-0.00705935,0.00522397,0.00758925,0.00526139,-0.00141314,-0.010293,-0.011819,-0.00722223,-0.00822517,-0.00666423,0.00192585,-0.000897502,-0.00131004,-0.00104763,-0.0139383,-0.0115015,0.00575502,0.848519,1.00599,1.23925,-0.0275703,-0.0236254,0.0165705,0.00219567,0.0030639,0.00315818,-0.0141276,-0.00867618,0.0193014,0.0115378,0.00952749,-0.00482808,0.00010335,-0.00010712,-0.0000222003,-0.0019499,-0.00021329,0.00701512,-0.00260247,-0.00320224,-0.00230209,-0.0063577,-0.00717324,-0.00184599,0.75669,0.910026,1.17635,-0.0318456,-0.0369251,-0.0443549,0.0129422,0.015086,0.0183358,-0.04397,-0.0513144,-0.0636645,-0.0153826,-0.0178144,-0.021561,0.00222466,0.00257422,0.00294801,0.00221654,0.00243574,0.00319352,0.00180381,0.00195601,0.00227344,-0.00484155,-0.00576857,-0.00778837,0.708785,0.848455,1.09874,-0.0522876,-0.0647728,-0.0793694,-0.0167403,-0.0194667,-0.0262724,-0.0348278,-0.0404307,-0.0568487,-0.00647381,-0.00701274,-0.0110846,-0.0101897,-0.0119442,-0.0158615,-0.000151413,-0.0000682517,-0.000283832,-0.00905706,-0.0111211,-0.0137164,-0.0132296,-0.0152618,-0.0196483,0.540128,0.647173,0.835861,-0.196896,-0.237022,-0.304269,-0.0168887,-0.0198676,-0.0269746,-0.0394982,-0.04605,-0.0621087,-0.0114279,-0.0132393,-0.0177071,-0.0108565,-0.01279,-0.0168404,0.0203746,0.0245374,0.0315587,0.00650166,0.00740034,0.0106476,0.0170911,0.0204616,0.0268247,0.487875,0.585267,0.753643,-0.224098,-0.269056,-0.346419,0.015215,0.0182481,0.023733,-0.0209803,-0.0240996,-0.0321099,-0.00254961,-0.00290964,-0.00388179,0.00192191,0.00235241,0.00300666,0.0170738,0.0206296,0.0263901,0.00587094,0.0065507,0.008933,0.0134007,0.0159736,0.0206135,0.493244,0.594043,0.762286,-0.223698,-0.267875,-0.345715,0.0138255,0.0150402,0.0213667,-0.00294032,-0.00226936,-0.00454413,0.000588817,0.000954637,0.000909989,0.00193368,0.00202219,0.00298841,0.0156103,0.0190667,0.024125,-0.00074529,-0.0012921,-0.00115181,0.0158909,0.0194457,0.0245587,0.569629,0.698756,0.881325,-0.162416,-0.184446,-0.250926,0.0168615,0.0180627,0.0258033,0.0116184,0.0146095,0.0168459,0.00221449,0.00287827,0.00335696,0.00173892,0.00163441,0.00267237,0.00840974,0.00950065,0.012762,0.000348112,0.000804411,0.000746154,0.00716912,0.00771245,0.0115295,0.73646,0.886731,1.13801,-0.0434538,-0.050767,-0.0671683,0.0133,0.0158831,0.0205943,0.0620076,0.0719623,0.0960029,0.0236922,0.0275802,0.0366255,0.00404401,0.00481113,0.00625218,0.00360322,0.00425548,0.00560522,-0.0040009,-0.00476465,-0.00621566,-0.00848212,-0.00966392,-0.0131789,0.720411,0.866719,1.12627,0.0156282,0.0182032,0.0213357,0.0197844,0.023143,0.0255898,-0.087971,-0.103435,-0.123166,0.00927691,0.010768,0.0123373,-0.00187191,-0.00202706,-0.00105796,0.00644897,0.00742463,0.00776923,0.00746393,0.0087322,0.00955048,-0.024689,-0.0289907,-0.0341442,0.823739,0.972244,1.20482,-0.015495,-0.0122994,0.016186,0.0337796,0.0392156,0.0299986,0.0411179,0.0525955,0.0224002,-0.0143405,-0.0162769,-0.00405681,-0.0110884,-0.0121255,-0.00575574,-0.00720317,-0.00710042,-0.00363769,0.00637049,0.00648785,0.00295794,-0.00284745,-0.00601875,-0.00995277,0.880333,1.03792,1.21572,-0.0667597,-0.0669166,0.0114559,0.0402174,0.0458471,0.032259,0.015913,0.0173071,-0.0107476,-0.00645089,-0.00629264,0.00427706,-0.0138861,-0.0151047,-0.00650203,-0.0152643,-0.0159022,-0.00450969,0.00619024,0.00731414,0.0113254,-0.0170405,-0.019768,-0.0106367,0.926339,1.08462,1.22419,-0.0893191,-0.0893931,0.0154521,0.0207397,0.0271109,0.0332273,0.0197748,0.0198363,0.00810636,-0.00215958,-0.00156589,0.00131988,-0.00658836,-0.00809815,-0.00881415,-0.0186717,-0.0198245,-0.00757094,-0.00708481,-0.00727841,-0.00552076,-0.0115036,-0.0135599,-0.00362029,0.933986,1.09131,1.22945,-0.0993621,-0.0975518,0.0104287,0.011507,0.0201861,0.0324664,0.00906419,0.0107117,0.0110368,-0.00140435,-0.00135437,-0.00106797,0.0000533872,-0.00290234,-0.00629646,-0.0170216,-0.0196221,-0.0104206,-0.0034626,-0.00393145,-0.00542816,-0.0152995,-0.0156395,-0.0027918,0.937258,1.09624,1.24947,-0.0951159,-0.0943554,0.00631485,-0.00241992,0.0048305,0.0149163,-0.020357,-0.0174941,-0.000821169,0.00668122,0.00576101,0.00042048,0.00152051,-0.000584763,-0.00332222,-0.0113546,-0.0136552,-0.00520123,0.00514788,0.00333555,0.00110148,-0.0145161,-0.0152697,0.000143956,0.875522,1.03652,1.26091,-0.0338667,-0.0337311,0.00170319,-0.00939947,-0.00653908,0.00258503,-0.0408918,-0.0384442,0.00417442,0.0169724,0.0168456,-0.000439079,0.00240176,0.00196316,-0.0003827,-0.00396063,-0.00436777,0.000520268,0.00374301,0.00215401,-0.00126771,0.00299096,0.00205068,-0.00118328,0.786877,0.942403,1.19887,0.0256974,0.0317096,0.0484801,0.0142991,0.0172358,0.0222935,-0.0154805,-0.0204864,-0.0413023,0.00959932,0.0122029,0.0213356,-0.00577402,-0.00691188,-0.00865128,0.000235095,0.00070876,0.00452296,0.00596271,0.00721978,0.00950873,0.00570953,0.00630574,0.00424667,0.821947,0.978584,1.22393,-0.0100848,-0.00568959,0.0232035,0.00979673,0.0136381,0.0160453,0.00383371,0.00271012,-0.0169572,-0.00516222,-0.00525948,0.00422443,-0.00258081,-0.00400838,-0.00354597,-0.00479217,-0.00509853,0.000704173,0.009108,0.0105554,0.0123294,-0.00557668,-0.0055159,-0.00313217,0.844005,1.00319,1.22623,-0.0314086,-0.0295023,0.0207972,0.0117052,0.0143322,0.0180173,0.0144704,0.0152097,-0.00564452,-0.00806752,-0.00852652,0.00148663,-0.00599902,-0.00715754,-0.00801522,-0.0128302,-0.0134388,-0.00361115,-0.00509766,-0.00576244,-0.00314235,-0.00958559,-0.0103184,-0.00223772,0.839232,0.995584,1.20578,-0.0280667,-0.02406,0.0400025,0.0286821,0.0350268,0.0473046,0.00949037,0.0116271,0.0032036,-0.00459388,-0.00517348,-0.000782239,-0.0127745,-0.0155622,-0.0212495,-0.0169635,-0.0180734,-0.00761956,-0.0031252,-0.00351466,-0.00117334,-0.00795012,-0.00815758,0.00545,0.858982,1.01372,1.22206,-0.0487644,-0.0425633,0.0248597,0.0110424,0.0185906,0.0365474,0.00992875,0.0112199,0.0151843,-0.00315241,-0.00309755,-0.00472668,-0.00203482,-0.00582131,-0.0148415,-0.015584,-0.0166102,-0.00756867,-0.00695979,-0.00771665,-0.00790849,-0.0165605,-0.0154709,0.00136216,0.861098,1.018,1.22909,-0.0463725,-0.0421464,0.0203114,0.00954059,0.0154845,0.0296284,-0.00936778,-0.00593222,0.0153181,0.0062871,0.00483324,-0.0049859,-0.00167801,-0.00443183,-0.0114129,-0.0144975,-0.0152513,-0.00533917,-0.00309471,-0.00487278,-0.00773113,-0.0131331,-0.0128754,0.000352881,0.838405,0.996296,1.23314,-0.0179201,-0.0141773,0.0227249,0.00353873,0.00659782,0.0165769,-0.0139436,-0.0100115,0.0167429,0.00941132,0.00797565,-0.00584368,0.000113211,-0.0011112,-0.00612795,-0.00580514,-0.00533825,0.00129823,-0.00272184,-0.00428301,-0.00730564,-0.00163328,-0.00175258,0.002727,0.785946,0.943523,1.21541,-0.0104695,-0.0124628,-0.0169436,0.0235611,0.0278547,0.0347018,-0.023857,-0.0285058,-0.0370701,-0.00491798,-0.00587503,-0.00801944,0.0053483,0.0063335,0.0083087,-0.00248536,-0.00281044,-0.00260766,0.0102174,0.0121645,0.0155816,-0.00583963,-0.00699937,-0.00875844,0.73371,0.880762,1.13588,-0.0462048,-0.0553431,-0.0707501,0.067172,0.0802964,0.101831,-0.0131149,-0.0158627,-0.0210687,-0.00219836,-0.002671,-0.00360915,0.0258365,0.0309302,0.0394581,-0.0112908,-0.0134369,-0.0167348,0.0053427,0.00649904,0.00881955,-0.0000604388,-0.0000639413,-0.0000380694,0.720608,0.865193,1.11466,-0.049023,-0.0587818,-0.0755933,0.0735976,0.0880177,0.112938,-0.0075346,-0.00885653,-0.0124368,-0.000328835,-0.000395793,-0.000606835,0.0267937,0.0321288,0.0413083,-0.00917839,-0.0110166,-0.0140498,0.00293448,0.00346693,0.00500317,-0.00488942,-0.00572136,-0.0073363,0.710921,0.853018,1.09852,-0.0509142,-0.0611457,-0.0787159,0.0853832,0.102608,0.1321,-0.00953035,-0.0108101,-0.0145868,-0.000438369,-0.000472302,-0.000659809,0.0284353,0.0341546,0.0439634,-0.0152503,-0.0183781,-0.0235929,0.00403841,0.00453097,0.00615733,-0.00419478,-0.00501035,-0.00652225,0.712036,0.854752,1.10042,-0.0513118,-0.0615381,-0.0793001,0.0849512,0.101592,0.131288,-0.000499036,-0.0005501,-0.000771237,0.000320619,0.000388895,0.000495503,0.0286675,0.0343712,0.0443043,-0.0152876,-0.018181,-0.0236263,-0.00056832,-0.000722255,-0.000878313,-0.00373294,-0.00447824,-0.00576908,0.71613,0.860126,1.10774,-0.0493519,-0.05911,-0.0761908,0.0822787,0.0980798,0.126903,0.0124742,0.0150716,0.0181685,0.00228746,0.00277301,0.00346974,0.028027,0.0335603,0.0432995,-0.0152714,-0.0181393,-0.0238361,-0.00397297,-0.00491752,-0.00593188,-0.00287236,-0.00332002,-0.00398913,0.777929,0.934132,1.20226,-0.0153399,-0.0182305,-0.0237071,0.0280004,0.0330698,0.0432734,0.0298748,0.0354268,0.0461702,0.00781883,0.00929985,0.0120836,0.007765,0.00920409,0.0120005,-0.00201665,-0.00230225,-0.00311664,-0.0125649,-0.014815,-0.0194185,-0.00632249,-0.00750003,-0.00977111,0.815255,0.976191,1.25044,-0.000442714,-0.000131311,0.00313842,0.00785934,0.0107109,0.0161121,0.00202205,0.000434705,-0.00678257,-0.000725944,-0.000568192,0.00160009,-0.000672164,-0.00092169,-0.00228338,-0.00493007,-0.00581628,-0.00567262,0.00105584,0.00216618,0.00507605,0.00139496,0.00109839,-0.000706789,0.843911,1.00439,1.24965,-0.0183687,-0.0183515,0.00558878,-0.0152403,-0.0118985,0.0142102,0.0130239,0.0139848,0.00408916,-0.0034798,-0.003684,-0.000315891,0.00785565,0.00774166,-0.00379478,-0.000352473,-0.00141873,-0.00283869,-0.00677915,-0.00748528,-0.00329615,-0.00480062,-0.00537276,-0.00339563,0.852841,1.01233,1.24641,-0.0264056,-0.0263544,0.00387284,-0.0197419,-0.0156979,0.0194964,0.0114507,0.010327,0.00178917,-0.00143251,-0.00112429,0.000778913,0.0124405,0.0122783,-0.00281562,-0.00197066,-0.00309463,-0.00651318,-0.00572927,-0.00506873,-0.000807209,-0.00269449,-0.00375147,-0.0017072,0.874577,1.03941,1.26327,-0.0325084,-0.0333818,0.00064094,-0.0398334,-0.0405511,0.00217184,0.00274608,0.00327342,0.00105107,0.000406786,0.000480608,0.000648513,0.0164093,0.0168524,-0.000306747,0.00445917,0.00460486,0.0000413202,-0.0020067,-0.00228327,-0.000563725,-0.000667477,-0.000846152,-0.000391871,0.869768,1.03177,1.26212,-0.0313999,-0.0315437,0.000892968,-0.0379374,-0.0357326,0.00316304,-0.00216279,-0.00245905,0.00154517,0.0013098,0.00154246,0.00057937,0.0161707,0.0160648,-0.000475241,0.00559957,0.00459021,-0.000243869,-0.000147916,0.000211862,-0.000649378,-0.00267856,-0.00296836,-0.000571903,0.853795,1.01508,1.25014,-0.0261434,-0.0259843,0.00364318,-0.0240655,-0.0214373,0.0143257,-0.00243453,-0.000620762,0.00961967,0.00227813,0.0021308,-0.000739363,0.013027,0.012749,-0.00239403,0.00222124,0.00131327,-0.00345444,-0.000598897,-0.00180147,-0.00603848,-0.00443581,-0.00491752,-0.00212404,0.838033,0.999997,1.26024,-0.0101768,-0.0100567,0.000936371,-0.0129772,-0.0113075,0.00479285,-0.012537,-0.0111184,0.00413118,0.00519865,0.00520458,0.000132104,0.00496179,0.00484423,-0.000540306,0.00124197,0.000887458,-0.000584475,0.00568812,0.0047965,-0.00231197,0.00116137,0.00072168,-0.00116317,0.820469,0.978945,1.24432,-0.0016855,0.00066462,0.0111177,0.00619637,0.00980119,0.0188103,0.00606272,0.0021273,-0.0111612,-0.00223358,-0.00103753,0.00459664,-0.00211631,-0.00335605,-0.00694526,-0.0051947,-0.00532686,-0.00389688,0.000613983,0.00229206,0.00680323,0.00208786,0.00130318,-0.000098963,0.83757,1.00024,1.25477,-0.0177246,-0.0173569,0.00463927,-0.00395606,-0.00269984,0.00982579,0.0081924,0.00806226,-0.0058976,-0.00377324,-0.00380644,0.00220778,0.00401236,0.0036467,-0.00283273,-0.00550532,-0.00585873,-0.00190116,-0.00132715,-0.00107073,0.00378845,-0.00318142,-0.00330779,-0.000846823,0.839561,1.00076,1.24302,-0.0236914,-0.0228606,0.0104212,-0.00295522,-0.00029805,0.0211843,0.00442387,0.00461433,-0.00471544,-0.00216637,-0.00225843,0.0018644,0.00558478,0.00483929,-0.00686066,-0.00760687,-0.00842428,-0.00576592,-0.000935011,-0.000820289,0.00348115,-0.00645198,-0.0067804,-0.000339207,0.861709,1.02405,1.25505,-0.035159,-0.0351073,0.00597083,-0.0205295,-0.0188644,0.0102107,0.00332966,0.00464806,-0.000127532,-0.000928812,-0.0011581,0.000504224,0.0117868,0.0114727,-0.00397977,-0.00467175,-0.00527835,-0.00294366,-0.00127745,-0.00186381,0.000745779,-0.00597333,-0.00639188,0.000702291,0.852572,1.01568,1.25367,-0.0290686,-0.0289274,0.00813355,-0.0145372,-0.0137047,0.0101402,-0.00339669,-0.00280285,0.00292402,0.00223345,0.00217236,-0.000460369,0.00892498,0.00861999,-0.00488301,-0.00412785,-0.0043686,-0.00165847,-0.000739074,-0.00101328,-0.00133629,-0.00575255,-0.00589985,0.00141387,0.855966,1.02022,1.26351,-0.0307185,-0.0314151,0.000743589,-0.0203397,-0.0206418,0.00119803,-0.0108887,-0.010574,0.00215213,0.00642433,0.00653688,0.0000938885,0.0117135,0.0120067,-0.0000929077,-0.00115087,-0.00105104,0.000622448,0.00304225,0.00294917,-0.000609442,-0.00670686,-0.00711566,-0.000703166,0.847208,1.01177,1.26515,-0.0211259,-0.02171,0.000315514,-0.0144676,-0.0148026,0.000761611,-0.0160918,-0.0165403,0.000206725,0.00846546,0.00876853,0.000495732,0.00773951,0.00795638,-0.0000744562,-0.00175135,-0.00178838,0.000152853,0.00533853,0.00548701,-0.0000580548,-0.0020546,-0.00211383,0.0000091859]+ "irradiance": [0.787525,0.947183,1.21709,-0.0128871,-0.0145809,-0.0199165,-0.0216912,-0.024515,-0.0335227,-0.0226589,-0.0256378,-0.0350183,-0.00620364,-0.00699162,-0.00958744,-0.00623858,-0.00705768,-0.00964144,-0.00212922,-0.00240502,-0.00329061,-0.0105509,-0.0119378,-0.0163059,-0.00414027,-0.00468563,-0.00639859,0.738265,0.891448,1.14096,-0.0415297,-0.0469878,-0.0641822,-0.0613031,-0.0693331,-0.0947412,-0.00666444,-0.00754116,-0.0102996,-0.000164008,-0.000158209,-0.000253468,-0.0219174,-0.0247971,-0.0338723,-0.00980345,-0.0110879,-0.0151508,-0.00276039,-0.00312344,-0.00426606,-0.00145615,-0.00164875,-0.0022504,0.729309,0.881314,1.12712,-0.0423377,-0.047902,-0.0654308,-0.0694891,-0.0785949,-0.107392,-0.00111113,-0.00125799,-0.00171721,0.000277233,0.000341024,0.000428451,-0.0223998,-0.0253429,-0.0346179,-0.012195,-0.0137937,-0.0188468,0.000610242,0.000690194,0.0009431,-0.00289992,-0.00328227,-0.00448168,0.731043,0.883274,1.13051,-0.0421495,-0.0476845,-0.0650656,-0.0678313,-0.0767173,-0.104146,-0.000037873,-0.0000632033,0.000398869,0.000358063,0.000432136,0.000587018,-0.0222684,-0.0251906,-0.0343633,-0.0116801,-0.0132057,-0.0178422,0.00134595,0.00150831,0.00239428,-0.0026537,-0.00300886,-0.00399573,0.731978,0.884598,1.13217,-0.0418015,-0.047236,-0.0644199,-0.0665157,-0.0749497,-0.10175,-0.00117883,-0.00137815,-0.00181829,0.000261,0.000314551,0.00040249,-0.0219684,-0.0248094,-0.0338028,-0.0108497,-0.0121557,-0.0162857,0.000581042,0.000629326,0.000906169,-0.00289602,-0.00326983,-0.00447994,0.736184,0.889279,1.13862,-0.041569,-0.0470071,-0.0641233,-0.0634951,-0.0716774,-0.0974837,-0.00030825,-0.000513793,-0.0012571,0.000279567,0.000327529,0.000355341,-0.021922,-0.024789,-0.0338161,-0.0107839,-0.0121867,-0.0166165,0.00149675,0.00160611,0.00189905,-0.00155961,-0.00171433,-0.00216558,0.791721,0.951528,1.22328,-0.00943621,-0.010767,-0.014649,-0.0200434,-0.0227069,-0.0310171,0.0191291,0.0220943,0.0298918,0.00550889,0.00633427,0.00856755,-0.00444804,-0.00504103,-0.00688096,-0.00291591,-0.00318767,-0.00442828,0.00967131,0.0109881,0.01498,-0.00360476,-0.00425668,-0.00569966,0.805807,0.966361,1.22843,0.00464538,0.00582736,0.0161077,-0.0188377,-0.0220935,-0.0342125,0.00264398,0.00172734,-0.012994,-0.000784729,-0.000491828,0.00455903,0.00462316,0.00541285,0.00976024,-0.00966853,-0.0108696,-0.0106368,-0.00293227,-0.0037414,-0.00881827,0.00414738,0.00439394,0.00214696,0.869888,1.0315,1.25701,-0.0305729,-0.0313451,0.00211485,0.0381659,0.0364469,-0.00353697,0.0239083,0.0237532,0.00970087,-0.00560764,-0.00568146,-0.00223039,-0.0157061,-0.0161844,-0.0000619816,0.00543374,0.0051322,0.00116653,0.00998603,0.00979286,0.00420788,-0.00251078,-0.0035206,-0.00250838,0.872733,1.03502,1.25228,-0.0351628,-0.035911,0.00103145,0.0357071,0.034391,-0.0103444,-0.00652487,-0.00789001,-0.0118599,0.00171033,0.00209872,0.00210022,-0.0166023,-0.0169444,0.000485054,0.00240323,0.00212345,-0.00193543,-0.00473845,-0.00563425,-0.00717295,-0.00156314,-0.00230681,-0.00268725,0.897617,1.05928,1.27262,-0.0370033,-0.0376476,-0.000132564,0.0560212,0.0537766,0.00641127,-0.0273604,-0.0281214,-0.02588,0.00426662,0.00466886,0.00386517,-0.0175749,-0.0177926,-0.000181603,0.00581614,0.00492077,0.000763441,-0.0176386,-0.0181468,-0.0162054,0.00447083,0.00384407,0.00228687,0.866293,1.0267,1.25025,-0.0310323,-0.0309063,0.00488946,0.0321365,0.0285553,-0.012034,0.000153169,0.000932548,0.00261277,0.000405198,0.000445405,0.000222114,-0.0141244,-0.013802,0.00299221,0.00230417,0.00074042,-0.00265819,-7.02572e-7,0.000244883,0.000328009,-0.00248772,-0.00294748,-0.00197665,0.855967,1.01805,1.24643,-0.0293846,-0.0296481,0.00391648,0.0240282,0.0223671,-0.015281,-0.0032697,-0.00200703,0.0102181,0.00281246,0.00282291,-0.000283716,-0.0136189,-0.0135904,0.00275364,-0.000225988,-0.000950998,-0.00413679,-0.000110699,0.000535106,0.00452598,-0.00399642,-0.00444067,-0.00270466,0.840671,1.00377,1.25854,-0.0115186,-0.0115086,0.00245417,0.013572,0.0129435,-0.00616575,-0.0146469,-0.0142388,0.00340126,0.00589474,0.0060113,-0.000261544,-0.00490293,-0.00480297,0.0017181,-0.0000427106,-0.000297347,-0.00215991,-0.00508664,-0.0048019,0.00234961,0.00186188,0.00173097,-0.000320383,0.826417,0.98928,1.24975,-0.00612702,-0.00549768,0.0102761,-0.00135098,-0.00233875,-0.0135446,0.00980332,0.00985948,-0.00361309,-0.00383154,-0.00373039,0.00260778,0.000759315,0.00127908,0.00628389,-0.00501576,-0.00540974,-0.0037325,0.00267684,0.00259234,-0.00227333,0.00114858,0.00140236,0.00237127,0.862585,1.02687,1.27087,-0.0377318,-0.0386758,-0.0060644,0.0251237,0.0253466,0.00575492,0.00321846,0.00317184,-0.00650626,-0.00151957,-0.00156311,0.00279701,-0.0140408,-0.0143136,-0.00350849,-0.00115587,-0.0012411,0.0015694,0.00121915,0.00128701,-0.00277366,-0.00979592,-0.0103796,-0.00314211,0.862545,1.02306,1.25512,-0.0347951,-0.0338137,0.00641723,0.0239451,0.0218577,-0.00679313,0.00165876,-0.000826716,-0.00684476,0.00103151,0.00191425,0.00374638,-0.0122623,-0.0117064,0.00325966,-0.00187362,-0.00183021,-0.000362496,-0.000324679,-0.00141252,-0.00359674,-0.00678598,-0.00781077,0.0000239954,0.858094,1.02041,1.25288,-0.0287019,-0.0280413,0.0115678,0.019374,0.018084,-0.0100034,-0.0118513,-0.0127804,-0.0114621,0.00440074,0.00493505,0.00411031,-0.0085937,-0.00804031,0.00639671,-0.00333697,-0.00360009,-0.00199261,-0.00612674,-0.00670958,-0.0059653,-0.00292072,-0.002996,0.0040968,0.864926,1.02552,1.2569,-0.0356743,-0.0342942,0.00632623,0.0262537,0.0236229,-0.00644036,-0.00376309,-0.00536745,-0.00244969,0.00195964,0.00277815,0.00161023,-0.0128334,-0.0118252,0.00361899,-0.00151978,-0.00204394,-0.0012325,-0.00107928,-0.00218649,-0.00152643,-0.00616606,-0.00652539,0.00145146,0.860929,1.01903,1.25201,-0.0322552,-0.0295456,0.00989486,0.0218793,0.0158155,-0.011349,-0.0138973,-0.014167,-0.0026053,0.00618757,0.00643585,0.00177552,-0.0103929,-0.00812108,0.00617798,-0.00245319,-0.0047924,-0.0027747,-0.0050379,-0.0051125,-0.00141201,-0.0052228,-0.00480317,0.00263684,0.838889,0.998068,1.25666,-0.0148748,-0.0126035,0.0059613,0.00758676,0.00382419,-0.00812381,-0.0137112,-0.011047,0.0020605,0.00660516,0.0057567,-0.000544218,-0.00362706,-0.00218636,0.00411739,-0.00371535,-0.00443384,-0.00247125,-0.00377721,-0.00227646,0.00199289,-0.000608533,-0.000878505,0.00154139,0.729588,0.881501,1.12855,-0.0466636,-0.0529255,-0.0711144,-0.0035479,-0.00401255,-0.00528572,-0.0665827,-0.0754039,-0.10236,-0.0236455,-0.0267763,-0.0361499,-0.000952354,-0.00109514,-0.00132827,0.00322211,0.00368243,0.00472437,-0.00185382,-0.00210767,-0.00278757,-0.00860913,-0.00970861,-0.0135633,0.563616,0.693843,0.871043,-0.163331,-0.184797,-0.252421,-0.00312799,-0.00351208,-0.00483417,-0.00570718,-0.00645809,-0.00882019,-0.000219454,-0.000220942,-0.000339157,-0.000316014,-0.000356715,-0.000488385,0.00451025,0.00510706,0.00697039,-0.00326112,-0.00368997,-0.00503991,0.00737592,0.0083441,0.0113992,0.559791,0.689715,0.86526,-0.163822,-0.185318,-0.253157,-0.00636668,-0.00716658,-0.00983305,-0.00100715,-0.000914538,-0.00141072,0.000263134,0.000353588,0.000425066,-0.000634016,-0.000715471,-0.00097917,0.00408042,0.00456623,0.00627092,-0.0011343,-0.00127543,-0.0017477,0.00643167,0.00736615,0.00999823,0.569748,0.702194,0.885753,-0.156877,-0.176305,-0.240223,-0.00843966,-0.00965894,-0.0142674,0.0155465,0.0182125,0.0286535,0.004299,0.00529927,0.0079383,-0.00149169,-0.00178058,-0.00262028,0.0034182,0.00372586,0.00459904,-0.00374044,-0.00424762,-0.00644613,0.00669835,0.00739305,0.0115581,0.636246,0.773788,1.01859,-0.107924,-0.123652,-0.142397,-0.00869356,-0.00970786,-0.0149336,-0.000933168,-0.000938427,-0.00326659,-0.000198472,-0.000178327,-0.000594699,-0.00119068,-0.00132769,-0.00211018,0.00197661,0.00233468,0.00160487,-0.0022397,-0.0025286,-0.00352145,-0.000293214,-0.000212417,-0.00235295,0.56593,0.696637,0.875453,-0.162866,-0.184221,-0.251611,-0.00108127,-0.00116384,-0.0018362,0.00872915,0.00968201,0.0125574,0.00100221,0.00112188,0.00147584,-0.000251082,-0.000280249,-0.000397081,0.00479365,0.00538177,0.0072077,0.000400115,0.000424809,0.000752245,0.00789138,0.00900044,0.0125706,0.753896,0.908838,1.15837,-0.0275162,-0.0314994,-0.0481693,0.00161042,0.0018592,0.00324746,0.0554498,0.0628559,0.0901125,0.0167322,0.0191303,0.0285652,0.00101285,0.00117995,0.00209378,0.00425896,0.00485464,0.00761576,-0.000718517,-0.000792406,-0.00129749,-0.0125877,-0.0141282,-0.0188155,0.685018,0.828983,1.08396,0.0423757,0.0477317,0.060648,-0.0203852,-0.0234445,-0.0273667,-0.10302,-0.118789,-0.137095,0.0176019,0.0199147,0.02465,0.00469827,0.00537247,0.00640097,0.00685094,0.00789284,0.00870523,-0.00565859,-0.00656193,-0.00724884,-0.0182433,-0.021471,-0.0225548,0.938896,1.1009,1.27957,-0.0961265,-0.101045,-0.0178795,0.0105938,0.0109791,0.00878313,0.0177749,0.0256887,0.000116323,-0.00668568,-0.00753643,0.00269797,-0.0025645,-0.00316848,-0.00312681,-0.00505685,-0.00455844,0.00157175,0.000412445,0.00109426,0.00102478,-0.0188829,-0.0226724,-0.00726122,0.934854,1.09739,1.24403,-0.0933402,-0.0963015,0.00519509,0.0234459,0.0248569,0.0133968,-0.0201241,-0.0232147,-0.0318658,0.00521837,0.00622973,0.00726747,-0.0070124,-0.00767046,-0.00420486,-0.00304511,-0.00207966,0.00624195,0.00604584,0.00715766,0.00280056,-0.0172009,-0.0200792,-0.00698338,0.924486,1.07479,1.21137,-0.084063,-0.0845348,0.013622,0.0227788,0.02253,0.00548403,0.0106218,0.0135276,0.0108675,0.000193241,0.00164716,0.00468894,-0.00636666,-0.00541623,0.00121509,-0.00483107,-0.00469424,0.00374077,-0.00752377,-0.0131378,-0.0142631,-0.0127951,-0.0160002,-0.00690529,0.96696,1.11744,1.26742,-0.115368,-0.109733,-0.018081,0.0016826,-0.0114595,-0.0264462,-0.0306007,-0.0355156,-0.0328444,0.0143157,0.0155132,0.016764,0.00264003,0.00703448,0.0111069,-0.0149724,-0.0182801,-0.0122513,-0.00467882,-0.0078019,-0.00876577,-0.0169703,-0.0172087,-0.0114518,0.922332,1.06993,1.2196,-0.0724209,-0.0660546,0.0309251,-0.00868967,-0.0264209,-0.0382232,-0.0263078,-0.0250599,-0.00319391,0.00877531,0.00840524,0.00285222,0.0114938,0.0171521,0.018299,-0.00848421,-0.0140237,-0.00712752,-0.000639067,0.000194767,0.000417869,-0.00565968,-0.00571208,0.0064476,0.857415,1.01804,1.24283,-0.0269546,-0.0262599,0.00953764,-0.00741797,-0.0107022,-0.01362,-0.0260029,-0.0236101,0.0182372,0.0122953,0.0119556,-0.00502979,0.00244067,0.00329418,0.00395612,-0.0047584,-0.00531071,-0.000193941,0.00593884,0.00766083,0.00791532,-0.000229751,-0.000933891,-0.00391787,0.838852,0.995021,1.25119,-0.0000979706,0.00512304,0.0220052,0.010264,0.00861505,0.00387388,0.0334534,0.0283135,0.0076183,-0.0098932,-0.00784758,0.000497325,-0.00353115,-0.00281101,-0.00141305,-0.00536825,-0.00403979,0.000539755,0.00798785,0.00713675,0.004363,0.0169098,0.0169392,0.0149035,0.909469,1.07383,1.29155,-0.07795,-0.0787654,-0.0229229,0.0186709,0.0192514,0.00528001,0.0154103,0.0180308,-0.00950227,-0.00596179,-0.00740973,0.0063787,-0.00925127,-0.00964795,-0.00271448,-0.0113739,-0.0116289,-0.00273251,0.00376406,0.00405583,-0.000501207,-0.0156463,-0.0160855,-0.0049706,0.905899,1.06523,1.26451,-0.0723155,-0.0710215,0.000781854,0.0274659,0.026631,0.00488492,0.01491,0.00999729,-0.00397611,-0.00427506,-0.00218684,0.00323776,-0.0138989,-0.013974,-0.00322909,-0.010751,-0.00986196,0.0000464048,0.00377437,0.00265723,-0.000633019,-0.0125366,-0.0146785,0.000280412,0.910981,1.06943,1.2695,-0.0737794,-0.0703247,0.000466845,0.0297383,0.0288475,0.00513705,-0.00193577,-0.00419329,-0.00818939,-0.0000563344,0.00112331,0.00322709,-0.0137877,-0.0134983,-0.00151135,-0.0097459,-0.00854411,0.000311862,-0.00239997,-0.00377228,-0.00300541,-0.0110004,-0.0116548,0.00258876,0.901722,1.05422,1.2569,-0.0727203,-0.0643239,0.00501437,0.0223024,0.0152224,-0.00615814,-0.00929117,-0.0124761,-0.0065275,0.00635284,0.00834864,0.0056796,-0.00979636,-0.00582084,0.00447557,-0.00867604,-0.00851735,-0.000116535,-0.00193536,-0.0039384,-0.00275506,-0.0173655,-0.016196,-0.00126439,0.901571,1.04936,1.25496,-0.0692233,-0.0555261,0.0110364,0.0260029,0.0145526,-0.00438479,-0.0199025,-0.019158,0.000677323,0.00888239,0.00833499,-0.000468412,-0.0130033,-0.00602406,0.00339136,-0.00761941,-0.00811607,0.00114792,-0.003051,-0.00266819,0.000297521,-0.0135909,-0.00983221,0.00420063,0.868044,1.0248,1.25921,-0.0374881,-0.0325188,0.00613061,0.0151155,0.0114554,0.0000737484,-0.0300245,-0.0252113,0.00224642,0.0157921,0.01353,-0.000555196,-0.00703048,-0.00502155,0.000223395,-0.0054659,-0.00480153,0.00156354,-0.00585619,-0.00411841,0.000363892,-0.00317079,-0.00312075,0.0017963,0.720651,0.871395,1.11474,-0.0474703,-0.0538377,-0.0723607,0.00408131,0.00461605,0.00650277,-0.0717666,-0.0812632,-0.110368,-0.0239111,-0.0270766,-0.0365602,-0.000402228,-0.000472856,-0.000478158,0.00116887,0.00135889,0.00155087,0.00057963,0.000643189,0.000971666,-0.0102506,-0.0115637,-0.0160988,0.557027,0.686567,0.861739,-0.163989,-0.185531,-0.253383,0.00316621,0.00350822,0.00439399,-0.00853481,-0.00947881,-0.012309,-0.00037706,-0.000391074,-0.000542321,0.000172878,0.000191794,0.000244281,0.00227767,0.00256748,0.00345296,-0.00180018,-0.00211072,-0.00314579,0.00658935,0.00751893,0.0105032,0.552511,0.681442,0.854732,-0.164598,-0.18622,-0.254325,-0.0000830489,-0.000159492,-0.000612268,-0.00461433,-0.00505825,-0.0062771,0.0000101954,0.0000463813,0.0000549238,-0.000147549,-0.000170352,-0.000250221,0.00202972,0.0022881,0.00307183,0.00031553,0.000289325,0.000135112,0.00533448,0.00609362,0.00855408,0.545859,0.6738,0.84363,-0.165083,-0.186772,-0.255124,0.00224206,0.00251603,0.00343437,-0.00185462,-0.00207765,-0.00285246,0.000209148,0.000266991,0.000325145,-0.0000363409,-0.0000457184,-0.0000596467,0.0033277,0.00378632,0.00515389,0.000290867,0.000314571,0.000440389,0.00246301,0.00278996,0.00380932,0.552629,0.681612,0.854935,-0.16452,-0.186114,-0.254153,-0.00290311,-0.00347658,-0.00547391,0.00284302,0.00321293,0.00451005,0.000423983,0.000505319,0.000664192,-0.000383779,-0.000456257,-0.000679898,0.00420161,0.00485381,0.00695282,-0.0017596,-0.00199338,-0.00281845,0.00410455,0.00464854,0.00635018,0.559176,0.688832,0.864189,-0.163688,-0.185199,-0.252971,0.00432614,0.00491214,0.00667967,0.010577,0.0119568,0.0163401,0.00118212,0.00136366,0.00182615,0.000195662,0.000221015,0.000301617,0.00296953,0.00336546,0.00459031,0.000729087,0.000830246,0.00113037,0.00684896,0.00775051,0.0105865,0.751548,0.905906,1.15293,-0.0280363,-0.0321309,-0.0494292,0.00375288,0.00445115,0.00846776,0.0564674,0.0642137,0.0922049,0.0168487,0.0192778,0.0288288,0.00140219,0.00164695,0.00305471,0.00350511,0.00398424,0.00565179,-0.00117276,-0.00136168,-0.00234398,-0.0128171,-0.0144599,-0.019209,0.67286,0.814996,1.06843,0.0439798,0.0495161,0.0625454,0.0000247323,0.00015745,-0.000974541,-0.110925,-0.127917,-0.147279,0.0180885,0.0204556,0.0252232,0.00321242,0.0036879,0.00456159,0.00391469,0.0045115,0.00494484,0.00150869,0.00173353,0.00203731,-0.0197516,-0.0232329,-0.0245471,0.965099,1.12548,1.29885,-0.101666,-0.10652,-0.0211275,-0.0251872,-0.0251945,-0.0319519,0.0503741,0.0575017,0.0250748,-0.0141441,-0.0150773,-0.0026011,0.00157495,0.00140065,0.00382803,-0.00505758,-0.00522826,0.00161861,-0.0117523,-0.0116769,-0.0115529,-0.0105166,-0.0145092,-0.000179619,1.02392,1.18657,1.31554,-0.128526,-0.133296,-0.0238415,-0.0403386,-0.0401976,-0.0413185,-0.0123569,-0.016477,-0.0322538,0.0052482,0.00639287,0.00990086,0.00854633,0.00909299,0.0103189,-0.000596974,0.000242696,0.00819938,0.0193028,0.0197543,0.0219103,-0.00512088,-0.00921479,0.00148778,0.969893,1.1265,1.25781,-0.105129,-0.104379,0.00499944,-0.00249902,0.000946689,-0.00595163,-0.0206252,-0.0305342,-0.0267657,0.00771665,0.0113499,0.00977702,0.000541084,0.0000825694,0.00239476,-0.00575469,-0.0047204,0.00389916,-0.00284194,-0.00207311,-0.00145131,-0.00926683,-0.0125414,-0.00135991,0.992124,1.09302,1.21962,-0.13558,-0.0831041,0.0279361,0.00561967,0.00504766,0.00128706,-0.0177936,-0.0366638,-0.0306492,0.00713605,0.0156537,0.0137036,-0.00169813,-0.000904481,0.000394216,-0.00977212,-0.0016708,0.00721711,-0.00133177,-0.00229811,-0.00114058,-0.0240298,-0.0135962,-0.00357099,1.05474,1.10617,1.22863,-0.171004,-0.0876283,0.0264338,-0.0013872,-0.00185663,-0.00308571,-0.0111763,-0.0104969,0.000835384,0.00234834,0.0022525,0.000335047,0.000456121,0.000593033,0.000885879,-0.0135248,-0.00833999,0.000247345,0.00116133,0.00109285,0.00126336,-0.0170869,-0.00672794,0.00338869,0.870671,1.01893,1.24005,-0.0301916,-0.0232616,0.0134493,0.00397019,0.00317622,0.000900391,-0.0347585,-0.019871,0.0229836,0.0132139,0.00846575,-0.00845755,-0.000850258,-0.000696163,-0.00011492,-0.00235701,0.0000509863,0.0033217,-0.00189199,-0.0013238,-0.000258312,0.00195113,-0.00199173,-0.0049373,0.808792,0.96682,1.22242,0.0159524,0.0211124,0.0396861,-0.00159041,-0.0015471,0.00255754,0.00940175,0.00734804,-0.0127852,-0.00133344,0.000121403,0.00897761,-0.0000952241,-0.000147999,-0.00188593,-0.00215409,-0.00190954,0.00289122,-0.00213737,-0.00225693,-0.000298984,0.012236,0.0137175,0.0125216,0.92148,1.08333,1.29007,-0.085077,-0.0848618,-0.0213533,-0.00259171,-0.00217223,0.00000728995,0.0155319,0.0153129,-0.0166089,-0.00570755,-0.00617785,0.0095052,-0.000574847,-0.000839687,-0.00110883,-0.00981574,-0.00931148,-0.00109628,-0.00119278,-0.00133995,0.000239118,-0.0151849,-0.0165713,-0.00459275,0.901919,1.06464,1.25369,-0.0758143,-0.0765163,0.00569983,-0.00299643,-0.00304926,-0.00171185,0.00724569,0.00671011,-0.00852632,-0.00344333,-0.00314175,0.00394991,0.00213722,0.00229959,0.00181491,-0.00782614,-0.00732666,0.00274671,0.00131485,0.00159979,0.00237349,-0.0203565,-0.0221695,-0.00381807,0.925422,1.07543,1.25732,-0.0894197,-0.0800508,0.00732557,-0.00708604,-0.00814333,-0.00703393,0.0102867,0.00154257,-0.00974024,-0.00496916,0.000117048,0.00478523,0.00460644,0.00513153,0.00486308,-0.0125608,-0.00901031,0.00284252,0.00437582,0.00438815,0.00535091,-0.0162296,-0.0176502,0.0000648662,0.928181,1.07441,1.25577,-0.0961696,-0.0793091,0.00893063,-0.0027023,-0.00074091,0.000520299,-0.00395614,-0.0107644,-0.00464426,0.00178158,0.00653762,0.0040184,0.00197284,0.000991793,0.000564862,-0.0142001,-0.00961503,0.00211817,-0.00124058,-0.00121077,-0.000984548,-0.0204128,-0.0163548,0.00191706,0.913633,1.05386,1.25273,-0.0899268,-0.0649219,0.00955151,0.00344667,0.00400034,-0.000623614,-0.0155553,-0.0130259,0.00694404,0.00984336,0.00827382,-0.00157201,-0.00188872,-0.00222058,0.000277041,-0.0128433,-0.00720685,0.00309424,0.00181075,0.00191497,0.00115866,-0.0251048,-0.0165522,0.000380458,0.868599,1.02038,1.25141,-0.0396535,-0.0293288,0.0126609,0.00224346,0.00185715,0.00267647,-0.030807,-0.0227408,0.00706335,0.017188,0.0125705,-0.0029643,-0.00109957,-0.000719412,-0.00104178,-0.00708191,-0.00413841,0.00345981,-0.00156452,-0.00141442,-0.000975966,-0.00376937,-0.00247228,0.00274978,0.72515,0.87648,1.12167,-0.0469873,-0.053291,-0.0716306,0.00834334,0.00944166,0.0130885,-0.0688426,-0.0779605,-0.105861,-0.0236858,-0.0268217,-0.0362185,-0.0000902473,-0.00011964,0.00000177777,0.00243704,0.00279403,0.00351516,0.00260105,0.00293275,0.004096,-0.00959171,-0.0108205,-0.0150778,0.563616,0.693843,0.871043,-0.162846,-0.184249,-0.251671,0.0138529,0.0157006,0.0214091,-0.00780275,-0.00882908,-0.0120588,-0.000249881,-0.000255367,-0.000386179,0.00124164,0.00140566,0.0019189,0.00613283,0.00694291,0.00947802,0.00134433,0.00152077,0.0020776,0.00634808,0.00718118,0.00981068,0.559137,0.688776,0.864122,-0.163452,-0.184934,-0.252608,0.0105819,0.0119997,0.0163539,-0.00384389,-0.00434991,-0.00594055,0.000139135,0.000184776,0.000215026,0.000920217,0.00104199,0.00142215,0.00588196,0.00665907,0.00909031,0.0034442,0.00389662,0.00532286,0.00510713,0.00577713,0.00789285,0.554659,0.68371,0.857201,-0.163816,-0.185346,-0.25317,0.0117386,0.0133084,0.0181414,0.00118296,0.00133761,0.00182821,0.000435512,0.000520105,0.000673063,0.000988412,0.00111915,0.00152755,0.00694578,0.0078627,0.0107344,0.00250135,0.00282985,0.00386572,0.00306904,0.00347117,0.00474305,0.559137,0.688776,0.864122,-0.163533,-0.185026,-0.252733,0.0091934,0.0104287,0.014208,0.00567532,0.0064204,0.00877095,0.000641517,0.000753186,0.000991435,0.000871698,0.000987097,0.00134717,0.00660381,0.00747579,0.0102059,0.000647237,0.000732052,0.00100028,0.00469885,0.00531518,0.00726185,0.563616,0.693843,0.871043,-0.162846,-0.184249,-0.251671,0.00945511,0.0107248,0.0146124,0.0107938,0.0122116,0.0166814,0.00121155,0.00139813,0.00187239,0.000900844,0.00102007,0.00139221,0.00536173,0.00607046,0.00828631,0.000864462,0.000977826,0.00133599,0.00678481,0.00767531,0.0104856,0.751528,0.905878,1.15289,-0.0280379,-0.0321332,-0.049432,0.00375796,0.00445846,0.00847661,0.0564895,0.0642455,0.0922434,0.01685,0.0192797,0.0288311,0.00140249,0.00164738,0.00305523,0.00350978,0.00399097,0.00565992,-0.0011769,-0.00136764,-0.0023512,-0.0128261,-0.0144728,-0.0192246,0.706651,0.852494,1.10306,0.0240201,0.0275632,0.0433254,0.0314333,0.0352125,0.0328021,-0.0966638,-0.112063,-0.133479,0.0117573,0.0134678,0.0193296,-0.00695359,-0.00745163,-0.00516206,0.0111503,0.0126851,0.0137175,0.0117398,0.0131997,0.0126086,-0.021453,-0.0250155,-0.0259527,0.933894,1.09501,1.26748,-0.0853021,-0.0878881,-0.00407719,-0.00801393,-0.00852356,-0.00416994,0.0321723,0.0394032,0.00112057,-0.0120767,-0.013115,0.000614344,0.00086496,0.00112373,-0.000202723,-0.00482995,-0.00364683,0.0051333,-0.00282708,-0.00323916,-0.00250178,-0.0139559,-0.0175202,-0.00592695,0.938141,1.10005,1.23785,-0.0909345,-0.0925963,0.0118777,0.00194479,0.00413676,0.0146742,0.0182291,0.0180326,-0.000816134,-0.00389413,-0.00362834,0.000268687,-0.00199183,-0.00242187,-0.00496947,-0.0106262,-0.010326,0.000498151,0.000204285,0.000728844,0.0020632,-0.0125585,-0.0151211,-0.00494162,0.966527,1.12689,1.25541,-0.105191,-0.105797,0.00437464,-0.0123222,-0.00819489,0.0059847,-0.00324342,-0.00863848,-0.0118147,0.00131115,0.00303493,0.00358497,0.00301286,0.00204084,-0.00155156,-0.0103734,-0.0103495,0.000958402,0.00558231,0.00813584,0.00550424,-0.00859895,-0.0107944,-0.00200393,1.00013,1.15202,1.27762,-0.111154,-0.106909,0.00404279,-0.0386346,-0.0265561,-0.00632347,-0.0294715,-0.0354533,-0.0346571,0.00233172,0.00418796,0.00430449,0.00698349,0.00276641,-0.00186425,-0.0086327,-0.0109422,-0.0019013,0.0148009,0.0179208,0.0161684,-0.0013984,-0.0028105,0.00671903,0.958109,1.1097,1.25277,-0.102446,-0.0978496,0.00568152,-0.0164478,-0.00166234,0.0142512,-0.0229014,-0.0223646,-0.0018678,0.00662604,0.0063406,0.000834892,0.00405492,-0.000856779,-0.00473208,-0.00824168,-0.0130136,-0.00502161,0.00363385,0.00317136,0.000754159,-0.0128769,-0.0130857,0.000228784,0.870639,1.02669,1.25228,-0.0321849,-0.0298115,0.005186,-0.00375719,0.0035011,0.0113132,-0.0389663,-0.0338576,0.00823275,0.016572,0.0155614,-0.00159748,0.000685547,-0.00119294,-0.0031381,-0.0059711,-0.00746671,-0.00213956,0.00190338,-0.00131101,-0.00428816,0.00285858,0.00170487,-0.0014824,0.807127,0.964998,1.22404,0.00919574,0.0134869,0.0309469,0.0133549,0.0154844,0.0196184,-0.00313086,-0.00661309,-0.0228571,0.00150819,0.00321303,0.0107655,-0.00640232,-0.00729632,-0.00896806,-0.0000784045,0.000425359,0.00480995,0.00436709,0.00512227,0.00670657,0.00320177,0.00364664,0.00389912,0.92649,1.0871,1.3097,-0.0858392,-0.0845237,-0.0339251,-0.0473327,-0.045273,-0.0312822,0.00756472,0.00730783,-0.0181321,-0.00261921,-0.00301371,0.00956081,0.0229752,0.0223096,0.0158414,-0.000166938,-0.000221451,0.00780773,-0.000741016,-0.000134849,0.00305557,-0.017731,-0.0184015,-0.00891813,0.897639,1.05613,1.25207,-0.0612244,-0.0596955,0.0120327,-0.0228134,-0.0197891,0.00291322,0.0195289,0.0162319,-0.00108924,-0.00904386,-0.00821677,-0.00122056,0.00948967,0.00872563,-0.00179788,-0.00752514,-0.00702935,0.00256506,-0.00411746,-0.00264529,-0.000192704,-0.0083135,-0.0101913,0.00269446,0.907771,1.06759,1.26306,-0.0736205,-0.0716711,0.00382849,-0.0226755,-0.019969,0.00197534,0.00750052,0.00548297,0.000830746,-0.0044974,-0.0033213,-0.00117661,0.0114698,0.0102418,-0.000733113,-0.0097349,-0.00940024,0.00087467,-0.00271121,-0.00140815,-0.000594066,-0.0129042,-0.0137582,0.00180841,0.913791,1.06727,1.2647,-0.0814549,-0.0733716,0.00071644,-0.030298,-0.0217843,0.00182349,-0.00886589,-0.0122025,-0.0012828,0.00359929,0.0056706,0.00109406,0.0156761,0.0108487,-0.000660566,-0.00906412,-0.0100825,-0.000515189,0.00125472,0.00278213,0.000693243,-0.0176145,-0.0156187,0.000439297,0.906273,1.05978,1.27067,-0.0725652,-0.0637738,-0.00119324,-0.0270174,-0.0191019,-0.00482378,-0.0282053,-0.0270581,-0.00600855,0.0136483,0.013117,0.00330885,0.0133759,0.0085286,0.00157457,-0.00741335,-0.00786242,0.00197139,0.00669593,0.00592262,0.00328013,-0.0146028,-0.0121211,0.00119705,0.878767,1.03646,1.26987,-0.0408455,-0.0364507,0.00239457,-0.0188637,-0.0146076,-0.00243899,-0.0410435,-0.0375928,-0.00855202,0.0183833,0.0166254,0.00198221,0.00855368,0.0064041,0.000562013,-0.00707895,-0.0071747,-0.000559873,0.00822635,0.00653232,0.00244709,0.000484779,0.000910925,0.00521642,0.789868,0.949537,1.21631,-0.00911252,-0.0104758,-0.0165453,0.0241234,0.0274545,0.0392661,-0.0181919,-0.0208268,-0.0317287,-0.00366167,-0.00420053,-0.00692165,0.00528928,0.00604637,0.00908243,-0.00492692,-0.00552825,-0.00698758,0.0095642,0.0108941,0.0158683,-0.00355553,-0.00406198,-0.00605875,0.758728,0.913711,1.15937,-0.022514,-0.0260741,-0.0437304,0.0507225,0.0579777,0.0867384,-0.00370833,-0.00425517,-0.00660255,0.0000729396,0.000111922,0.000143064,0.013602,0.0156822,0.025356,-0.0112788,-0.0127476,-0.0172895,0.00181162,0.00204164,0.00268343,-0.00490572,-0.00552338,-0.00716079,0.758728,0.913711,1.15937,-0.022514,-0.0260741,-0.0437304,0.0507225,0.0579777,0.0867384,-0.00370833,-0.00425517,-0.00660255,0.0000729396,0.000111922,0.000143064,0.013602,0.0156822,0.025356,-0.0112788,-0.0127476,-0.0172895,0.00181162,0.00204164,0.00268343,-0.00490572,-0.00552338,-0.00716079,0.75425,0.908644,1.15245,-0.0228776,-0.0264855,-0.0442923,0.0518791,0.0592863,0.0885259,0.00131852,0.00143235,0.00116621,0.000369316,0.000447251,0.000601101,0.0136702,0.0157593,0.0254614,-0.010215,-0.011544,-0.0156455,0.000868765,0.000974867,0.0012263,-0.00694381,-0.00782933,-0.0103106,0.758728,0.913711,1.15937,-0.0225948,-0.0261656,-0.0438552,0.0493339,0.0564066,0.0845925,0.00581088,0.00651513,0.00810895,0.000575321,0.000680332,0.000919473,0.0135535,0.0156273,0.025281,-0.010557,-0.0119309,-0.016174,-0.000985346,-0.00112293,-0.00163915,-0.00531401,-0.00598533,-0.00779178,0.755849,0.91041,1.15562,-0.0226727,-0.0262549,-0.0439569,0.0523576,0.0598737,0.0885384,0.00719001,0.00809654,0.00990879,0.000602426,0.000711411,0.000954845,0.0136129,0.0156954,0.0253585,-0.0117495,-0.0132983,-0.0177302,-0.00203722,-0.00232907,-0.00301189,-0.00555313,-0.00625952,-0.00810385,0.796241,0.956665,1.22493,-0.0068611,-0.00796482,-0.0136065,0.0152788,0.0176076,0.027977,0.0179561,0.0205238,0.0308504,0.00392171,0.00455279,0.00737316,0.00355315,0.00412452,0.00703021,-0.000793995,-0.000942731,-0.00194683,-0.007531,-0.00862594,-0.0131979,-0.00471064,-0.00533534,-0.00734516,0.813333,0.974082,1.23553,0.0010903,0.00190592,0.0133372,0.00918369,0.011944,0.024331,0.00150872,-0.0000581462,-0.0160643,-0.000300306,0.000060746,0.00606525,-0.00140654,-0.00180289,-0.00606131,-0.00526695,-0.00602962,-0.00515423,0.00108035,0.00204046,0.00829121,0.00169881,0.00159703,-0.000313864,0.86097,1.02289,1.25414,-0.0231865,-0.0231957,0.0114541,-0.0325794,-0.0310983,0.00255305,0.00347437,0.0031823,-0.010479,-0.000366514,-0.000125263,0.00459895,0.0118317,0.0120532,-0.00302792,0.00565076,0.00539142,0.00416722,-0.0023176,-0.00243091,0.00355233,-0.00362858,-0.00397502,-0.0003442,0.87013,1.03137,1.25108,-0.0294231,-0.0292709,0.0105258,-0.0387672,-0.0370413,0.00651363,0.00650821,0.00463652,-0.00473744,0.000323448,0.000915457,0.00396084,0.015885,0.0160311,-0.0022626,0.00556688,0.00553427,0.00205382,-0.00398722,-0.00312931,0.000242407,-0.000974068,-0.00173746,0.00114782,0.875822,1.03784,1.25074,-0.0304942,-0.0303092,0.0112258,-0.0429413,-0.0416268,0.00669535,-0.0038216,-0.00560319,-0.00913562,0.00192781,0.00247405,0.00441313,0.0163904,0.0164936,-0.00259508,0.00631186,0.00613603,0.00206978,0.00119689,0.00200712,0.00281225,0.000480377,0.000133743,0.00153351,0.880493,1.04175,1.26127,-0.0305253,-0.029899,0.010089,-0.05122,-0.048703,-0.00448426,-0.00801109,-0.00913231,-0.0069401,0.00262404,0.00313145,0.00399678,0.0170528,0.0167777,-0.00169824,0.0118065,0.0108211,0.00672177,0.00275079,0.00338253,0.00189192,-0.00107536,-0.00108476,0.00217395,0.865618,1.02356,1.24738,-0.0258465,-0.0244833,0.0125106,-0.0372202,-0.0310934,0.0109689,-0.0130247,-0.0132352,-0.00584586,0.00437703,0.00471825,0.0038419,0.014132,0.013296,-0.00370075,0.00725904,0.00471211,-0.000226475,0.00546727,0.00535923,0.00111704,-0.00200336,-0.00202831,0.0019912,0.852523,1.01359,1.27331,-0.010778,-0.0100903,0.000842056,-0.0215362,-0.0185422,-0.00226226,-0.027358,-0.0262298,-0.0102384,0.00582452,0.00572716,0.000639022,0.00509579,0.00452508,-0.000792449,0.000213569,-0.000916468,-0.00221038,0.0123265,0.0113909,0.00397871,0.00647438,0.00634818,0.00416467,0.82427,0.983878,1.24638,0.000723301,0.00294988,0.016039,0.000666358,0.00304274,0.0136256,0.011476,0.00849308,-0.00556726,-0.00327714,-0.00233207,0.00371759,-0.00205932,-0.00305287,-0.00765029,-0.00245686,-0.00214606,-0.000463641,-0.00318081,-0.00214734,0.00268748,0.00530938,0.00486487,0.00427708,0.868999,1.03216,1.27086,-0.037953,-0.0383741,-0.00474732,-0.0310552,-0.0309172,-0.00505636,0.0110185,0.0101682,-0.00504804,-0.00432478,-0.00427943,0.00215797,0.01604,0.0162554,0.00300308,0.000560123,0.000873519,0.00201193,-0.00387673,-0.00379454,0.00214245,-0.00682469,-0.00773732,-0.00221503,0.876372,1.04114,1.27182,-0.0422892,-0.0434084,-0.00246175,-0.0353166,-0.0358002,-0.00476752,0.00255316,0.00338225,-0.00315661,-0.00102393,-0.00117751,0.00134538,0.0171182,0.0175835,0.00141665,0.000490966,0.000482834,0.00130326,-0.00039565,-0.000794896,0.00201539,-0.0068926,-0.00733014,0.000287504,0.885027,1.04454,1.26817,-0.0472312,-0.0456476,-0.0004554,-0.0392588,-0.035066,-0.00170556,-0.000410181,-0.00217431,-0.00265604,0.000455669,0.00131476,0.00122401,0.0188048,0.0174977,0.000284986,-0.000373124,-0.00151031,0.000624204,-0.00092854,0.000304291,0.00183224,-0.00556912,-0.00595542,0.000543631,0.868887,1.02777,1.25913,-0.0388289,-0.036203,0.00440423,-0.0279575,-0.0228292,0.00627145,-0.0104089,-0.0110189,-0.000990369,0.00484805,0.0052463,0.00101176,0.0148915,0.0128023,-0.00276595,-0.00149782,-0.0032549,-0.00133173,0.00299554,0.00340493,0.000635449,-0.00649926,-0.00606543,0.000980821,0.863098,1.02091,1.2616,-0.0336784,-0.0304636,0.00277755,-0.0253626,-0.0194091,0.00421883,-0.0158274,-0.0146206,0.000412442,0.00788026,0.00749296,0.000295793,0.0132413,0.0108451,-0.00176298,-0.000695822,-0.0025681,-0.000916487,0.00522995,0.00445702,-0.000316074,-0.00557365,-0.00518358,0.000708348,0.84953,1.01261,1.26322,-0.0215547,-0.0212029,0.00155819,-0.0146571,-0.0135717,0.00287823,-0.0191264,-0.0189868,0.000835499,0.00898013,0.00897883,0.0000825116,0.00758348,0.00717913,-0.000982311,-0.00275,-0.0031792,-0.000574117,0.00589154,0.00557327,-0.000765959,-0.000757666,-0.00066188,0.000316528]}diff --git a/examples/physics-3d/assets/scenes/main_reflections.esenv b/examples/physics-3d/assets/scenes/main_reflections.esenvnew file mode 100644index 000000000..71670aa7a--- /dev/null+++ b/examples/physics-3d/assets/scenes/main_reflections.esenv@@ -0,0 +1,37 @@+{+ "version": 1,+ "irradiance": [+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0+ ],+ "specular": "main_reflections.png",+ "faceSize": 32,+ "mipCount": 3,+ "maxRange": 8,+ "columns": 2+}diff --git a/examples/physics-3d/assets/scenes/main_reflections.esenv.meta b/examples/physics-3d/assets/scenes/main_reflections.esenv.metanew file mode 100644index 000000000..2e2e1da9f--- /dev/null+++ b/examples/physics-3d/assets/scenes/main_reflections.esenv.meta@@ -0,0 +1,6 @@+{+ "uuid": "5d7cf6c2-c34e-46f0-849b-3be348db3ff6",+ "version": "2.0",+ "type": "environment",+ "importer": {}+}diff --git a/examples/physics-3d/assets/scenes/main_reflections.png b/examples/physics-3d/assets/scenes/main_reflections.pngnew file mode 100644index 000000000..bd40267acBinary files /dev/null and b/examples/physics-3d/assets/scenes/main_reflections.png differdiff --git a/examples/physics-3d/assets/scenes/main_reflections.png.meta b/examples/physics-3d/assets/scenes/main_reflections.png.metanew file mode 100644index 000000000..a03c6b2a1--- /dev/null+++ b/examples/physics-3d/assets/scenes/main_reflections.png.meta@@ -0,0 +1,25 @@+{+ "uuid": "3e8a3c6d-2a06-417c-909a-da5bc1aa385c",+ "version": "2.0",+ "type": "texture",+ "importer": {+ "maxSize": 2048,+ "compress": false,+ "compressFormat": "uastc",+ "filterMode": "linear",+ "wrapMode": "clamp",+ "sRGB": false,+ "sliceBorder": {+ "left": 0,+ "right": 0,+ "top": 0,+ "bottom": 0+ },+ "sheet": {+ "cellWidth": 0,+ "cellHeight": 0,+ "margin": 0,+ "spacing": 0+ }+ }+}diff --git a/fixtures/scenes/mat-env/chrome.esmaterial b/fixtures/scenes/mat-env/chrome.esmaterialnew file mode 100644index 000000000..248182169--- /dev/null+++ b/fixtures/scenes/mat-env/chrome.esmaterial@@ -0,0 +1,12 @@+{+ "version": "1.0",+ "type": "material",+ "shader": "builtin:model",+ "blendMode": 0,+ "depthTest": true,+ "depthWrite": true,+ "properties": {+ "u_metallic": 1,+ "u_roughness": 0.08+ }+}diff --git a/fixtures/scenes/reflect-atlas.esenv b/fixtures/scenes/reflect-atlas.esenvnew file mode 100644index 000000000..94fda7c63--- /dev/null+++ b/fixtures/scenes/reflect-atlas.esenv@@ -0,0 +1,37 @@+{+ "version": 1,+ "irradiance": [+ 0.9894863963127136,+ 0.19133681058883667,+ 1.0027153491973877,+ -0.593439519405365,+ -0.009811840020120144,+ 0.5999656319618225,+ -0.07545698434114456,+ 0.20680324733257294,+ -0.06211205944418907,+ -0.003706963500007987,+ 0.010159586556255817,+ -0.003051366889849305,+ 0.0007192579214461148,+ -0.00035332870902493596,+ -0.0004842201014980674,+ 0.014640865847468376,+ -0.007192172110080719,+ -0.009856509044766426,+ -0.0315692164003849,+ 0.0873631089925766,+ -0.026784716174006462,+ -0.002706394996494055,+ 0.007461550645530224,+ -0.002257157349959016,+ 0.00027758494252339005,+ -0.00019974734459538013,+ -0.0005578305572271347+ ],+ "specular": "reflect-atlas.png",+ "faceSize": 32,+ "mipCount": 3,+ "maxRange": 8,+ "columns": 2+}diff --git a/fixtures/scenes/reflect-atlas.png b/fixtures/scenes/reflect-atlas.pngnew file mode 100644index 000000000..a7398fb3dBinary files /dev/null and b/fixtures/scenes/reflect-atlas.png differdiff --git a/fixtures/scenes/reflection-probe.esscene b/fixtures/scenes/reflection-probe.esscenenew file mode 100644index 000000000..e048b079d--- /dev/null+++ b/fixtures/scenes/reflection-probe.esscene@@ -0,0 +1,177 @@+{+ "version": 4,+ "name": "ReflectionProbe",+ "entities": [+ {+ "id": 0,+ "name": "Camera",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 10+ }+ }+ },+ {+ "type": "Camera",+ "data": {+ "projectionType": 1,+ "orthoSize": 300,+ "isActive": true,+ "priority": 0+ }+ }+ ]+ },+ {+ "id": 1,+ "name": "Sky",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 0+ }+ }+ },+ {+ "type": "Light",+ "data": {+ "type": 2,+ "color": {+ "r": 1,+ "g": 1,+ "b": 1,+ "a": 1+ },+ "intensity": 1,+ "environment": "/scenes/studio.esenv"+ }+ }+ ]+ },+ {+ "id": 2,+ "name": "Probe",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -150,+ "y": 0,+ "z": 0+ }+ }+ },+ {+ "type": "ReflectionProbe",+ "data": {+ "reflection": "/scenes/reflect-atlas.esenv",+ "halfExtents": {+ "x": 140,+ "y": 140,+ "z": 140+ },+ "slot": 1,+ "enabled": true+ }+ }+ ]+ },+ {+ "id": 3,+ "name": "Inside",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -150,+ "y": 0,+ "z": 0+ },+ "scale": {+ "x": 200,+ "y": 200,+ "z": 1+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "/scenes/shadow-quad.esmesh",+ "material": "/scenes/mat-env/mirror.esmaterial",+ "color": {+ "r": 1,+ "g": 1,+ "b": 1,+ "a": 1+ },+ "lit": true,+ "enabled": true+ }+ }+ ]+ },+ {+ "id": 4,+ "name": "Outside",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 150,+ "y": 0,+ "z": 0+ },+ "scale": {+ "x": 200,+ "y": 200,+ "z": 1+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "/scenes/shadow-quad.esmesh",+ "material": "/scenes/mat-env/mirror.esmaterial",+ "color": {+ "r": 1,+ "g": 1,+ "b": 1,+ "a": 1+ },+ "lit": true,+ "enabled": true+ }+ }+ ]+ }+ ]+}diff --git a/fixtures/scenes/reflection-room.esscene b/fixtures/scenes/reflection-room.esscenenew file mode 100644index 000000000..ff313f394--- /dev/null+++ b/fixtures/scenes/reflection-room.esscene@@ -0,0 +1,442 @@+{+ "version": 4,+ "name": "ReflectionRoom",+ "entities": [+ {+ "id": 0,+ "name": "Camera",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 560+ }+ }+ },+ {+ "type": "Camera",+ "data": {+ "projectionType": 0,+ "fov": 60,+ "nearPlane": 10,+ "farPlane": 9000,+ "isActive": true,+ "priority": 0+ }+ }+ ]+ },+ {+ "id": 1,+ "name": "Sky",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 0+ }+ }+ },+ {+ "type": "Light",+ "data": {+ "type": 2,+ "color": {+ "r": 0.85,+ "g": 0.85,+ "b": 0.9,+ "a": 1+ },+ "intensity": 0.18,+ "enabled": true+ }+ }+ ]+ },+ {+ "id": 2,+ "name": "Floor",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": -220,+ "z": 0+ },+ "scale": {+ "x": 7,+ "y": 0.2,+ "z": 7+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "builtin:cube",+ "lit": true,+ "opaque": true,+ "cullBackfaces": true,+ "color": {+ "r": 0.75,+ "g": 0.75,+ "b": 0.75,+ "a": 1+ }+ }+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "reflection-room_lightmap.png",+ "scaleOffset": {+ "x": 0.3515625,+ "y": 0.3515625,+ "z": 0,+ "w": 0+ }+ }+ }+ ]+ },+ {+ "id": 3,+ "name": "Ceiling",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 220,+ "z": 0+ },+ "scale": {+ "x": 7,+ "y": 0.2,+ "z": 7+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "builtin:cube",+ "lit": true,+ "opaque": true,+ "cullBackfaces": true,+ "color": {+ "r": 0.75,+ "g": 0.75,+ "b": 0.75,+ "a": 1+ }+ }+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "reflection-room_lightmap.png",+ "scaleOffset": {+ "x": 0.3515625,+ "y": 0.3515625,+ "z": 0.3515625,+ "w": 0+ }+ }+ }+ ]+ },+ {+ "id": 4,+ "name": "LeftWall",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -350,+ "y": 0,+ "z": 0+ },+ "scale": {+ "x": 0.2,+ "y": 4.4,+ "z": 7+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "builtin:cube",+ "lit": true,+ "opaque": true,+ "cullBackfaces": true,+ "color": {+ "r": 0.9,+ "g": 0.12,+ "b": 0.1,+ "a": 1+ }+ }+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "reflection-room_lightmap.png",+ "scaleOffset": {+ "x": 0.28125,+ "y": 0.28125,+ "z": 0.703125,+ "w": 0+ }+ }+ }+ ]+ },+ {+ "id": 5,+ "name": "RightWall",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 350,+ "y": 0,+ "z": 0+ },+ "scale": {+ "x": 0.2,+ "y": 4.4,+ "z": 7+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "builtin:cube",+ "lit": true,+ "opaque": true,+ "cullBackfaces": true,+ "color": {+ "r": 0.1,+ "g": 0.8,+ "b": 0.2,+ "a": 1+ }+ }+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "reflection-room_lightmap.png",+ "scaleOffset": {+ "x": 0.28125,+ "y": 0.28125,+ "z": 0.703125,+ "w": 0.28125+ }+ }+ }+ ]+ },+ {+ "id": 6,+ "name": "BackWall",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": -350+ },+ "scale": {+ "x": 7,+ "y": 4.4,+ "z": 0.2+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "builtin:cube",+ "lit": true,+ "opaque": true,+ "cullBackfaces": true,+ "color": {+ "r": 0.15,+ "g": 0.25,+ "b": 0.9,+ "a": 1+ }+ }+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "reflection-room_lightmap.png",+ "scaleOffset": {+ "x": 0.28125,+ "y": 0.28125,+ "z": 0,+ "w": 0.3515625+ }+ }+ }+ ]+ },+ {+ "id": 7,+ "name": "Chrome",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -120,+ "y": -80,+ "z": 150+ },+ "scale": {+ "x": 2.2,+ "y": 2.2,+ "z": 2.2+ }+ }+ },+ {+ "type": "MeshRenderer",+ "data": {+ "mesh": "builtin:sphere",+ "lit": true,+ "opaque": true,+ "cullBackfaces": true,+ "color": {+ "r": 1,+ "g": 1,+ "b": 1,+ "a": 1+ },+ "material": "/scenes/mat-env/chrome.esmaterial"+ }+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "reflection-room_lightmap.png",+ "scaleOffset": {+ "x": 0.1640625,+ "y": 0.1640625,+ "z": 0.28125,+ "w": 0.3515625+ }+ }+ }+ ]+ },+ {+ "id": 8,+ "name": "RoomProbe",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 0+ }+ }+ },+ {+ "type": "ReflectionProbe",+ "data": {+ "reflection": "/scenes/reflection-room_reflections.esenv",+ "halfExtents": {+ "x": 345,+ "y": 215,+ "z": 345+ },+ "slot": 1,+ "enabled": true+ }+ }+ ]+ },+ {+ "id": 9,+ "name": "Lamp",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 170,+ "z": -40+ }+ }+ },+ {+ "type": "Light",+ "data": {+ "type": 0,+ "color": {+ "r": 1,+ "g": 0.97,+ "b": 0.9,+ "a": 1+ },+ "intensity": 2.2,+ "radius": 1400,+ "enabled": true+ }+ }+ ]+ }+ ]+}diff --git a/fixtures/scenes/reflection-room_lightmap.png b/fixtures/scenes/reflection-room_lightmap.pngnew file mode 100644index 000000000..eaa81e0c9Binary files /dev/null and b/fixtures/scenes/reflection-room_lightmap.png differdiff --git a/fixtures/scenes/reflection-room_reflections.esenv b/fixtures/scenes/reflection-room_reflections.esenvnew file mode 100644index 000000000..4de82cf25--- /dev/null+++ b/fixtures/scenes/reflection-room_reflections.esenv@@ -0,0 +1,37 @@+{+ "version": 1,+ "irradiance": [+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0+ ],+ "specular": "reflection-room_reflections.png",+ "faceSize": 32,+ "mipCount": 3,+ "maxRange": 8,+ "columns": 2+}diff --git a/fixtures/scenes/reflection-room_reflections.esenv.meta b/fixtures/scenes/reflection-room_reflections.esenv.metanew file mode 100644index 000000000..bc4dd4a47--- /dev/null+++ b/fixtures/scenes/reflection-room_reflections.esenv.meta@@ -0,0 +1,6 @@+{+ "uuid": "21cf5198-2d32-474d-97f7-2ae1e9c81449",+ "version": "2.0",+ "type": "environment",+ "importer": {}+}diff --git a/fixtures/scenes/reflection-room_reflections.png b/fixtures/scenes/reflection-room_reflections.pngnew file mode 100644index 000000000..952833dbaBinary files /dev/null and b/fixtures/scenes/reflection-room_reflections.png differdiff --git a/fixtures/scenes/reflection-room_reflections.png.meta b/fixtures/scenes/reflection-room_reflections.png.metanew file mode 100644index 000000000..e3a2e998c--- /dev/null+++ b/fixtures/scenes/reflection-room_reflections.png.meta@@ -0,0 +1,25 @@+{+ "uuid": "31a4cfae-f71d-4a14-9ff1-a59698a3ac35",+ "version": "2.0",+ "type": "texture",+ "importer": {+ "maxSize": 2048,+ "compress": false,+ "compressFormat": "uastc",+ "filterMode": "linear",+ "wrapMode": "clamp",+ "sRGB": false,+ "sliceBorder": {+ "left": 0,+ "right": 0,+ "top": 0,+ "bottom": 0+ },+ "sheet": {+ "cellWidth": 0,+ "cellHeight": 0,+ "margin": 0,+ "spacing": 0+ }+ }+}diff --git a/pipeline/bin/estella.mjs b/pipeline/bin/estella.mjsindex 48df393b9..a46cadcec 100644--- a/pipeline/bin/estella.mjs+++ b/pipeline/bin/estella.mjs@@ -173,7 +173,7 @@ function bakeTransformOf(baker, entity) {* is refused: resolving one is the editor's job, and an atlas lit for a place* nothing is at looks like a bake that is wrong rather than one never run.*/-async function bakeScene(baker, sceneFile, check) {+async function bakeScene(baker, meta, sceneFile, check) {const sceneDir = path.dirname(sceneFile);const rel = path.relative(REPO, sceneFile);const scene = JSON.parse(readFileSync(sceneFile, 'utf8'));@@ -210,7 +210,25 @@ async function bakeScene(baker, sceneFile, check) {const surfaces = [];const lights = [];const volumes = [];+ const reflectionProbes = [];const ambient = [0, 0, 0];+ // The sky a capture sees and the format its atlas adopts. Read from the FIRST+ // ambient light naming one, which is the frame's environment too.+ let environment = null;+ const readEnvironment = (ref) => {+ const file = resolveRef(ref);+ if (!file || !existsSync(file)) return null;+ try {+ const document = JSON.parse(readFileSync(file, 'utf8'));+ // A sibling of the document, which is how an import names it — or a ref,+ // which is how one survives a package renaming files to their hash.+ const spec = typeof document.specular === 'string' ? document.specular : '';+ const atlas = spec.startsWith('@uuid:') ? resolveRef(spec)+ : path.resolve(path.dirname(file), spec);+ return { document, atlasPng: atlas && existsSync(atlas)+ ? new Uint8Array(readFileSync(atlas)) : new Uint8Array() };+ } catch { return null; }+ };// The REF as the document spells it, not the path it resolves to: the editor's// collector fingerprints the same string, and an absolute path would differ// between two checkouts of one project.@@ -256,7 +274,17 @@ async function bakeScene(baker, sceneFile, check) {fingerprintSurfaces.push({ mesh: ref, transform, albedo, texture: textureRef, holdsStill });}}+ const reflection = bakeComponent(entity, 'ReflectionProbe');+ if (reflection && reflection.data?.enabled !== false) {+ const p = bakeVec(tf.position, BAKE_ZERO);+ reflectionProbes.push({ entity: entity.id, label: entity.name ?? String(entity.id),+ center: [p.x, p.y, p.z] });+ }if (light) {+ if (!environment && typeof light.data?.environment === 'string'+ && light.data.environment !== '') {+ environment = readEnvironment(light.data.environment);+ }const p = bakeVec(tf.position, BAKE_ZERO);const made = baker.bakeLightOf(light.data, [p.x, p.y, p.z],bakeVec(tf.rotation, BAKE_IDENTITY_Q));@@ -273,10 +301,14 @@ async function bakeScene(baker, sceneFile, check) {surfaces: fingerprintSurfaces, lights,volumes: volumes.map((v) => ({ center: v.center, halfExtents: v.halfExtents,spacing: v.spacing })),+ // A reflection is captured from a POINT, so where it stands is the whole of+ // what it contributes — a moved probe is a stale bake.+ reflections: reflectionProbes.map((p) => p.center),ambient, options,});const result = baker.bakeSceneLightmap({- surfaces, lights, probeVolumes: volumes, options: { ...options, ambient },+ surfaces, lights, probeVolumes: volumes, reflectionProbes, environment,+ options: { ...options, ambient },});for (const w of result.warnings) console.warn(` ! ${w}`);@@ -306,6 +338,20 @@ async function bakeScene(baker, sceneFile, check) {});});+ // The scene's reflections: one atlas and one document beside the lightmap, and+ // a column number written onto each probe. Named for the scene rather than for+ // a probe — there is one of these however many probes stand in it.+ const reflectionName = `${stem}_reflections.png`;+ const reflectionDocName = `${stem}_reflections.esenv`;+ const reflectionFile = path.join(sceneDir, reflectionName);+ const reflectionDocFile = path.join(sceneDir, reflectionDocName);+ let reflectionText = null;+ if (result.reflection) {+ result.reflection.document.specular = reflectionName;+ reflectionText = `${JSON.stringify(result.reflection.document, null, 2)}\n`;+ }+ const reflectionRef = reflectionText ? (refTo(reflectionDocFile) || reflectionDocName) : '';+const placed = new Map();result.scaleOffset.forEach((rect, i) => { if (rect) placed.set(surfaces[i].entity, rect); });for (const entity of scene.entities ?? []) {@@ -328,6 +374,20 @@ async function bakeScene(baker, sceneFile, check) {data: { ...entity.components[at].data, bakedFrom: fingerprint },};}+ for (const entity of scene.entities ?? []) {+ const at = entity.components.findIndex((c) => c.type === 'ReflectionProbe');+ if (at < 0) continue;+ // Column 0 is the sky, so the first probe is column 1. A probe the bake did+ // not take keeps neither ref nor column: a stale one would reflect whatever+ // room happens to be baked at that number.+ const column = reflectionProbes.findIndex((p) => p.entity === entity.id);+ entity.components[at] = {+ type: 'ReflectionProbe',+ data: { ...entity.components[at].data,+ reflection: column >= 0 ? reflectionRef : '',+ slot: column >= 0 ? column + 1 : 0 },+ };+ }for (const entity of scene.entities ?? []) {const at = entity.components.findIndex((c) => c.type === 'LightProbeVolume');if (at < 0) continue;@@ -344,7 +404,8 @@ async function bakeScene(baker, sceneFile, check) {// A product with no `.meta` has no identity, so the cook carries neither it nor// the light in it. Checked here rather than written: a uuid is the stable name// refs resolve through, and minting one is the importer's to do.- const products = [atlasFile, ...[...grids.values()].map((g) => path.join(sceneDir, g.name))];+ const products = [atlasFile, ...[...grids.values()].map((g) => path.join(sceneDir, g.name)),+ ...(reflectionText ? [reflectionFile, reflectionDocFile] : [])];const unnamed = products.filter((f) => existsSync(f) && !existsSync(`${f}.meta`));if (check && unnamed.length > 0) {for (const f of unnamed) console.error(`bake-scene: ${path.relative(REPO, f)} has no .meta`);@@ -361,21 +422,38 @@ async function bakeScene(baker, sceneFile, check) {const file = path.join(sceneDir, g.name);return !existsSync(file) || readFileSync(file, 'utf8') !== g.text;});- if (staleAtlas || staleScene || staleGrids) {+ const staleReflections = reflectionText != null && (+ !existsSync(reflectionFile)+ || Buffer.compare(readFileSync(reflectionFile),+ Buffer.from(result.reflection.atlasBytes)) !== 0+ || !existsSync(reflectionDocFile)+ || readFileSync(reflectionDocFile, 'utf8') !== reflectionText);+ if (staleAtlas || staleScene || staleGrids || staleReflections) {const what = [staleAtlas && 'the atlas', staleScene && 'the scene',- staleGrids && 'a probe grid'].filter(Boolean).join(' and ');+ staleGrids && 'a probe grid',+ staleReflections && 'the reflections'].filter(Boolean).join(' and ');console.error(`bake-scene: ${rel} is not what a bake of it produces (${what} differ).`);console.error(`Rebake: node pipeline/bin/estella.mjs bake-scene ${rel}`);return 1;}console.log(`bake-scene: ${rel} matches a fresh bake`+ ` (${result.lumels} lumel(s) over ${placed.size} object(s)`- + `${grids.size ? `, ${grids.size} probe grid(s)` : ''}).`);+ + `${grids.size ? `, ${grids.size} probe grid(s)` : ''}`+ + `${result.reflection ? `, ${result.reflection.columns} reflection column(s)` : ''}).`);return 0;}writeFileSync(atlasFile, result.atlasBytes);for (const g of grids.values()) writeFileSync(path.join(sceneDir, g.name), g.text);+ if (reflectionText) {+ writeFileSync(reflectionFile, result.reflection.atlasBytes);+ writeFileSync(reflectionDocFile, reflectionText);+ // An RGBM encoding of radiance, the three settings an HDR import gives its own+ // atlas. Adopted here because this bake IS this file's importer, and a default+ // meta would linearize the multiplier and then compress it.+ await meta.adoptOrphan(reflectionFile, { sRGB: false, compress: false, wrapMode: 'clamp' });+ await meta.adoptOrphan(reflectionDocFile);+ }writeFileSync(sceneFile, document);// A product written for the first time has no `.meta` yet, so the scene had to@@ -581,10 +659,13 @@ if (opts.command === 'import-model' || opts.command === 'import-gltf') {if (opts.command === 'bake-scene') {const { mod: baker, cleanup } = await loadPipeline(path.join(PIPELINE, 'src', 'assets', 'lightmapBake.ts'), 'lightmapBake.mjs');+ const { mod: meta, cleanup: cleanupMeta } = await loadPipeline(+ path.join(PIPELINE, 'src', 'assets', 'assetMeta.ts'), 'assetMeta.mjs');try {- process.exit(await bakeScene(baker, opts.source, opts.check));+ process.exit(await bakeScene(baker, meta, opts.source, opts.check));} finally {cleanup();+ cleanupMeta();}}diff --git a/pipeline/src/assets/environmentImport.ts b/pipeline/src/assets/environmentImport.tsindex d78038a64..7fd4fc9d9 100644--- a/pipeline/src/assets/environmentImport.ts+++ b/pipeline/src/assets/environmentImport.ts@@ -37,6 +37,10 @@ export interface EnvironmentAssetData {mipCount: number;/** The RGBM decode range: `(rgb*a)^2 * maxRange` is the stored radiance. */maxRange: number;+ /** Octahedral pyramids standing side by side in that atlas. Absent is one —+ * a sky. A scene BAKE writes several, column 0 the sky and the rest a+ * reflection probe each. */+ columns?: number;}export const ENVIRONMENT_FORMAT_VERSION = 1;diff --git a/pipeline/src/assets/lightmapBake.ts b/pipeline/src/assets/lightmapBake.tsindex 63856c456..85e2f5ec5 100644--- a/pipeline/src/assets/lightmapBake.ts+++ b/pipeline/src/assets/lightmapBake.ts@@ -12,8 +12,10 @@ import { readFileSync } from 'node:fs';import { PNG } from 'pngjs';import { bakeLightmap, decodeMesh, unwrapLightmapUV, builtinMeshTemplate, MeshChannel,type MeshData, type BakeSurface, type BakeLight, type BakeOptions,- type ProbeGrid } from 'esengine';+ type CapturedPanorama, type ProbeGrid } from 'esengine';import { encodeRgbaPng } from './png';+import { bakeSceneReflections, bakeSky, type BakeEnvironment,+ type ReflectionBakeResult } from './reflectionBake';// What a collector needs to describe a surface, re-exported so the CLI reaches// them through the one module it loads. composeTRS especially: a second@@ -70,9 +72,22 @@ export interface SceneBakeInput {surfaces: SceneBakeSurface[];lights: BakeLight[];probeVolumes?: SceneProbeVolume[];+ /** Where reflections are captured from, in the order their atlas columns are+ * numbered — column 0 being the sky, a probe's is its index plus one. */+ reflectionProbes?: SceneReflectionProbe[];+ /** The environment the scene is lit by: what a captured ray that escapes+ * brings back, and the format the reflection atlas adopts. */+ environment?: BakeEnvironment | null;options?: BakeOptions;}+/** One reflection probe, as the editor's world describes it. */+export interface SceneReflectionProbe {+ entity: number;+ label: string;+ center: [number, number, number];+}+/*** Probes one volume may carry. A grid is written as text, and past this a volume* is megabytes of it. The answer is a coarser spacing or a smaller box, and only@@ -104,6 +119,8 @@ export interface SceneBakeResult {/** The `.esprobes` document per requested volume, in order — `null` for one* that was refused, so a caller can line results up with what it sent. */probes: Array<ProbeVolumeDocument | null>;+ /** The scene's reflections as one atlas, or null when it declared no probe. */+ reflection: ReflectionBakeResult | null;warnings: string[];}@@ -259,6 +276,20 @@ export function bakeSceneLightmap(input: SceneBakeInput): SceneBakeResult {+ ' only real-time light. Add a LightProbeVolume covering where they go.');}const probes: Array<ProbeVolumeDocument | null> = requested.map(() => null);+ // Captured in the light field the surfaces end up in, so a mirror and the+ // wall it mirrors agree; the sky is the environment's where there is one.+ const ambient = input.options?.ambient ?? [0, 0, 0];+ const reflectionProbes = input.reflectionProbes ?? [];+ const reflectionOptions = {+ reflectionProbes: reflectionProbes.map((p) => p.center),+ reflectionSky: bakeSky(input.environment, ambient),+ };+ const packReflections = (panoramas: CapturedPanorama[]): ReflectionBakeResult | null => {+ if (reflectionProbes.length === 0) return null;+ const packed = bakeSceneReflections({ panoramas, environment: input.environment, ambient });+ for (const w of packed.warnings) warnings.push(w);+ return packed;+ };const asDocument = (grid: ProbeGrid, sh: Float32Array): ProbeVolumeDocument => ({version: 1,resolution: [grid.resolution[0], grid.resolution[1], grid.resolution[2]],@@ -270,17 +301,19 @@ export function bakeSceneLightmap(input: SceneBakeInput): SceneBakeResult {// The volumes are still solved: a scene whose only light is ambient has// nothing to bake into an atlas and still has somewhere to stand.const empty = bakeLightmap([], input.lights,- { ...input.options, probeGrids: grids });+ { ...input.options, probeGrids: grids, ...reflectionOptions });gridSlot.forEach((at, k) => { probes[at] = asDocument(grids[k], empty.probes[k]); });return {atlasBytes: encodeRgbaPng(1, 1, new Uint8Array([0, 0, 0, 255])),scaleOffset: input.surfaces.map(() => null),- lumels: 0, size: 1, probes, warnings,+ lumels: 0, size: 1, probes,+ reflection: packReflections(empty.reflections),+ warnings,};}const result = bakeLightmap(surfaces, input.lights,- { ...input.options, probeGrids: grids });+ { ...input.options, probeGrids: grids, ...reflectionOptions });const scaleOffset: Array<[number, number, number, number] | null> =input.surfaces.map(() => null);slot.forEach((at, k) => { scaleOffset[at] = result.scaleOffset[k]; });@@ -292,6 +325,7 @@ export function bakeSceneLightmap(input: SceneBakeInput): SceneBakeResult {lumels: result.lumels,size: result.size,probes,+ reflection: packReflections(result.reflections),warnings,};}diff --git a/pipeline/src/assets/reflectionBake.ts b/pipeline/src/assets/reflectionBake.tsnew file mode 100644index 000000000..6234f1c8a--- /dev/null+++ b/pipeline/src/assets/reflectionBake.ts@@ -0,0 +1,167 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file reflectionBake.ts+ * @brief The scene's reflection probes as ONE atlas, column 0 the sky.+ *+ * @details A probe's pyramid is built by the environment importer's own+ * prefilter, from a panorama the bake captured instead of one a camera+ * photographed — so a baked room and an imported sky are the same+ * format, read by the same shader expression, at the same roughness.+ *+ * Columns and not textures, because a texture is a BIND: the renderer+ * carries which column an object reflects as a number per instance, and+ * a hundred shiny things in a room still merge into one draw.+ */+import { type CapturedPanorama, flatSky, type SkyRadiance } from 'esengine';+import { atlasLayout, decodeRgbm, mipCountFor, octEncode, prefilterOctahedral,+ type EnvironmentAssetData } from './environmentImport';+import { encodeRgbaPng } from './png';+import { decodeRgbaPng } from './tilesetExtrude';++/** The scene's sky, as the bake found it on disk. */+export interface BakeEnvironment {+ /** The `.esenv` document beside the atlas. */+ document: EnvironmentAssetData;+ /** The atlas PNG it names. */+ atlasPng: Uint8Array;+}++export interface ReflectionBakeInput {+ /** One captured sphere per probe, in the order their columns are numbered. */+ panoramas: readonly CapturedPanorama[];+ /** The environment the scene is lit by, whose FORMAT this bake adopts and+ * whose pyramid becomes column 0. Absent leaves column 0 the flat ambient. */+ environment?: BakeEnvironment | null;+ /** What column 0 holds without an environment: the scene's ambient term. */+ ambient?: readonly [number, number, number];+}++export interface ReflectionBakeResult {+ atlasBytes: Uint8Array;+ /** The `.esenv` document naming that atlas, less the `specular` ref, which+ * only the caller knows the name it will write the file under. */+ document: EnvironmentAssetData;+ /** Columns in the atlas, the sky's included. */+ columns: number;+ warnings: string[];+}++/** Face size a bake uses when no environment states one. Small: what it holds is+ * a room seen through a rough lobe, not a photograph. */+export const REFLECTION_FACE_SIZE = 32;+export const REFLECTION_MIP_COUNT = 3;+export const REFLECTION_MAX_RANGE = 8;++/** The nine coefficients a document must carry, when the sky did not supply them. */+const ZERO_SH = new Array<number>(27).fill(0);++/**+ * Reads the sky along a direction out of an imported environment's atlas.+ *+ * Mip 0 and nearest: a ray that escapes the scene is one texel of a panorama the+ * prefilter is about to blur anyway, and a bilinear tap here would cost every+ * ray for a difference no roughness shows.+ */+export function environmentSky(environment: BakeEnvironment): SkyRadiance | null {+ const face = environment.document.faceSize ?? 0;+ const maxRange = environment.document.maxRange ?? REFLECTION_MAX_RANGE;+ if (!(face > 0)) return null;+ let image;+ try {+ image = decodeRgbaPng(environment.atlasPng);+ } catch {+ return null;+ }+ if (image.width < face + 2) return null;+ return (dx, dy, dz, out, at) => {+ const [u, v] = octEncode(dx, dy, dz);+ const x = Math.min(face - 1, Math.max(0, Math.floor(u * face)));+ const y = Math.min(face - 1, Math.max(0, Math.floor(v * face)));+ const p = ((y + 1) * image.width + (x + 1)) * 4;+ const [r, g, b] = decodeRgbm(image.rgba[p]!, image.rgba[p + 1]!, image.rgba[p + 2]!,+ image.rgba[p + 3]!, maxRange);+ out[at] = r; out[at + 1] = g; out[at + 2] = b;+ };+}++/** The sky a capture should use: the environment's own where there is one. */+export function bakeSky(environment: BakeEnvironment | null | undefined,+ ambient: readonly [number, number, number]): SkyRadiance {+ return (environment && environmentSky(environment)) ?? flatSky(ambient);+}++/**+ * Packs the captured spheres into one atlas: column 0 the sky, then a probe each.+ *+ * The FORMAT is the environment's when the scene has one, so column 0 is that+ * atlas copied texel for texel rather than a resampling of it — what a surface+ * outside every probe reflects must not change because a bake ran.+ */+export function bakeSceneReflections(input: ReflectionBakeInput): ReflectionBakeResult {+ const warnings: string[] = [];+ const env = input.environment ?? null;+ const ambient = input.ambient ?? [0, 0, 0];++ const faceSize = env?.document.faceSize || REFLECTION_FACE_SIZE;+ const mipCount = mipCountFor(faceSize, env?.document.mipCount || REFLECTION_MIP_COUNT);+ const maxRange = env?.document.maxRange || REFLECTION_MAX_RANGE;++ const { width: colWidth, height } = atlasLayout(faceSize, mipCount);+ const columns = 1 + input.panoramas.length;+ const rgba = new Uint8Array(colWidth * columns * height * 4);++ /** Writes one column's pyramid at `column`, row for row. */+ const place = (column: number, pixels: Uint8Array): void => {+ for (let y = 0; y < height; y++) {+ const from = y * colWidth * 4;+ const to = (y * colWidth * columns + column * colWidth) * 4;+ rgba.set(pixels.subarray(from, from + colWidth * 4), to);+ }+ };++ let sky: Uint8Array | null = null;+ if (env) {+ try {+ const image = decodeRgbaPng(env.atlasPng);+ if (image.width === colWidth && image.height === height) sky = image.rgba;+ else {+ warnings.push(`the environment's atlas is ${image.width}x${image.height}, not the`+ + ` ${colWidth}x${height} its own document describes — column 0 was rebuilt`+ + ' from the ambient term instead of copied');+ }+ } catch {+ warnings.push('the environment names an atlas this bake could not read; column 0 is'+ + ' the ambient term');+ }+ }+ if (sky) place(0, sky);+ else {+ place(0, prefilterOctahedral({ width: 4, height: 2,+ rgb: Float32Array.from([...ambient, ...ambient, ...ambient,+ ...ambient, ...ambient, ...ambient,+ ...ambient, ...ambient]) },+ faceSize, mipCount, maxRange).rgba);+ }++ input.panoramas.forEach((panorama, i) => {+ place(i + 1, prefilterOctahedral(panorama, faceSize, mipCount, maxRange).rgba);+ });++ return {+ atlasBytes: encodeRgbaPng(colWidth * columns, height, rgba),+ document: {+ version: 1,+ irradiance: env?.document.irradiance ?? ZERO_SH,+ // Filled by the caller, which is the one that knows what it will name+ // the file it writes beside this document.+ specular: '',+ faceSize,+ mipCount,+ maxRange,+ columns,+ },+ columns,+ warnings,+ };+}diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 2e9443987..b05021469 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -1,11 +1,11 @@# API surface — esengine/index<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 114 public · 95 beta · 1828 experimental · 3 deprecated+Symbols: 114 public · 96 beta · 1833 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```-"8ef437d46a35780d"+"10bb7593c5d041c3"```## ANCHOR_AXES — const @experimental@@ -1342,7 +1342,7 @@ type: number | undefined## BAKE_DEFAULTS — const @experimental```-{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; }+{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; reflectionProbes: readonly (readonly [number, number, number])[]; reflectionWidth: number; }```## BUILTIN_AUDIO_BUSES — const @experimental@@ -1393,6 +1393,7 @@ setBaseUrl: ((url: string) => void) | undefinedambient: readonly [number, number, number] | undefinedlights: readonly BakeLight[]options: BakeOptions | undefined+reflections: readonly (readonly [number, number, number])[] | undefinedsurfaces: readonly { mesh: string; transform: ArrayLike<number>; albedo?: readonly [number, number, number]; texture?: string; holdsStill?: boolean; }[]volumes: readonly { center: readonly [number, number, number]; halfExtents: readonly [number, number, number]; spacing: number; }[]```@@ -1429,6 +1430,9 @@ bounces: number | undefineddilate: number | undefinedprobeGrids: readonly ProbeGrid[] | undefinedprobeSamples: number | undefined+reflectionProbes: readonly (readonly [number, number, number])[] | undefined+reflectionSky: SkyRadiance | undefined+reflectionWidth: number | undefinedsamples: number | undefinedtexelsPerUnit: number | undefined```@@ -1438,6 +1442,7 @@ texelsPerUnit: number | undefinedlumels: numberpixels: Uint8Array<ArrayBufferLike>probes: Float32Array<ArrayBufferLike>[]+reflections: CapturedPanorama[]scaleOffset: [number, number, number, number][]size: number```@@ -2158,6 +2163,13 @@ systems: SystemCost[]triangles: number | undefined```+## CapturedPanorama — interface @experimental+```+height: number+rgb: Float32Array<ArrayBufferLike>+width: number+```+## Catalog — class @experimental```addressOf: (path: string) => string | null@@ -7212,6 +7224,19 @@ get: () => Tsubscribe: (fn: (value: T) => void) => () => void```+## ReflectionProbe — const @experimental+```+BuiltinComponentDef<ReflectionProbeData>+```++## ReflectionProbeData — interface @beta+```+enabled: boolean+halfExtents: Vec3+reflection: number+slot: number+```+## ReliableOrderedTransport — interface @experimental```delivery: "reliable-ordered"@@ -8463,6 +8488,12 @@ vertexCount: numbervertices: Uint8Array<ArrayBufferLike>```+## SkyRadiance — type @experimental+```+(dx: number, dy: number, dz: number,+ out: Float32Array, at: number) => void+```+## SliceBorder — interface @experimental```bottom: number@@ -11580,6 +11611,11 @@ BtPlugin(module: ESEngineModule, width: number, height: number, advance?: () => void | Promise<void>): Promise<FramePixels | null>```+## captureReflection — function @experimental+```+(at: readonly [number, number, number], bvh: Bvh, lookup: HitLookup, atlas: Float32Array, atlasSize: number, width: number, height: number, sky: SkyRadiance): CapturedPanorama+```+## catalogFromManifest — function @experimental```(manifest: AddressableManifest): Catalog | undefined@@ -12460,6 +12496,11 @@ EventBindingPlugin<Ctx>(compiled: CompiledScriptGraph, run: ScriptRunState, tick: ScriptTickContext<Ctx>, type: string, target: number, other?: number): void```+## flatSky — function @experimental+```+(colour: readonly [number, number, number]): SkyRadiance+```+## flattenPrefab — function @experimental```(prefab: PrefabData, overrides: PrefabOverride[], ctx: FlattenContext): FlattenResultdiff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex a54cf4188..bcd50c5f4 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -1,11 +1,11 @@# API surface — esengine/index.native<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 114 public · 100 beta · 1847 experimental · 3 deprecated+Symbols: 114 public · 101 beta · 1852 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```-"8ef437d46a35780d"+"10bb7593c5d041c3"```## ANCHOR_AXES — const @experimental@@ -1342,7 +1342,7 @@ type: number | undefined## BAKE_DEFAULTS — const @experimental```-{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; }+{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; reflectionProbes: readonly (readonly [number, number, number])[]; reflectionWidth: number; }```## BUILTIN_AUDIO_BUSES — const @experimental@@ -1393,6 +1393,7 @@ setBaseUrl: ((url: string) => void) | undefinedambient: readonly [number, number, number] | undefinedlights: readonly BakeLight[]options: BakeOptions | undefined+reflections: readonly (readonly [number, number, number])[] | undefinedsurfaces: readonly { mesh: string; transform: ArrayLike<number>; albedo?: readonly [number, number, number]; texture?: string; holdsStill?: boolean; }[]volumes: readonly { center: readonly [number, number, number]; halfExtents: readonly [number, number, number]; spacing: number; }[]```@@ -1429,6 +1430,9 @@ bounces: number | undefineddilate: number | undefinedprobeGrids: readonly ProbeGrid[] | undefinedprobeSamples: number | undefined+reflectionProbes: readonly (readonly [number, number, number])[] | undefined+reflectionSky: SkyRadiance | undefined+reflectionWidth: number | undefinedsamples: number | undefinedtexelsPerUnit: number | undefined```@@ -1438,6 +1442,7 @@ texelsPerUnit: number | undefinedlumels: numberpixels: Uint8Array<ArrayBufferLike>probes: Float32Array<ArrayBufferLike>[]+reflections: CapturedPanorama[]scaleOffset: [number, number, number, number][]size: number```@@ -2158,6 +2163,13 @@ systems: SystemCost[]triangles: number | undefined```+## CapturedPanorama — interface @experimental+```+height: number+rgb: Float32Array<ArrayBufferLike>+width: number+```+## Catalog — class @experimental```addressOf: (path: string) => string | null@@ -7405,6 +7417,19 @@ get: () => Tsubscribe: (fn: (value: T) => void) => () => void```+## ReflectionProbe — const @experimental+```+BuiltinComponentDef<ReflectionProbeData>+```++## ReflectionProbeData — interface @beta+```+enabled: boolean+halfExtents: Vec3+reflection: number+slot: number+```+## ReliableOrderedTransport — interface @experimental```delivery: "reliable-ordered"@@ -8656,6 +8681,12 @@ vertexCount: numbervertices: Uint8Array<ArrayBufferLike>```+## SkyRadiance — type @experimental+```+(dx: number, dy: number, dz: number,+ out: Float32Array, at: number) => void+```+## SliceBorder — interface @experimental```bottom: number@@ -11788,6 +11819,11 @@ BtPlugin(module: ESEngineModule, width: number, height: number, advance?: () => void | Promise<void>): Promise<FramePixels | null>```+## captureReflection — function @experimental+```+(at: readonly [number, number, number], bvh: Bvh, lookup: HitLookup, atlas: Float32Array, atlasSize: number, width: number, height: number, sky: SkyRadiance): CapturedPanorama+```+## catalogFromManifest — function @experimental```(manifest: AddressableManifest): Catalog | undefined@@ -12693,6 +12729,11 @@ EventBindingPlugin<Ctx>(compiled: CompiledScriptGraph, run: ScriptRunState, tick: ScriptTickContext<Ctx>, type: string, target: number, other?: number): void```+## flatSky — function @experimental+```+(colour: readonly [number, number, number]): SkyRadiance+```+## flattenPrefab — function @experimental```(prefab: PrefabData, overrides: PrefabOverride[], ctx: FlattenContext): FlattenResultdiff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex 76d6b437f..f7997aa68 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -1,7 +1,7 @@# API surface — esengine/index.node<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 114 public · 97 beta · 1827 experimental · 3 deprecated+Symbols: 114 public · 98 beta · 1832 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -1337,7 +1337,7 @@ type: number | undefined## BAKE_DEFAULTS — const @experimental```-{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; }+{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; reflectionProbes: readonly (readonly [number, number, number])[]; reflectionWidth: number; }```## BUILTIN_AUDIO_BUSES — const @experimental@@ -1388,6 +1388,7 @@ setBaseUrl: ((url: string) => void) | undefinedambient: readonly [number, number, number] | undefinedlights: readonly BakeLight[]options: BakeOptions | undefined+reflections: readonly (readonly [number, number, number])[] | undefinedsurfaces: readonly { mesh: string; transform: ArrayLike<number>; albedo?: readonly [number, number, number]; texture?: string; holdsStill?: boolean; }[]volumes: readonly { center: readonly [number, number, number]; halfExtents: readonly [number, number, number]; spacing: number; }[]```@@ -1424,6 +1425,9 @@ bounces: number | undefineddilate: number | undefinedprobeGrids: readonly ProbeGrid[] | undefinedprobeSamples: number | undefined+reflectionProbes: readonly (readonly [number, number, number])[] | undefined+reflectionSky: SkyRadiance | undefined+reflectionWidth: number | undefinedsamples: number | undefinedtexelsPerUnit: number | undefined```@@ -1433,6 +1437,7 @@ texelsPerUnit: number | undefinedlumels: numberpixels: Uint8Array<ArrayBufferLike>probes: Float32Array<ArrayBufferLike>[]+reflections: CapturedPanorama[]scaleOffset: [number, number, number, number][]size: number```@@ -2153,6 +2158,13 @@ systems: SystemCost[]triangles: number | undefined```+## CapturedPanorama — interface @experimental+```+height: number+rgb: Float32Array<ArrayBufferLike>+width: number+```+## Catalog — class @experimental```addressOf: (path: string) => string | null@@ -7207,6 +7219,19 @@ get: () => Tsubscribe: (fn: (value: T) => void) => () => void```+## ReflectionProbe — const @experimental+```+BuiltinComponentDef<ReflectionProbeData>+```++## ReflectionProbeData — interface @beta+```+enabled: boolean+halfExtents: Vec3+reflection: number+slot: number+```+## ReliableOrderedTransport — interface @experimental```delivery: "reliable-ordered"@@ -8458,6 +8483,12 @@ vertexCount: numbervertices: Uint8Array<ArrayBufferLike>```+## SkyRadiance — type @experimental+```+(dx: number, dy: number, dz: number,+ out: Float32Array, at: number) => void+```+## SliceBorder — interface @experimental```bottom: number@@ -11575,6 +11606,11 @@ BtPlugin(module: ESEngineModule, width: number, height: number, advance?: () => void | Promise<void>): Promise<FramePixels | null>```+## captureReflection — function @experimental+```+(at: readonly [number, number, number], bvh: Bvh, lookup: HitLookup, atlas: Float32Array, atlasSize: number, width: number, height: number, sky: SkyRadiance): CapturedPanorama+```+## catalogFromManifest — function @experimental```(manifest: AddressableManifest): Catalog | undefined@@ -12455,6 +12491,11 @@ EventBindingPlugin<Ctx>(compiled: CompiledScriptGraph, run: ScriptRunState, tick: ScriptTickContext<Ctx>, type: string, target: number, other?: number): void```+## flatSky — function @experimental+```+(colour: readonly [number, number, number]): SkyRadiance+```+## flattenPrefab — function @experimental```(prefab: PrefabData, overrides: PrefabOverride[], ctx: FlattenContext): FlattenResultdiff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex 409867e5e..634e5e871 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -1,7 +1,7 @@# API surface — esengine/minigame<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 114 public · 95 beta · 1849 experimental · 3 deprecated+Symbols: 114 public · 96 beta · 1854 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -1337,7 +1337,7 @@ type: number | undefined## BAKE_DEFAULTS — const @experimental```-{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; }+{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; reflectionProbes: readonly (readonly [number, number, number])[]; reflectionWidth: number; }```## BUILTIN_AUDIO_BUSES — const @experimental@@ -1388,6 +1388,7 @@ setBaseUrl: ((url: string) => void) | undefinedambient: readonly [number, number, number] | undefinedlights: readonly BakeLight[]options: BakeOptions | undefined+reflections: readonly (readonly [number, number, number])[] | undefinedsurfaces: readonly { mesh: string; transform: ArrayLike<number>; albedo?: readonly [number, number, number]; texture?: string; holdsStill?: boolean; }[]volumes: readonly { center: readonly [number, number, number]; halfExtents: readonly [number, number, number]; spacing: number; }[]```@@ -1424,6 +1425,9 @@ bounces: number | undefineddilate: number | undefinedprobeGrids: readonly ProbeGrid[] | undefinedprobeSamples: number | undefined+reflectionProbes: readonly (readonly [number, number, number])[] | undefined+reflectionSky: SkyRadiance | undefined+reflectionWidth: number | undefinedsamples: number | undefinedtexelsPerUnit: number | undefined```@@ -1433,6 +1437,7 @@ texelsPerUnit: number | undefinedlumels: numberpixels: Uint8Array<ArrayBufferLike>probes: Float32Array<ArrayBufferLike>[]+reflections: CapturedPanorama[]scaleOffset: [number, number, number, number][]size: number```@@ -2153,6 +2158,13 @@ systems: SystemCost[]triangles: number | undefined```+## CapturedPanorama — interface @experimental+```+height: number+rgb: Float32Array<ArrayBufferLike>+width: number+```+## Catalog — class @experimental```addressOf: (path: string) => string | null@@ -7455,6 +7467,19 @@ get: () => Tsubscribe: (fn: (value: T) => void) => () => void```+## ReflectionProbe — const @experimental+```+BuiltinComponentDef<ReflectionProbeData>+```++## ReflectionProbeData — interface @beta+```+enabled: boolean+halfExtents: Vec3+reflection: number+slot: number+```+## ReliableOrderedTransport — interface @experimental```delivery: "reliable-ordered"@@ -8706,6 +8731,12 @@ vertexCount: numbervertices: Uint8Array<ArrayBufferLike>```+## SkyRadiance — type @experimental+```+(dx: number, dy: number, dz: number,+ out: Float32Array, at: number) => void+```+## SliceBorder — interface @experimental```bottom: number@@ -11829,6 +11860,11 @@ BtPlugin(module: ESEngineModule, width: number, height: number, advance?: () => void | Promise<void>): Promise<FramePixels | null>```+## captureReflection — function @experimental+```+(at: readonly [number, number, number], bvh: Bvh, lookup: HitLookup, atlas: Float32Array, atlasSize: number, width: number, height: number, sky: SkyRadiance): CapturedPanorama+```+## catalogFromManifest — function @experimental```(manifest: AddressableManifest): Catalog | undefined@@ -12714,6 +12750,11 @@ EventBindingPlugin<Ctx>(compiled: CompiledScriptGraph, run: ScriptRunState, tick: ScriptTickContext<Ctx>, type: string, target: number, other?: number): void```+## flatSky — function @experimental+```+(colour: readonly [number, number, number]): SkyRadiance+```+## flattenPrefab — function @experimental```(prefab: PrefabData, overrides: PrefabOverride[], ctx: FlattenContext): FlattenResultdiff --git a/sdk/etc/wasm.api.md b/sdk/etc/wasm.api.mdindex 56aa1cf16..4ff21b48d 100644--- a/sdk/etc/wasm.api.md+++ b/sdk/etc/wasm.api.md@@ -40,6 +40,7 @@ addOccluder: (entity: Entity, component: Occluder) => voidaddParent: (entity: Entity, component: Parent) => voidaddParticleEmitter: (entity: Entity, component: ParticleEmitter) => voidaddParticleForceField: (entity: Entity, component: ParticleForceField) => void+addReflectionProbe: (entity: Entity, component: ReflectionProbe) => voidaddRigidBody2D: (entity: Entity, component: RigidBody2D) => voidaddRigidBody3D: (entity: Entity, component: RigidBody3D) => voidaddSegmentCollider2D: (entity: Entity, component: SegmentCollider2D) => void@@ -90,6 +91,7 @@ getOccluder: (entity: Entity) => OccludergetParent: (entity: Entity) => ParentgetParticleEmitter: (entity: Entity) => ParticleEmittergetParticleForceField: (entity: Entity) => ParticleForceField+getReflectionProbe: (entity: Entity) => ReflectionProbegetRigidBody2D: (entity: Entity) => RigidBody2DgetRigidBody3D: (entity: Entity) => RigidBody3DgetSegmentCollider2D: (entity: Entity) => SegmentCollider2D@@ -136,6 +138,7 @@ hasOccluder: (entity: Entity) => booleanhasParent: (entity: Entity) => booleanhasParticleEmitter: (entity: Entity) => booleanhasParticleForceField: (entity: Entity) => boolean+hasReflectionProbe: (entity: Entity) => booleanhasRigidBody2D: (entity: Entity) => booleanhasRigidBody3D: (entity: Entity) => booleanhasSegmentCollider2D: (entity: Entity) => boolean@@ -183,6 +186,7 @@ removeOccluder: (entity: Entity) => voidremoveParent: (entity: Entity) => voidremoveParticleEmitter: (entity: Entity) => voidremoveParticleForceField: (entity: Entity) => void+removeReflectionProbe: (entity: Entity) => voidremoveRigidBody2D: (entity: Entity) => voidremoveRigidBody3D: (entity: Entity) => voidremoveSegmentCollider2D: (entity: Entity) => void@@ -296,7 +300,7 @@ engine_getGpuScopes: (() => string) | undefinedengine_prepareMeshPrograms: ((rowsPtr: number, count: number, outPtr: number) => void) | undefinedengine_setCpuProfiling: ((on: boolean) => void) | undefinedengine_setRandomSeed: ((seed: number) => void) | undefined-environment_create: ((shPtr: number, specularHandle: number, faceSize: number, mipCount: number, maxRange: number) => number) | undefined+environment_create: ((shPtr: number, specularHandle: number, faceSize: number, mipCount: number, maxRange: number, columns: number) => number) | undefinedenvironment_release: ((environmentHandle: number) => void) | undefinedes_getMallocBytes: (() => number) | undefinedesshader_cookInfo: (source: string, featuresCsv: string) => { valid: boolean; error?: string; name: string; domain: string; hasWgslVertex: boolean; hasWgslFragment: boolean; hasSwitches: boolean; vertGlsl: string; fragGlsl: string; textures: Array<{ name: string; unit: number; }>; }diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex fb2c6aaac..f7458ec2b 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -1,7 +1,7 @@# API surface — esengine/wechat<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 114 public · 95 beta · 1839 experimental · 3 deprecated+Symbols: 114 public · 96 beta · 1844 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -1337,7 +1337,7 @@ type: number | undefined## BAKE_DEFAULTS — const @experimental```-{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; }+{ atlasSize: number; texelsPerUnit: number; bounces: number; samples: number; ambient: readonly [number, number, number]; dilate: number; probeGrids: readonly ProbeGrid[]; probeSamples: number; reflectionProbes: readonly (readonly [number, number, number])[]; reflectionWidth: number; }```## BUILTIN_AUDIO_BUSES — const @experimental@@ -1388,6 +1388,7 @@ setBaseUrl: ((url: string) => void) | undefinedambient: readonly [number, number, number] | undefinedlights: readonly BakeLight[]options: BakeOptions | undefined+reflections: readonly (readonly [number, number, number])[] | undefinedsurfaces: readonly { mesh: string; transform: ArrayLike<number>; albedo?: readonly [number, number, number]; texture?: string; holdsStill?: boolean; }[]volumes: readonly { center: readonly [number, number, number]; halfExtents: readonly [number, number, number]; spacing: number; }[]```@@ -1424,6 +1425,9 @@ bounces: number | undefineddilate: number | undefinedprobeGrids: readonly ProbeGrid[] | undefinedprobeSamples: number | undefined+reflectionProbes: readonly (readonly [number, number, number])[] | undefined+reflectionSky: SkyRadiance | undefined+reflectionWidth: number | undefinedsamples: number | undefinedtexelsPerUnit: number | undefined```@@ -1433,6 +1437,7 @@ texelsPerUnit: number | undefinedlumels: numberpixels: Uint8Array<ArrayBufferLike>probes: Float32Array<ArrayBufferLike>[]+reflections: CapturedPanorama[]scaleOffset: [number, number, number, number][]size: number```@@ -2153,6 +2158,13 @@ systems: SystemCost[]triangles: number | undefined```+## CapturedPanorama — interface @experimental+```+height: number+rgb: Float32Array<ArrayBufferLike>+width: number+```+## Catalog — class @experimental```addressOf: (path: string) => string | null@@ -7214,6 +7226,19 @@ get: () => Tsubscribe: (fn: (value: T) => void) => () => void```+## ReflectionProbe — const @experimental+```+BuiltinComponentDef<ReflectionProbeData>+```++## ReflectionProbeData — interface @beta+```+enabled: boolean+halfExtents: Vec3+reflection: number+slot: number+```+## ReliableOrderedTransport — interface @experimental```delivery: "reliable-ordered"@@ -8465,6 +8490,12 @@ vertexCount: numbervertices: Uint8Array<ArrayBufferLike>```+## SkyRadiance — type @experimental+```+(dx: number, dy: number, dz: number,+ out: Float32Array, at: number) => void+```+## SliceBorder — interface @experimental```bottom: number@@ -11603,6 +11634,11 @@ BtPlugin(module: ESEngineModule, width: number, height: number, advance?: () => void | Promise<void>): Promise<FramePixels | null>```+## captureReflection — function @experimental+```+(at: readonly [number, number, number], bvh: Bvh, lookup: HitLookup, atlas: Float32Array, atlasSize: number, width: number, height: number, sky: SkyRadiance): CapturedPanorama+```+## catalogFromManifest — function @experimental```(manifest: AddressableManifest): Catalog | undefined@@ -12483,6 +12519,11 @@ EventBindingPlugin<Ctx>(compiled: CompiledScriptGraph, run: ScriptRunState, tick: ScriptTickContext<Ctx>, type: string, target: number, other?: number): void```+## flatSky — function @experimental+```+(colour: readonly [number, number, number]): SkyRadiance+```+## flattenPrefab — function @experimental```(prefab: PrefabData, overrides: PrefabOverride[], ctx: FlattenContext): FlattenResultdiff --git a/sdk/src/asset/loaders/EnvironmentAssetLoader.ts b/sdk/src/asset/loaders/EnvironmentAssetLoader.tsindex e3daf6d90..c54099473 100644--- a/sdk/src/asset/loaders/EnvironmentAssetLoader.ts+++ b/sdk/src/asset/loaders/EnvironmentAssetLoader.ts@@ -16,6 +16,9 @@ interface EnvironmentAssetData {faceSize?: number;mipCount?: number;maxRange?: number;+ /** Octahedral pyramids standing side by side in that atlas. A scene BAKE+ * writes several — column 0 the sky, the rest a reflection probe each. */+ columns?: number;}/** A baked environment, named by the handle a Light references. */@@ -69,7 +72,8 @@ export class EnvironmentAssetLoader implements AssetLoader<EnvironmentResult> {const shPtr = alloc(27 * 4);m.HEAPF32.set(Float32Array.from(data.irradiance), shPtr >> 2);return m.environment_create!(shPtr, specularHandle, data.faceSize ?? 0,- data.mipCount ?? 0, data.maxRange ?? 0);+ data.mipCount ?? 0, data.maxRange ?? 0,+ data.columns ?? 1);});if (!handle) {diff --git a/sdk/src/core-content.ts b/sdk/src/core-content.tsindex 85638b6a4..07ca25659 100644--- a/sdk/src/core-content.ts+++ b/sdk/src/core-content.ts@@ -152,6 +152,7 @@ export {export {bakeLightmap, type BakeOptions, type BakeResult, type BakeSurface, type BakeLight,type ProbeGrid, bakeHoldsStill, type BakeMobility, BAKE_DEFAULTS,+ captureReflection, flatSky, type CapturedPanorama, type SkyRadiance,} from './lightmap';/*** What a scene declares about its baked light: the knobs, and the fingerprint ofdiff --git a/sdk/src/core-runtime.ts b/sdk/src/core-runtime.tsindex 0c0ed705f..c1a87136c 100644--- a/sdk/src/core-runtime.ts+++ b/sdk/src/core-runtime.ts@@ -99,6 +99,8 @@ export {type LightProbeVolumeData,Occluder,type OccluderData,+ ReflectionProbe,+ type ReflectionProbeData,SortingGroup,SpriteMask,TrailRenderer,diff --git a/sdk/src/ecs/bridge/nativeEngineApi.generated.ts b/sdk/src/ecs/bridge/nativeEngineApi.generated.tsindex e195d157e..80b0c0da5 100644--- a/sdk/src/ecs/bridge/nativeEngineApi.generated.ts+++ b/sdk/src/ecs/bridge/nativeEngineApi.generated.ts@@ -51,7 +51,7 @@ export interface NativeEngineApi {engine_prepareMeshPrograms?(rowsPtr: number, count: number, outPtr: number): void;engine_setCpuProfiling?(on: boolean): void;engine_setRandomSeed?(seed: number): void;- environment_create?(shPtr: number, specularHandle: number, faceSize: number, mipCount: number, maxRange: number): number;+ environment_create?(shPtr: number, specularHandle: number, faceSize: number, mipCount: number, maxRange: number, columns: number): number;environment_release?(environmentHandle: number): void;geometry_create?(): number;geometry_init?(handle: number, verticesPtr: number, vertexCount: number, layoutPtr: number, layoutCount: number, dynamic: boolean): void;diff --git a/sdk/src/ecs/bridge/ptrAccessors.generated.ts b/sdk/src/ecs/bridge/ptrAccessors.generated.tsindex a3a83d0c5..ee5e927c2 100644--- a/sdk/src/ecs/bridge/ptrAccessors.generated.ts+++ b/sdk/src/ecs/bridge/ptrAccessors.generated.ts@@ -1389,6 +1389,42 @@ export function createParticleForceFieldData(): ParticleForceFieldPtrData {};}+export interface ReflectionProbePtrData {+ reflection: number;+ halfExtents: Vec3;+ slot: number;+ enabled: boolean;+}++export function fillReflectionProbe(+ f32: Float32Array, u32: Uint32Array, u8: Uint8Array,+ ptr: number, out: ReflectionProbePtrData,+): void {+ out.reflection = u32[ptr >> 2];+ const halfExtents_ = out.halfExtents; halfExtents_.x = f32[(ptr + 4) >> 2]; halfExtents_.y = f32[((ptr + 4) >> 2) + 1]; halfExtents_.z = f32[((ptr + 4) >> 2) + 2];+ out.slot = u32[(ptr + 16) >> 2];+ out.enabled = u8[ptr + 20] !== 0;+}++export function writeReflectionProbe(+ f32: Float32Array, u32: Uint32Array, u8: Uint8Array,+ ptr: number, data: ReflectionProbePtrData,+): void {+ u32[ptr >> 2] = data.reflection;+ f32[(ptr + 4) >> 2] = data.halfExtents.x; f32[((ptr + 4) >> 2) + 1] = data.halfExtents.y; f32[((ptr + 4) >> 2) + 2] = data.halfExtents.z;+ u32[(ptr + 16) >> 2] = data.slot;+ u8[ptr + 20] = data.enabled ? 1 : 0;+}++export function createReflectionProbeData(): ReflectionProbePtrData {+ return {+ reflection: 0,+ halfExtents: { x: 0, y: 0, z: 0 },+ slot: 0,+ enabled: false,+ };+}+export interface RigidBody2DPtrData {bodyType: number;gravityScale: number;@@ -2423,6 +2459,7 @@ export const PTR_ACCESSORS: Record<string, PtrAccessor<any>> = {Occluder: { fill: fillOccluder, write: writeOccluder, create: createOccluderData },ParticleEmitter: { fill: fillParticleEmitter, write: writeParticleEmitter, create: createParticleEmitterData },ParticleForceField: { fill: fillParticleForceField, write: writeParticleForceField, create: createParticleForceFieldData },+ ReflectionProbe: { fill: fillReflectionProbe, write: writeReflectionProbe, create: createReflectionProbeData },RigidBody2D: { fill: fillRigidBody2D, write: writeRigidBody2D, create: createRigidBody2DData },RigidBody3D: { fill: fillRigidBody3D, write: writeRigidBody3D, create: createRigidBody3DData },SegmentCollider2D: { fill: fillSegmentCollider2D, write: writeSegmentCollider2D, create: createSegmentCollider2DData },diff --git a/sdk/src/ecs/component.generated.ts b/sdk/src/ecs/component.generated.tsindex 6ab9edf91..e55b6fa91 100644--- a/sdk/src/ecs/component.generated.ts+++ b/sdk/src/ecs/component.generated.ts@@ -15,7 +15,7 @@ import type { AlignContent, AlignItems, AlignSelf, BodyType, CanvasScaleMode, Cl* getAbiLayoutHash(); BuiltinBridge.connect() compares them and refuses to* run on mismatch, because mismatched offsets read the wrong heap bytes.*/-export const ABI_LAYOUT_HASH = '8ef437d46a35780d';+export const ABI_LAYOUT_HASH = '10bb7593c5d041c3';/*** One asset-valued field of a component: which field, and what kind of@@ -782,6 +782,24 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {falloff: { category: "Field" },},},+ ReflectionProbe: {+ defaults: {+ reflection: 0,+ halfExtents: { x: 200, y: 200, z: 200 },+ slot: 0,+ enabled: true,+ },+ assetFields: [{ field: 'reflection', type: 'environment' as AssetFieldType }],+ entityFields: [],+ colorFields: [],+ animatableFields: [],+ fields: {+ reflection: { tooltip: "The scene's baked reflections (the baker writes this)." },+ halfExtents: { min: 0, tooltip: "Half the box this probe answers inside, from the entity's position." },+ slot: { min: 0, tooltip: "Which column of the atlas this probe occupies (the baker writes this).", advanced: true },+ enabled: { tooltip: "Off: what stands inside this box reflects the sky again." },+ },+ },RigidBody2D: {defaults: {bodyType: 2,@@ -1574,6 +1592,19 @@ export interface ParticleForceFieldData {enabled: boolean;}+/**+ * The fields of the engine's `ReflectionProbe` component, generated from+ * the C++ struct so the two shapes cannot drift.+ *+ * @beta+ */+export interface ReflectionProbeData {+ reflection: number;+ halfExtents: Vec3;+ slot: number;+ enabled: boolean;+}+export interface RigidBody2DData {bodyType: BodyType;gravityScale: number;diff --git a/sdk/src/ecs/component.ts b/sdk/src/ecs/component.tsindex 10c5ec3f3..ed9fbebc6 100644--- a/sdk/src/ecs/component.ts+++ b/sdk/src/ecs/component.ts@@ -16,6 +16,7 @@ export type { AssetFieldMeta, SkeletalFieldMeta };import type {TransformData, SpriteData, ShapeRendererData, LightData, ShadowCaster2DData, DraggableData,SortingGroupData, SpriteMaskData, LightProbeVolumeData, OccluderData,+ ReflectionProbeData,CanvasData, VelocityData, ParentData, ChildrenData, SpineAnimationData, DragonBonesAnimationData,TilemapLayerData, BitmapTextData, TrailRendererData, ParticleForceFieldData,CameraData as CameraDataCpp, ParticleEmitterData as ParticleEmitterDataCpp,@@ -806,6 +807,7 @@ export type ScaleMode = (typeof ScaleMode)[keyof typeof ScaleMode];export type {TransformData, SpriteData, ShapeRendererData, LightData, ShadowCaster2DData, DraggableData,SortingGroupData, SpriteMaskData, LightProbeVolumeData, OccluderData,+ ReflectionProbeData,CanvasData, VelocityData, ParentData, ChildrenData, SpineAnimationData, DragonBonesAnimationData,TilemapLayerData, BitmapTextData, TrailRendererData, ParticleForceFieldData,};@@ -928,6 +930,18 @@ export const LightProbeVolume = defineBuiltin<LightProbeVolumeData>('LightProbeVmetaDefaults<LightProbeVolumeData>('LightProbeVolume'));+/**+ * A box inside which reflections come from a bake rather than from the sky: the+ * specular half of what LightProbeVolume answers. The atlas is the SCENE's and+ * `slot` says which column of it is here, so a room full of shiny things is still+ * one draw — a texture per probe would be a bind per draw.+ *+ * @experimental+ */+export const ReflectionProbe = defineBuiltin<ReflectionProbeData>('ReflectionProbe',+ metaDefaults<ReflectionProbeData>('ReflectionProbe')+);+/*** A box sight does not pass through: what stands behind it is not collected, and* the picture is unchanged. Authored, not taken from the geometry beside it — thediff --git a/sdk/src/lightmap/bake.ts b/sdk/src/lightmap/bake.tsindex ea4f2ea7b..5bf2f3dd5 100644--- a/sdk/src/lightmap/bake.ts+++ b/sdk/src/lightmap/bake.ts@@ -14,6 +14,8 @@ import { Bvh, type TriangleSoup } from './bvh';import { layoutAtlas, rasterizeLumels, type BakeSurface, type SurfacePatch } from './atlas';import { solveDirect, solveBounce, type BakeLight, type HitLookup } from './solve';import { solveProbes, type ProbeGrid } from './probes';+import { captureReflection, flatSky, type CapturedPanorama, type SkyRadiance }+ from './reflection';export interface BakeOptions {/** Side of the square atlas, in texels. */@@ -40,6 +42,16 @@ export interface BakeOptions {/** Directions each probe gathers. Over the whole sphere, so this buys less* per ray than a lumel's hemisphere does. */probeSamples?: number;+ /** Where reflections are captured from — a panorama each, solved in the same+ * light field the probes are. The specular half of the same question. */+ reflectionProbes?: readonly (readonly [number, number, number])[];+ /** Width of a captured panorama; its height is half. Small on purpose: what+ * a rough surface reflects is a blur, and the prefilter below widens the+ * lobe anyway. */+ reflectionWidth?: number;+ /** What a captured ray brings back when it escapes the scene. The environment+ * where the caller could sample one, the flat ambient where it could not. */+ reflectionSky?: SkyRadiance;}export interface BakeResult {@@ -53,6 +65,9 @@ export interface BakeResult {/** Nine RGB coefficients per probe, one array per requested grid, in grid* order with x varying fastest — what a `.esprobes` carries. */probes: Float32Array[];+ /** One captured sphere per {@link BakeOptions.reflectionProbes}, in the order+ * they were given, for the caller to prefilter into an atlas column. */+ reflections: CapturedPanorama[];}/** What a bake does where the caller says nothing — and what a scene's own@@ -66,6 +81,8 @@ export const BAKE_DEFAULTS = {dilate: 2,probeGrids: [] as readonly ProbeGrid[],probeSamples: 128,+ reflectionProbes: [] as readonly (readonly [number, number, number])[],+ reflectionWidth: 64,};const chan = (m: MeshData, s: number): MeshChannelDesc | undefined =>@@ -246,11 +263,19 @@ export function bakeLightmap(surfaces: readonly BakeSurface[], lights: readonlyconst probes = opts.probeGrids.map((grid) =>solveProbes(grid, bvh, lookup, radiance, size, opts.probeSamples, opts.ambient));+ // Captured from the same field, after the same bounces: a reflection of a+ // wall and the light that wall casts are then the same number.+ const width = Math.max(8, opts.reflectionWidth);+ const sky = options.reflectionSky ?? flatSky(opts.ambient);+ const reflections = opts.reflectionProbes.map((at) =>+ captureReflection(at, bvh, lookup, radiance, size, width, Math.max(4, width >> 1), sky));+return {pixels,size,scaleOffset: patches.map((p) => p.scaleOffset),lumels: lumels.count,probes,+ reflections,};}diff --git a/sdk/src/lightmap/fingerprint.ts b/sdk/src/lightmap/fingerprint.tsindex d67e3581d..d7cf2a622 100644--- a/sdk/src/lightmap/fingerprint.ts+++ b/sdk/src/lightmap/fingerprint.ts@@ -34,6 +34,9 @@ export interface BakeInputs {halfExtents: readonly [number, number, number];spacing: number;}>;+ /** Where each reflection probe stands. A capture is a function of the POINT,+ * so that is the whole of what one contributes to a bake. */+ reflections?: ReadonlyArray<readonly [number, number, number]>;ambient?: readonly [number, number, number];options?: BakeOptions;}@@ -73,6 +76,7 @@ export function bakeFingerprint(inputs: BakeInputs): string {for (const v of inputs.volumes) {lines.push(`v|${nums(v.center)}|${nums(v.halfExtents)}|${num(v.spacing)}`);}+ for (const r of inputs.reflections ?? []) lines.push(`r|${nums(r)}`);lines.sort();lines.push(`o|${opts.atlasSize}|${opts.texelsPerUnit}|${opts.bounces}|${opts.samples}`+ `|${opts.probeSamples}|${opts.dilate}|${nums(inputs.ambient ?? opts.ambient)}`);diff --git a/sdk/src/lightmap/index.ts b/sdk/src/lightmap/index.tsindex 5de082e2c..e2d5d2e83 100644--- a/sdk/src/lightmap/index.ts+++ b/sdk/src/lightmap/index.ts@@ -5,6 +5,8 @@ export { bakeLightmap, type BakeOptions, type BakeResult } from './bake';export type { BakeSurface } from './atlas';export type { BakeLight } from './solve';export { solveProbes, probeAt, type ProbeGrid } from './probes';+export { captureReflection, flatSky, type CapturedPanorama, type SkyRadiance }+ from './reflection';export { bakeHoldsStill, type BakeMobility } from './mobility';export { bakeFingerprint, type BakeInputs } from './fingerprint';export { BakedLighting, type BakedLightingData } from './components';diff --git a/sdk/src/lightmap/probes.ts b/sdk/src/lightmap/probes.tsindex c0f2a0f6e..5351990ce 100644--- a/sdk/src/lightmap/probes.ts+++ b/sdk/src/lightmap/probes.ts@@ -11,7 +11,7 @@*/import type { Bvh } from './bvh';-import { texelOf, facesRay, type HitLookup } from './solve';+import { rayRadiance, type HitLookup } from './solve';import { shBasis, convolveCosine } from './sh';/** Where one grid of probes sits, and how many. */@@ -71,7 +71,7 @@ export function solveProbes(grid: ProbeGrid, bvh: Bvh, lookup: HitLookup,const dirs = sphere(samples);const basis = new Float32Array(9);- const far = 1e7;+ const seen = new Float32Array(3);// The Monte-Carlo weight of one direction over the sphere, folded in once.const weight = (4 * Math.PI) / samples;@@ -84,19 +84,11 @@ export function solveProbes(grid: ProbeGrid, bvh: Bvh, lookup: HitLookup,const at = (x + y * nx + z * nx * ny) * 27;for (let s = 0; s < samples; s++) {const dx = dirs[s * 3]!, dy = dirs[s * 3 + 1]!, dz = dirs[s * 3 + 2]!;- let r = ambient[0], g = ambient[1], b = ambient[2];- const tri = bvh.hit(px, py, pz, dx, dy, dz, far, 0);- if (tri >= 0) {- r = 0; g = 0; b = 0;- const texel = facesRay(lookup, tri, dx, dy, dz)- ? texelOf(lookup, tri, bvh.hitU, bvh.hitV, atlasSize) : -1;- if (texel >= 0) {- const surface = lookup.triSurface[tri]!;- r = atlas[texel * 3]! * lookup.albedo[surface * 3]!;- g = atlas[texel * 3 + 1]! * lookup.albedo[surface * 3 + 1]!;- b = atlas[texel * 3 + 2]! * lookup.albedo[surface * 3 + 2]!;- }+ if (!rayRadiance(bvh, lookup, atlas, atlasSize, px, py, pz, dx, dy, dz,+ seen)) {+ seen[0] = ambient[0]; seen[1] = ambient[1]; seen[2] = ambient[2];}+ const r = seen[0]!, g = seen[1]!, b = seen[2]!;shBasis(dx, dy, dz, basis);for (let i = 0; i < 9; i++) {const w = basis[i]! * weight;diff --git a/sdk/src/lightmap/reflection.ts b/sdk/src/lightmap/reflection.tsnew file mode 100644index 000000000..182caf787--- /dev/null+++ b/sdk/src/lightmap/reflection.ts@@ -0,0 +1,65 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file reflection.ts+ * @brief What a shiny thing standing at a point would SEE — the whole sphere+ * of it, as a panorama.+ *+ * @details The probe gather with the integral taken out: irradiance asks what+ * arrives from everywhere at once, a reflection asks what arrives from+ * each direction separately. Same rays, same surfaces, same answer per+ * ray — {@link rayRadiance} — so the two halves of one bake cannot+ * disagree about what a wall gives off.+ */++import type { Bvh } from './bvh';+import { rayRadiance, type HitLookup } from './solve';++/** A captured sphere: equirectangular RGB, the layout the prefilter reads. */+export interface CapturedPanorama {+ width: number;+ height: number;+ rgb: Float32Array;+}++/** What a ray that escapes the scene brings back, by direction. */+export type SkyRadiance = (dx: number, dy: number, dz: number,+ out: Float32Array, at: number) => void;++/** A flat sky, for a bake with no environment to sample. */+export function flatSky(colour: readonly [number, number, number]): SkyRadiance {+ return (_dx, _dy, _dz, out, at) => {+ out[at] = colour[0]; out[at + 1] = colour[1]; out[at + 2] = colour[2];+ };+}++/**+ * Captures the sphere seen from `at`, as an equirectangular panorama.+ *+ * The mapping is the environment importer's — centre column +Z, row 0 +Y —+ * because this is handed to that importer's own prefilter. `atlas` is the solved+ * light field by texel, as the probes read it; `sky` answers the rays that leave.+ */+export function captureReflection(at: readonly [number, number, number],+ bvh: Bvh, lookup: HitLookup,+ atlas: Float32Array, atlasSize: number,+ width: number, height: number,+ sky: SkyRadiance): CapturedPanorama {+ const rgb = new Float32Array(width * height * 3);+ for (let y = 0; y < height; y++) {+ const theta = ((y + 0.5) / height) * Math.PI;+ const sinTheta = Math.sin(theta);+ const dy = Math.cos(theta);+ for (let x = 0; x < width; x++) {+ const phi = ((x + 0.5) / width - 0.5) * 2 * Math.PI;+ const dx = sinTheta * Math.sin(phi);+ const dz = sinTheta * Math.cos(phi);+ const to = (y * width + x) * 3;+ if (!rayRadiance(bvh, lookup, atlas, atlasSize, at[0], at[1], at[2], dx, dy, dz,+ rgb, to)) {+ sky(dx, dy, dz, rgb, to);+ }+ }+ }+ return { width, height, rgb };+}diff --git a/sdk/src/lightmap/solve.ts b/sdk/src/lightmap/solve.tsindex 2fbadbcdb..ba633f09c 100644--- a/sdk/src/lightmap/solve.ts+++ b/sdk/src/lightmap/solve.ts@@ -183,6 +183,33 @@ export function solveBounce(lumels: LumelField, bvh: Bvh, lookup: HitLookup,}}+/**+ * What the GEOMETRY along a ray gives off, written into @p out at @p at.+ *+ * @returns false where the ray met nothing: the sky is the caller's to write,+ * and the two hold different ones — a probe gathers a flat ambient, a+ * capture points the same ray at the environment. What a SURFACE gives+ * off is one answer, and the two halves of a bake must not differ on it.+ */+export function rayRadiance(bvh: Bvh, lookup: HitLookup, atlas: Float32Array, atlasSize: number,+ fromX: number, fromY: number, fromZ: number,+ dx: number, dy: number, dz: number,+ out: Float32Array, at = 0): boolean {+ const tri = bvh.hit(fromX, fromY, fromZ, dx, dy, dz, 1e7, 0);+ if (tri < 0) return false;+ // Geometry with no place in the atlas is black rather than sky: something is+ // there, and it is unlit.+ out[at] = 0; out[at + 1] = 0; out[at + 2] = 0;+ if (!facesRay(lookup, tri, dx, dy, dz)) return true;+ const texel = texelOf(lookup, tri, bvh.hitU, bvh.hitV, atlasSize);+ if (texel < 0) return true;+ const surface = lookup.triSurface[tri]!;+ out[at] = atlas[texel * 3]! * lookup.albedo[surface * 3]!;+ out[at + 1] = atlas[texel * 3 + 1]! * lookup.albedo[surface * 3 + 1]!;+ out[at + 2] = atlas[texel * 3 + 2]! * lookup.albedo[surface * 3 + 2]!;+ return true;+}+/** Where on the atlas a hit lands, or -1 when it falls outside it. */export function texelOf(lookup: HitLookup, tri: number, u: number, v: number, size: number): number {const at = tri * 6;diff --git a/sdk/src/wasm.ts b/sdk/src/wasm.tsindex 3727a5299..2d9ebf8cd 100644--- a/sdk/src/wasm.ts+++ b/sdk/src/wasm.ts@@ -308,11 +308,12 @@ export interface ESEngineModule {mesh_release?(meshHandle: number): void;/*** Register a baked environment: 27 floats of irradiance (nine RGB spherical-- * harmonic coefficients, already convolved and over pi) plus the prefiltered- * octahedral atlas an ambient light reflects. A 0 atlas is diffuse-only.+ * harmonic coefficients, convolved and over pi) plus the prefiltered atlas an+ * ambient light reflects; 0 is diffuse-only. `columns` is the pyramids in that+ * atlas — one for a sky, several for a bake whose column 0 IS the sky.*/environment_create?(shPtr: number, specularHandle: number, faceSize: number,- mipCount: number, maxRange: number): number;+ mipCount: number, maxRange: number, columns: number): number;/** Release an environment; its atlas is an ordinary texture and outlives it. */environment_release?(environmentHandle: number): void;/**diff --git a/sdk/src/wasm/ptrLayouts.generated.ts b/sdk/src/wasm/ptrLayouts.generated.tsindex 949406517..41a723537 100644--- a/sdk/src/wasm/ptrLayouts.generated.ts+++ b/sdk/src/wasm/ptrLayouts.generated.ts@@ -372,6 +372,15 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {{ name: 'enabled', type: 'bool', offset: 25 },],},+ ReflectionProbe: {+ ptrFn: 'getReflectionProbePtr',+ fields: [+ { name: 'reflection', type: 'u32', offset: 0 },+ { name: 'halfExtents', type: 'vec3', offset: 4 },+ { name: 'slot', type: 'u32', offset: 16 },+ { name: 'enabled', type: 'bool', offset: 20 },+ ],+ },RigidBody2D: {ptrFn: 'getRigidBody2DPtr',fields: [diff --git a/sdk/src/wasm/wasm.generated.ts b/sdk/src/wasm/wasm.generated.tsindex c8a634189..92d4e2432 100644--- a/sdk/src/wasm/wasm.generated.ts+++ b/sdk/src/wasm/wasm.generated.ts@@ -692,6 +692,13 @@ export interface ParticleForceField {enabled: boolean;}+export interface ReflectionProbe {+ reflection: number;+ halfExtents: Vec3;+ slot: number;+ enabled: boolean;+}+export interface RigidBody2D {bodyType: number;gravityScale: number;@@ -1025,6 +1032,10 @@ export interface Registry {getParticleForceField(entity: Entity): ParticleForceField;addParticleForceField(entity: Entity, component: ParticleForceField): void;removeParticleForceField(entity: Entity): void;+ hasReflectionProbe(entity: Entity): boolean;+ getReflectionProbe(entity: Entity): ReflectionProbe;+ addReflectionProbe(entity: Entity, component: ReflectionProbe): void;+ removeReflectionProbe(entity: Entity): void;hasRigidBody2D(entity: Entity): boolean;getRigidBody2D(entity: Entity): RigidBody2D;addRigidBody2D(entity: Entity, component: RigidBody2D): void;@@ -1142,6 +1153,7 @@ export interface ESEngineModule {Parent: new () => Parent;ParticleEmitter: new () => ParticleEmitter;ParticleForceField: new () => ParticleForceField;+ ReflectionProbe: new () => ReflectionProbe;RigidBody2D: new () => RigidBody2D;RigidBody3D: new () => RigidBody3D;SegmentCollider2D: new () => SegmentCollider2D;diff --git a/src/esengine/aot/AotComponents.generated.cpp b/src/esengine/aot/AotComponents.generated.cppindex 4d7df4c8b..7e81a5303 100644--- a/src/esengine/aot/AotComponents.generated.cpp+++ b/src/esengine/aot/AotComponents.generated.cpp@@ -25,6 +25,7 @@#include "esengine/ecs/components/Occluder.hpp"#include "esengine/ecs/components/ParticleEmitter.hpp"#include "esengine/ecs/components/ParticleForceField.hpp"+#include "esengine/ecs/components/ReflectionProbe.hpp"#include "esengine/ecs/components/RigidBody2D.hpp"#include "esengine/ecs/components/ShadowCaster2D.hpp"#include "esengine/ecs/components/ShapeRenderer.hpp"@@ -198,6 +199,11 @@ ComponentAt engineComponentAt(ecs::Registry& registry, const char* name) {return registry.tryGet<esengine::ecs::ParticleForceField>(Entity::fromRaw(raw));};}+ if (std::strcmp(name, "ReflectionProbe") == 0) {+ return [®istry](std::uint32_t raw) -> void* {+ return registry.tryGet<esengine::ecs::ReflectionProbe>(Entity::fromRaw(raw));+ };+ }if (std::strcmp(name, "RigidBody2D") == 0) {return [®istry](std::uint32_t raw) -> void* {return registry.tryGet<esengine::ecs::RigidBody2D>(Entity::fromRaw(raw));@@ -432,6 +438,11 @@ CandidatesOf engineComponentCandidates(ecs::Registry& registry, const char* namereturn denseAsIds(registry.entitiesWith<esengine::ecs::ParticleForceField>());};}+ if (std::strcmp(name, "ReflectionProbe") == 0) {+ return [®istry]() -> Candidates {+ return denseAsIds(registry.entitiesWith<esengine::ecs::ReflectionProbe>());+ };+ }if (std::strcmp(name, "RigidBody2D") == 0) {return [®istry]() -> Candidates {return denseAsIds(registry.entitiesWith<esengine::ecs::RigidBody2D>());@@ -558,6 +569,7 @@ bool isEngineComponent(const char* name) {if (std::strcmp(name, "Parent") == 0) return true;if (std::strcmp(name, "ParticleEmitter") == 0) return true;if (std::strcmp(name, "ParticleForceField") == 0) return true;+ if (std::strcmp(name, "ReflectionProbe") == 0) return true;if (std::strcmp(name, "RigidBody2D") == 0) return true;if (std::strcmp(name, "RigidBody3D") == 0) return true;if (std::strcmp(name, "SegmentCollider2D") == 0) return true;diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cppindex 287310b4b..2943b9567 100644--- a/src/esengine/bindings/EditorAPI.generated.cpp+++ b/src/esengine/bindings/EditorAPI.generated.cpp@@ -2,10 +2,10 @@* @file EditorAPI.generated.cpp* @brief Auto-generated editor API with string-dispatched component access* @details Generated by EHT - DO NOT EDIT- * @schema_hash 9eb680d3a8c6f4f8+ * @schema_hash b8b8da4186821947*/-#define ES_EDITOR_API_SCHEMA_HASH "9eb680d3a8c6f4f8"+#define ES_EDITOR_API_SCHEMA_HASH "b8b8da4186821947"#include <emscripten/bind.h>#include <string>@@ -28,6 +28,7 @@#include "../ecs/components/Occluder.hpp"#include "../ecs/components/ParticleEmitter.hpp"#include "../ecs/components/ParticleForceField.hpp"+#include "../ecs/components/ReflectionProbe.hpp"#include "../ecs/components/RigidBody2D.hpp"#include "../ecs/components/RigidBody3D.hpp"#include "../ecs/components/ShadowCaster2D.hpp"@@ -92,6 +93,7 @@ std::vector<std::string> editor_getComponentNames() {"Parent","ParticleEmitter","ParticleForceField",+ "ReflectionProbe","RigidBody2D","RigidBody3D","SegmentCollider2D",@@ -495,6 +497,15 @@ std::string editor_getComponentSchema(const std::string& name) {{"key":"falloff","type":"bool","group":"ParticleForceField"},{"key":"enabled","type":"bool","group":"ParticleForceField"}])JSON";+ } else if (name == "ReflectionProbe") {+ return R"JSON([+ {"key":"reflection","type":"asset","group":"ReflectionProbe"},+ {"key":"halfExtents.x","type":"float","group":"ReflectionProbe"},+ {"key":"halfExtents.y","type":"float","group":"ReflectionProbe"},+ {"key":"halfExtents.z","type":"float","group":"ReflectionProbe"},+ {"key":"slot","type":"int","group":"ReflectionProbe"},+ {"key":"enabled","type":"bool","group":"ReflectionProbe"}+ ])JSON";} else if (name == "RigidBody2D") {return R"JSON([{"key":"bodyType","type":"enum","group":"RigidBody2D","values":["Static","Kinematic","Dynamic"]},@@ -864,6 +875,9 @@ bool editor_addComponent(Registry& reg, u32 e, const std::string& name) {} else if (name == "ParticleForceField") {if (!reg.has<esengine::ecs::ParticleForceField>(entity)) reg.emplace<esengine::ecs::ParticleForceField>(entity);return true;+ } else if (name == "ReflectionProbe") {+ if (!reg.has<esengine::ecs::ReflectionProbe>(entity)) reg.emplace<esengine::ecs::ReflectionProbe>(entity);+ return true;} else if (name == "RigidBody2D") {if (!reg.has<esengine::ecs::RigidBody2D>(entity)) reg.emplace<esengine::ecs::RigidBody2D>(entity);return true;@@ -986,6 +1000,8 @@ bool editor_removeComponent(Registry& reg, u32 e, const std::string& name) {if (reg.has<esengine::ecs::ParticleEmitter>(entity)) { reg.remove<esengine::ecs::ParticleEmitter>(entity); return true; }} else if (name == "ParticleForceField") {if (reg.has<esengine::ecs::ParticleForceField>(entity)) { reg.remove<esengine::ecs::ParticleForceField>(entity); return true; }+ } else if (name == "ReflectionProbe") {+ if (reg.has<esengine::ecs::ReflectionProbe>(entity)) { reg.remove<esengine::ecs::ReflectionProbe>(entity); return true; }} else if (name == "RigidBody2D") {if (reg.has<esengine::ecs::RigidBody2D>(entity)) { reg.remove<esengine::ecs::RigidBody2D>(entity); return true; }} else if (name == "RigidBody3D") {@@ -1058,6 +1074,7 @@ bool editor_hasComponent(Registry& reg, u32 e, const std::string& name) {if (name == "Parent") return reg.has<esengine::ecs::Parent>(entity);if (name == "ParticleEmitter") return reg.has<esengine::ecs::ParticleEmitter>(entity);if (name == "ParticleForceField") return reg.has<esengine::ecs::ParticleForceField>(entity);+ if (name == "ReflectionProbe") return reg.has<esengine::ecs::ReflectionProbe>(entity);if (name == "RigidBody2D") return reg.has<esengine::ecs::RigidBody2D>(entity);if (name == "RigidBody3D") return reg.has<esengine::ecs::RigidBody3D>(entity);if (name == "SegmentCollider2D") return reg.has<esengine::ecs::SegmentCollider2D>(entity);@@ -1113,6 +1130,7 @@ std::vector<std::string> editor_getComponents(Registry& reg, u32 e) {if (reg.has<esengine::ecs::Parent>(entity)) result.push_back("Parent");if (reg.has<esengine::ecs::ParticleEmitter>(entity)) result.push_back("ParticleEmitter");if (reg.has<esengine::ecs::ParticleForceField>(entity)) result.push_back("ParticleForceField");+ if (reg.has<esengine::ecs::ReflectionProbe>(entity)) result.push_back("ReflectionProbe");if (reg.has<esengine::ecs::RigidBody2D>(entity)) result.push_back("RigidBody2D");if (reg.has<esengine::ecs::RigidBody3D>(entity)) result.push_back("RigidBody3D");if (reg.has<esengine::ecs::SegmentCollider2D>(entity)) result.push_back("SegmentCollider2D");@@ -1431,6 +1449,14 @@ bool editor_setFloat(Registry& reg, u32 e, const std::string& comp, const std::selse if (field == "direction.z") { c.direction.z = value; }else { return false; }return true;+ } else if (comp == "ReflectionProbe") {+ if (!reg.has<esengine::ecs::ReflectionProbe>(entity)) return false;+ auto& c = reg.get<esengine::ecs::ReflectionProbe>(entity);+ if (field == "halfExtents.x") { c.halfExtents.x = value; }+ else if (field == "halfExtents.y") { c.halfExtents.y = value; }+ else if (field == "halfExtents.z") { c.halfExtents.z = value; }+ else { return false; }+ return true;} else if (comp == "RigidBody2D") {if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return false;auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);@@ -1927,6 +1953,12 @@ f32 editor_getFloat(Registry& reg, u32 e, const std::string& comp, const std::stelse if (field == "direction.x") { return c.direction.x; }else if (field == "direction.y") { return c.direction.y; }else if (field == "direction.z") { return c.direction.z; }+ } else if (comp == "ReflectionProbe") {+ if (!reg.has<esengine::ecs::ReflectionProbe>(entity)) return 0.0f;+ const auto& c = reg.get<esengine::ecs::ReflectionProbe>(entity);+ if (field == "halfExtents.x") { return c.halfExtents.x; }+ else if (field == "halfExtents.y") { return c.halfExtents.y; }+ else if (field == "halfExtents.z") { return c.halfExtents.z; }} else if (comp == "RigidBody2D") {if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return 0.0f;const auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);@@ -2280,6 +2312,13 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::strif (field == "type") { c.type = static_cast<i32>(value); }else { return false; }return true;+ } else if (comp == "ReflectionProbe") {+ if (!reg.has<esengine::ecs::ReflectionProbe>(entity)) return false;+ auto& c = reg.get<esengine::ecs::ReflectionProbe>(entity);+ if (field == "reflection") { c.reflection = resource::EnvironmentHandle(static_cast<u32>(value)); }+ else if (field == "slot") { c.slot = static_cast<u32>(value); }+ else { return false; }+ return true;} else if (comp == "RigidBody2D") {if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return false;auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);@@ -2515,6 +2554,11 @@ i32 editor_getInt(Registry& reg, u32 e, const std::string& comp, const std::striif (!reg.has<esengine::ecs::ParticleForceField>(entity)) return 0;const auto& c = reg.get<esengine::ecs::ParticleForceField>(entity);if (field == "type") { return static_cast<i32>(c.type); }+ } else if (comp == "ReflectionProbe") {+ if (!reg.has<esengine::ecs::ReflectionProbe>(entity)) return 0;+ const auto& c = reg.get<esengine::ecs::ReflectionProbe>(entity);+ if (field == "reflection") { return static_cast<i32>(c.reflection.id()); }+ else if (field == "slot") { return static_cast<i32>(c.slot); }} else if (comp == "RigidBody2D") {if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return 0;const auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);@@ -2756,6 +2800,12 @@ bool editor_setBool(Registry& reg, u32 e, const std::string& comp, const std::stelse if (field == "enabled") { c.enabled = value; }else { return false; }return true;+ } else if (comp == "ReflectionProbe") {+ if (!reg.has<esengine::ecs::ReflectionProbe>(entity)) return false;+ auto& c = reg.get<esengine::ecs::ReflectionProbe>(entity);+ if (field == "enabled") { c.enabled = value; }+ else { return false; }+ return true;} else if (comp == "RigidBody2D") {if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return false;auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);@@ -2991,6 +3041,10 @@ bool editor_getBool(Registry& reg, u32 e, const std::string& comp, const std::stconst auto& c = reg.get<esengine::ecs::ParticleForceField>(entity);if (field == "falloff") { return c.falloff; }else if (field == "enabled") { return c.enabled; }+ } else if (comp == "ReflectionProbe") {+ if (!reg.has<esengine::ecs::ReflectionProbe>(entity)) return false;+ const auto& c = reg.get<esengine::ecs::ReflectionProbe>(entity);+ if (field == "enabled") { return c.enabled; }} else if (comp == "RigidBody2D") {if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return false;const auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);diff --git a/src/esengine/bindings/RendererBindings.cpp b/src/esengine/bindings/RendererBindings.cppindex 0321d8bb2..f01100ccf 100644--- a/src/esengine/bindings/RendererBindings.cpp+++ b/src/esengine/bindings/RendererBindings.cpp@@ -413,14 +413,14 @@ void mesh_release(u32 meshHandle) {* @param specularHandle The octahedral atlas, or 0 for a diffuse-only environment.*/u32 environment_create(uintptr_t shPtr, u32 specularHandle, f32 faceSize, u32 mipCount,- f32 maxRange) {+ f32 maxRange, u32 columns) {auto* rm = ctx().tryGet<resource::ResourceManager>();if (!rm) return 0;const f32* sh = boundarySpan<f32>(shPtr, 27, "environment_create.irradiance");if (!sh) return 0;return rm->createEnvironment(ConstSpan<f32>(sh, 27),resource::TextureHandle(specularHandle),- faceSize, mipCount, maxRange).id();+ faceSize, mipCount, maxRange, columns).id();}/** @brief Releases an environment. Its atlas is an ordinary texture and outlives it. */diff --git a/src/esengine/bindings/RendererBindings.hpp b/src/esengine/bindings/RendererBindings.hppindex 4fb550f6b..9ca475f3c 100644--- a/src/esengine/bindings/RendererBindings.hpp+++ b/src/esengine/bindings/RendererBindings.hpp@@ -95,9 +95,10 @@ u32 mesh_rematerializeFromChannels(u32 targetHandle,void mesh_release(u32 meshHandle);-/** @brief Registers a baked environment (27 irradiance floats + a reflection atlas). */+/** @brief Registers a baked environment (27 irradiance floats + a reflection atlas,+ * which holds `columns` pyramids side by side). */u32 environment_create(uintptr_t shPtr, u32 specularHandle, f32 faceSize, u32 mipCount,- f32 maxRange);+ f32 maxRange, u32 columns);/** @brief Releases an environment; its atlas is an ordinary texture and outlives it. */void environment_release(u32 environmentHandle);diff --git a/src/esengine/bindings/WebBindings.generated.cpp b/src/esengine/bindings/WebBindings.generated.cppindex 5b8f25003..34f797a74 100644--- a/src/esengine/bindings/WebBindings.generated.cpp+++ b/src/esengine/bindings/WebBindings.generated.cpp@@ -28,6 +28,7 @@#include "../ecs/components/Occluder.hpp"#include "../ecs/components/ParticleEmitter.hpp"#include "../ecs/components/ParticleForceField.hpp"+#include "../ecs/components/ReflectionProbe.hpp"#include "../ecs/components/RigidBody2D.hpp"#include "../ecs/components/RigidBody3D.hpp"#include "../ecs/components/ShadowCaster2D.hpp"@@ -1010,6 +1011,35 @@ ParticleEmitterJS particleemitterToJS(const esengine::ecs::ParticleEmitter& c) {return js;}+struct ReflectionProbeJS {+ u32 reflection;+ glm::vec3 halfExtents;+ u32 slot;+ bool enabled;+};++void reflectionprobeApplyJS(esengine::ecs::ReflectionProbe& c, const ReflectionProbeJS& js) {+ c.reflection = resource::EnvironmentHandle(js.reflection);+ c.halfExtents = js.halfExtents;+ c.slot = js.slot;+ c.enabled = js.enabled;+}++esengine::ecs::ReflectionProbe reflectionprobeFromJS(const ReflectionProbeJS& js) {+ esengine::ecs::ReflectionProbe c;+ reflectionprobeApplyJS(c, js);+ return c;+}++ReflectionProbeJS reflectionprobeToJS(const esengine::ecs::ReflectionProbe& c) {+ ReflectionProbeJS js;+ js.reflection = c.reflection.id();+ js.halfExtents = c.halfExtents;+ js.slot = c.slot;+ js.enabled = c.enabled;+ return js;+}+struct RigidBody2DJS {i32 bodyType;f32 gravityScale;@@ -1799,6 +1829,12 @@ EMSCRIPTEN_BINDINGS(esengine_components) {.field("falloff", &esengine::ecs::ParticleForceField::falloff).field("enabled", &esengine::ecs::ParticleForceField::enabled);+ value_object<ReflectionProbeJS>("ReflectionProbe")+ .field("reflection", &ReflectionProbeJS::reflection)+ .field("halfExtents", &ReflectionProbeJS::halfExtents)+ .field("slot", &ReflectionProbeJS::slot)+ .field("enabled", &ReflectionProbeJS::enabled);+value_object<RigidBody2DJS>("RigidBody2D").field("bodyType", &RigidBody2DJS::bodyType).field("gravityScale", &RigidBody2DJS::gravityScale)@@ -2627,6 +2663,30 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {r.remove<esengine::ecs::ParticleForceField>(entity);}))+ // ReflectionProbe+ .function("hasReflectionProbe", optional_override([](Registry& r, u32 e) {+ return r.has<esengine::ecs::ReflectionProbe>(static_cast<Entity>(e));+ }))+ .function("getReflectionProbe", optional_override([](Registry& r, u32 e) {+ auto entity = static_cast<Entity>(e);+ if (!r.valid(entity) || !r.has<esengine::ecs::ReflectionProbe>(entity)) return ReflectionProbeJS{};+ return reflectionprobeToJS(r.get<esengine::ecs::ReflectionProbe>(entity));+ }))+ .function("addReflectionProbe", optional_override([](Registry& r, u32 e, const ReflectionProbeJS& js) {+ auto entity = static_cast<Entity>(e);+ if (!r.valid(entity)) return;+ if (auto* existing = r.tryGet<esengine::ecs::ReflectionProbe>(entity)) {+ reflectionprobeApplyJS(*existing, js);+ return;+ }+ r.emplaceOrReplace<esengine::ecs::ReflectionProbe>(entity, reflectionprobeFromJS(js));+ }))+ .function("removeReflectionProbe", optional_override([](Registry& r, u32 e) {+ auto entity = static_cast<Entity>(e);+ if (!r.valid(entity) || !r.has<esengine::ecs::ReflectionProbe>(entity)) return;+ r.remove<esengine::ecs::ReflectionProbe>(entity);+ }))+// RigidBody2D.function("hasRigidBody2D", optional_override([](Registry& r, u32 e) {return r.has<esengine::ecs::RigidBody2D>(static_cast<Entity>(e));@@ -3101,6 +3161,7 @@ emscripten::val esengineGetBuiltinComponentNames() {arr.set(i++, val(std::string("Parent")));arr.set(i++, val(std::string("ParticleEmitter")));arr.set(i++, val(std::string("ParticleForceField")));+ arr.set(i++, val(std::string("ReflectionProbe")));arr.set(i++, val(std::string("RigidBody2D")));arr.set(i++, val(std::string("RigidBody3D")));arr.set(i++, val(std::string("SegmentCollider2D")));@@ -3364,6 +3425,10 @@ static_assert(offsetof(esengine::ecs::ParticleForceField, radius) == 8, "ABI offstatic_assert(offsetof(esengine::ecs::ParticleForceField, direction) == 12, "ABI offset drift: esengine::ecs::ParticleForceField.direction (EHT expected 12)");static_assert(offsetof(esengine::ecs::ParticleForceField, falloff) == 24, "ABI offset drift: esengine::ecs::ParticleForceField.falloff (EHT expected 24)");static_assert(offsetof(esengine::ecs::ParticleForceField, enabled) == 25, "ABI offset drift: esengine::ecs::ParticleForceField.enabled (EHT expected 25)");+static_assert(offsetof(esengine::ecs::ReflectionProbe, reflection) == 0, "ABI offset drift: esengine::ecs::ReflectionProbe.reflection (EHT expected 0)");+static_assert(offsetof(esengine::ecs::ReflectionProbe, halfExtents) == 4, "ABI offset drift: esengine::ecs::ReflectionProbe.halfExtents (EHT expected 4)");+static_assert(offsetof(esengine::ecs::ReflectionProbe, slot) == 16, "ABI offset drift: esengine::ecs::ReflectionProbe.slot (EHT expected 16)");+static_assert(offsetof(esengine::ecs::ReflectionProbe, enabled) == 20, "ABI offset drift: esengine::ecs::ReflectionProbe.enabled (EHT expected 20)");static_assert(offsetof(esengine::ecs::RigidBody2D, bodyType) == 0, "ABI offset drift: esengine::ecs::RigidBody2D.bodyType (EHT expected 0)");static_assert(offsetof(esengine::ecs::RigidBody2D, gravityScale) == 4, "ABI offset drift: esengine::ecs::RigidBody2D.gravityScale (EHT expected 4)");static_assert(offsetof(esengine::ecs::RigidBody2D, linearDamping) == 8, "ABI offset drift: esengine::ecs::RigidBody2D.linearDamping (EHT expected 8)");@@ -3526,7 +3591,7 @@ static_assert(offsetof(esengine::ecs::Velocity, angular) == 12, "ABI offset drif// ABI Hash -- runtime handshake against the SDK bundle// =============================================================================-static const char* kEsAbiLayoutHash = "8ef437d46a35780d";+static const char* kEsAbiLayoutHash = "10bb7593c5d041c3";std::string esengineGetAbiLayoutHash() {return std::string(kEsAbiLayoutHash);diff --git a/src/esengine/ecs/components/ReflectionProbe.hpp b/src/esengine/ecs/components/ReflectionProbe.hppnew file mode 100644index 000000000..3c7b24b43--- /dev/null+++ b/src/esengine/ecs/components/ReflectionProbe.hpp@@ -0,0 +1,57 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file ReflectionProbe.hpp+ * @brief What a shiny surface standing HERE reflects, when the sky is not it.+ * LightProbeVolume answers the same question for the diffuse half.+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the Apache License, Version 2.0.+ */+#pragma once++#include "../../core/Types.hpp"+#include "../../core/Reflection.hpp"+#include "../../resource/Handle.hpp"++#include <glm/glm.hpp>++namespace esengine::ecs {++/**+ * @brief A box inside which reflections come from a bake rather than from the sky.+ *+ * @details The atlas is the SCENE's and this says which column is here, which is+ * what lets a room full of shiny things still merge into one draw.+ * Axis-aligned about the entity, like LightProbeVolume: the box is what+ * a reflection is PROJECTED onto, and a turned one costs a pixel more.+ */+ES_COMPONENT(stability=beta)+struct ReflectionProbe {+ /** @brief The scene's baked reflections — an `.esenv` whose atlas holds a+ * column per probe. The baker writes it; invalid means nothing is+ * baked yet, and what stands here reflects the sky as before. */+ ES_PROPERTY(asset = environment, tooltip="The scene's baked reflections (the baker writes this).")+ resource::EnvironmentHandle reflection;++ /** @brief Half the box this probe answers inside, in world units. */+ ES_PROPERTY(min=0, tooltip="Half the box this probe answers inside, from the entity's position.")+ glm::vec3 halfExtents{200.0f, 200.0f, 200.0f};++ /** @brief Which column of the atlas holds it. Column 0 is the environment —+ * what a surface outside every probe reflects — so a probe's own is+ * 1 or more, and 0 reads as "not baked yet". */+ ES_PROPERTY(min=0, advanced, tooltip="Which column of the atlas this probe occupies (the baker writes this).")+ u32 slot{0};++ /** @brief Disabled probes are skipped, and what stands inside reflects the sky. */+ ES_PROPERTY(tooltip="Off: what stands inside this box reflects the sky again.")+ bool enabled{true};++ ReflectionProbe() = default;+};++} // namespace esengine::ecsdiff --git a/src/esengine/renderer/draw/DrawList.cpp b/src/esengine/renderer/draw/DrawList.cppindex b2fd308c5..37ff6e0d7 100644--- a/src/esengine/renderer/draw/DrawList.cpp+++ b/src/esengine/renderer/draw/DrawList.cpp@@ -282,7 +282,7 @@ void DrawList::execute(GfxDevice& device, TransientBufferPool& buffers,const u32 index = at < probe_slots_.size() ? probe_slots_[at] : 0u;if (index == 0) continue;std::memcpy(&probe_run_[static_cast<size_t>(n) * PROBE_TEXELS],- probes_[index - 1].irradiance, sizeof(ProbeConstants));+ &probes_[index - 1], sizeof(ProbeConstants));}device.setUniformBuffer(PROBE_CONSTANTS_BINDING,diff --git a/src/esengine/renderer/frame/RenderContext.hpp b/src/esengine/renderer/frame/RenderContext.hppindex f2f689ed6..0d7ca550e 100644--- a/src/esengine/renderer/frame/RenderContext.hpp+++ b/src/esengine/renderer/frame/RenderContext.hpp@@ -24,6 +24,7 @@#include "../rhi/GfxEnums.hpp"#include "../store/LightStore.hpp"#include "../store/ProbeStore.hpp"+#include "../store/ReflectionStore.hpp"#include "../rhi/PerDrawBlocks.hpp"#include "../store/MaterialStore.hpp"#include "../rhi/Shader.hpp"@@ -200,6 +201,11 @@ public:ProbeStore& probes() { return probes_; }const ProbeStore& probes() const { return probes_; }+ /** @brief The frame's reflection probes — the same question about the half of+ * the environment a surface MIRRORS rather than scatters. */+ ReflectionStore& reflections() { return reflections_; }+ const ReflectionStore& reflections() const { return reflections_; }+private:void initDefaultTextures();TextureHandle make1x1Texture(u32 rgba);@@ -242,6 +248,7 @@ private:MaterialStore materials_;LightStore lights_;ProbeStore probes_;+ ReflectionStore reflections_;GfxDevice& device_;bool initialized_ = false;diff --git a/src/esengine/renderer/frame/RenderFrame.cpp b/src/esengine/renderer/frame/RenderFrame.cppindex 8fb55f738..5b594d575 100644--- a/src/esengine/renderer/frame/RenderFrame.cpp+++ b/src/esengine/renderer/frame/RenderFrame.cpp@@ -9,6 +9,7 @@#include "../../ecs/components/Transform.hpp"#include "../../ecs/components/Light.hpp"#include "../../ecs/components/Occluder.hpp"+#include "../../ecs/components/ReflectionProbe.hpp"#include "../../ecs/components/ShadowCaster2D.hpp"#include "../../ecs/components/SortingGroup.hpp"#include "../../ecs/components/SpriteMask.hpp"@@ -549,6 +550,7 @@ void RenderFrame::flush() {// authored to nothing — reads zero boxes here while render.culled says nothing.ES_PROFILE_COUNTER("render.cull.occluded", stats_.occluded);ES_PROFILE_COUNTER("render.cull.occluders", occlusion_.boxes());+ ES_PROFILE_COUNTER("render.reflection.probes", context_.reflections().count());ES_PROFILE_COUNTER("render.sprites", stats_.sprites);// The 3D path had no counter at all, and its cost is the one a pixel hides// best: identical geometry drawn N times merges into ONE instanced call, so@@ -1165,6 +1167,54 @@ void RenderFrame::collectOccluders(ecs::Registry& registry) {occlusion_.finish();}+/**+ * @brief Gathers the frame's reflection probes: a box each, and the atlas column+ * the bake gave it.+ *+ * @details After the lights, because it OVERRIDES what they bound: a baked scene+ * reflects its bake, whose column 0 is the sky it was solved under. The+ * irradiance stays the ambient light's — an atlas is the other half.+ */+void RenderFrame::collectReflections(ecs::Registry& registry) {+ ReflectionStore& store = context_.reflections();+ store.clear();++ auto view = registry.view<ecs::ReflectionProbe>();+ for (auto entity : view) {+ const auto& probe = view.get(entity);+ if (!probe.enabled || !probe.reflection.isValid()) continue;+ const auto* transform = registry.tryGet<ecs::Transform>(entity);+ if (!transform) continue;+ const glm::vec3 centre = glm::vec3(transform->worldPosition);+ const glm::vec3 half = glm::abs(probe.halfExtents);+ store.add(centre - half, centre + half, probe.slot, probe.reflection.id());+ }+ if (store.empty()) return;++ const Environment* baked =+ resource_manager_.getEnvironment(resource::EnvironmentHandle(store.environment()));+ if (!baked || !baked->hasSpecular()) return;+ Texture* atlas = resource_manager_.getTexture(baked->specular);+ if (!atlas) return;++ // Boxes by COLUMN and not in the order the registry walked them: the shader+ // indexes by the number written on the probe, and a frame that packed them+ // tightly would project one room's reflection onto another's walls.+ glm::vec4 boxes[2 * MAX_REFLECTION_PROBES]{};+ u32 highest = 0;+ for (const ReflectionStore::Probe& probe : store.probes()) {+ const u32 at = (probe.slot - 1) * 2;+ boxes[at] = glm::vec4(probe.min, 0.0f);+ boxes[at + 1] = glm::vec4(probe.max, 0.0f);+ highest = std::max(highest, probe.slot);+ }+ environment_texture_id_ = atlas->getId();+ context_.lights().setReflections(+ glm::vec4(1.0f, baked->maxRange, static_cast<f32>(baked->mipCount) - 1.0f,+ baked->faceSize),+ boxes, highest);+}+void RenderFrame::collectLights(ecs::Registry& registry) {LightStore& lights = context_.lights();lights.clear();@@ -1879,6 +1929,9 @@ void RenderFrame::collectAll(ecs::Registry& registry) {// Beside the lights and for the same reason: this answers what reaches a point// that no light can be asked about, and the mesh collect below reads both.{ ES_PROFILE_SCOPE("render.collect.probes"); collectProbes(registry); }+ // After the lights: what a bake says a surface MIRRORS replaces what the+ // ambient light's own environment would have answered.+ { ES_PROFILE_SCOPE("render.collect.reflections"); collectReflections(registry); }// Before the plugins and after nothing: it reads the scene and this camera's// projection, both of which are already settled when the collect opens.{ ES_PROFILE_SCOPE("render.collect.occluders"); collectOccluders(registry); }diff --git a/src/esengine/renderer/frame/RenderFrame.hpp b/src/esengine/renderer/frame/RenderFrame.hppindex 4e0ebc21e..45b9daab8 100644--- a/src/esengine/renderer/frame/RenderFrame.hpp+++ b/src/esengine/renderer/frame/RenderFrame.hpp@@ -596,6 +596,9 @@ private:*/void collectOccluders(ecs::Registry& registry);+ /** @brief Gathers the scene's reflection probes and binds the atlas they name. */+ void collectReflections(ecs::Registry& registry);+/// Makes this ambient light the frame's environment, when it names one that is/// loaded. `scale` is the light's colour times its intensity, folded into the/// coefficients — an environment is what the light casts, not a second source.diff --git a/src/esengine/renderer/plugins/MeshPlugin.cpp b/src/esengine/renderer/plugins/MeshPlugin.cppindex 2560053d5..8ce6e5264 100644--- a/src/esengine/renderer/plugins/MeshPlugin.cpp+++ b/src/esengine/renderer/plugins/MeshPlugin.cpp@@ -725,14 +725,16 @@ void MeshPlugin::collect(RenderCollectContext& collect_ctx) {}}- // A draw reading its own atlas does not ask: the bake holds the- // bounces that reached those texels. The ENTITY's position, not its- // vertices' — bones place a skinned mesh, a Transform says where.- if (!shadowDepth && key.lightmapTextureId == 0) {+ // A draw reading its own atlas does not ask for IRRADIANCE, and asks+ // for its reflection either way — a lightmapped wall mirrors the room+ // like anything else. At the ENTITY's position: bones place a skin.+ if (!shadowDepth) {ProbeConstants probe;- if (ctx.render_context.probes().sample(position, probe)) {- key.probeIndex = draw_list.addProbe(probe);- }+ const bool volume = key.lightmapTextureId == 0+ && ctx.render_context.probes().sample(position, probe);+ const u32 slot = ctx.render_context.reflections().slotAt(position);+ probe.reflection.x = static_cast<f32>(slot);+ if (volume || slot != 0) key.probeIndex = draw_list.addProbe(probe);}// A material's default program is built for the BATCH vertexdiff --git a/src/esengine/renderer/store/LightConstants.hpp b/src/esengine/renderer/store/LightConstants.hppindex 8f87ec3c9..339e86357 100644--- a/src/esengine/renderer/store/LightConstants.hpp+++ b/src/esengine/renderer/store/LightConstants.hpp@@ -110,6 +110,14 @@ inline constexpr u32 SHADOW_CUBE_FACES = 6;*/inline constexpr u32 MAX_SHADOW_TILES = 16;+/**+ * @brief Columns of the reflection atlas one frame can address — column 0 the+ * environment's, so fifteen probes and a sky.+ * @details Here rather than with the store that fills them: what bounds it is the+ * array in the block below, a box per column.+ */+inline constexpr u32 MAX_REFLECTION_PROBES = 15;+/*** @brief One 2D light, std140-packed (six vec4s, 96 bytes, 16-aligned).* @details Every lane is spoken for; each field says which. An Ambient light occupies no@@ -174,12 +182,21 @@ struct LightConstants {/// of the environment. Kept out of the coefficients so the reflection — sampled/// from a texture the light does not own — is tinted by the same number.glm::vec4 envTint{0.0f};+ /// x = how many COLUMNS the bound atlas holds, the environment's included, so+ /// one texture serves the sky and every baked room; y/z/w unused. One is the+ /// environment alone, which is what a scene with no bake has always been.+ glm::vec4 reflParams{1.0f, 0.0f, 0.0f, 0.0f};+ /// The world box column i answers inside: [2i] = min, [2i+1] = max. Column 0+ /// is the environment and has none — a sky is not somewhere. The shader+ /// PROJECTS onto a box, which is what slides a reflection across a wall.+ glm::vec4 reflBox[2 * MAX_REFLECTION_PROBES]{};};static_assert(sizeof(GpuLight) == 96, "GpuLight must be std140-tight (six vec4s)");static_assert(sizeof(LightConstants) == 16 + 96 * MAX_LIGHTS + 16+ 64 * MAX_SHADOW_TILES + 16 * MAX_SHADOW_TILES- + 16 + 16 * 9 + 16 + 16,+ + 16 + 16 * 9 + 16 + 16+ + 16 + 32 * MAX_REFLECTION_PROBES,"LightConstants must match the std140 GLSL block layout");} // namespace esenginediff --git a/src/esengine/renderer/store/LightStore.hpp b/src/esengine/renderer/store/LightStore.hppindex eddae969d..5f8dbcb00 100644--- a/src/esengine/renderer/store/LightStore.hpp+++ b/src/esengine/renderer/store/LightStore.hpp@@ -111,6 +111,23 @@ public:bool hasEnvironment() const { return hasEnvironment_; }+ /**+ * @brief Points the frame at a BAKED atlas: its format, and a box per column.+ *+ * @details Overwrites `envParams` because the atlas the frame binds is this+ * one — the columns past 0 are the scene's rooms, and column 0 is the+ * sky as the bake saw it. The irradiance and the tint stay the ambient+ * light's: the diffuse half is not what a reflection atlas holds.+ */+ void setReflections(const glm::vec4& params, const glm::vec4* boxes, u32 count) {+ data_.envParams = params;+ data_.reflParams = glm::vec4(static_cast<f32>(count) + 1.0f, 0.0f, 0.0f, 0.0f);+ for (u32 i = 0; i < count * 2 && i < 2 * MAX_REFLECTION_PROBES; ++i) {+ data_.reflBox[i] = boxes[i];+ }+ dirty_ = true;+ }+/// Gives light @p slot a channel of the frame's 2D shadow mask, and says the mask/// exists. A slot nobody names keeps the -1 it was collected with, which is a light/// that lights without shadowing.diff --git a/src/esengine/renderer/store/ProbeConstants.hpp b/src/esengine/renderer/store/ProbeConstants.hppindex fbe061825..3474694bd 100644--- a/src/esengine/renderer/store/ProbeConstants.hpp+++ b/src/esengine/renderer/store/ProbeConstants.hpp@@ -31,25 +31,29 @@ inline constexpr const char* PROBE_CONSTANTS_BLOCK = "ProbeConstants";/*** @brief How many instances of one merged draw carry their own irradiance.*- * @details The coefficients ride the draw's uniform block, one run of nine vec4- * per instance, so 100 runs is 14.4KB — inside the 16KB a WebGL2- * uniform block is guaranteed. A run reaching this many stops merging- * rather than drawing someone else's light.+ * @details It rides the draw's uniform block, one run of ten vec4 per instance,+ * so 100 runs is 16000 bytes — inside the 16KB a WebGL2 uniform block is+ * guaranteed. A run reaching this many stops merging rather than drawing+ * someone else's light.*/inline constexpr u32 PROBE_MAX_INSTANCES = 100;-/// Texels one probe's coefficients occupy in that block.-inline constexpr u32 PROBE_TEXELS = 9;+/// Texels one instance's indirect light occupies in that block.+inline constexpr u32 PROBE_TEXELS = 10;-/** @brief One probe's coefficients, as the CPU gathers them before packing. */+/** @brief The indirect light one instance stands in — both halves of it. */struct ProbeConstants {/// SH9, rgb in xyz. `[0].w` is 1 where this draw stands in a volume — a flag/// and not the absence of coefficients, since zeroes ARE an answer here: a/// probe in the dark.glm::vec4 irradiance[9]{};+ /// x = which column of the frame's reflection atlas this instance reflects.+ /// 0 is the environment, so an instance inside no probe needs nothing written+ /// here and a zeroed run is already right.+ glm::vec4 reflection{0.0f};};-static_assert(sizeof(ProbeConstants) == 16 * 9,+static_assert(sizeof(ProbeConstants) == 16 * PROBE_TEXELS,"ProbeConstants must be a tight array of vec4 to match std140");} // namespace esenginediff --git a/src/esengine/renderer/store/ReflectionStore.hpp b/src/esengine/renderer/store/ReflectionStore.hppnew file mode 100644index 000000000..6bf345a8a--- /dev/null+++ b/src/esengine/renderer/store/ReflectionStore.hpp@@ -0,0 +1,94 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file ReflectionStore.hpp+ * @brief Which baked reflection a point stands in — the specular half of the+ * question ProbeStore answers for irradiance.+ *+ * @details The frame's ReflectionProbe components as boxes plus the column each+ * one owns in the scene's atlas. Filled during collection and read+ * during it; nothing here outlives the frame that gathered it.+ *+ * ONE atlas per frame, and the environment is column 0 of it. That is+ * what keeps a reflection a per-instance number instead of a per-draw+ * texture bind — a bind is what stopped a hundred objects in a room+ * from merging into one draw.+ */+#pragma once++#include "../../core/Types.hpp"+#include "./LightConstants.hpp"++#include <glm/glm.hpp>+#include <vector>++namespace esengine {++/** @brief The frame's reflection probes, and the lookup that picks one. */+class ReflectionStore {+public:+ /** @brief One probe: the world box it answers inside, and its atlas column. */+ struct Probe {+ glm::vec3 min{0.0f};+ glm::vec3 max{0.0f};+ u32 slot = 0;+ };++ void clear() {+ probes_.clear();+ environment_ = 0;+ }++ /**+ * @brief Takes a probe, or refuses one nothing can read.+ *+ * @details A probe past the last addressable column is DROPPED rather than+ * clamped into another probe's: clamping would light a room with the+ * reflection of whichever room happened to be baked at that number.+ */+ bool add(const glm::vec3& min, const glm::vec3& max, u32 slot, u32 environment) {+ if (environment == 0 || slot == 0 || slot >= MAX_REFLECTION_PROBES) return false;+ if (max.x <= min.x || max.y <= min.y || max.z <= min.z) return false;+ // One bake for the frame: the first taken decides it, and a probe naming+ // another is from a bake this scene is no longer showing.+ if (environment_ == 0) environment_ = environment;+ else if (environment_ != environment) return false;+ probes_.push_back({min, max, slot});+ return true;+ }++ bool empty() const { return probes_.empty(); }+ u32 count() const { return static_cast<u32>(probes_.size()); }++ /** @brief The baked environment every probe of this frame reads, or 0. */+ u32 environment() const { return environment_; }++ /**+ * @brief The column a point at @p p reflects, or 0 for the environment.+ *+ * @details Where two probes overlap the SMALLER wins, the rule ProbeStore+ * takes: a cupboard inside a hall was baked to say what the hall's+ * probe could not.+ */+ u32 slotAt(const glm::vec3& p) const {+ const Probe* best = nullptr;+ f32 bestSize = 0.0f;+ for (const Probe& v : probes_) {+ if (p.x < v.min.x || p.x > v.max.x || p.y < v.min.y || p.y > v.max.y+ || p.z < v.min.z || p.z > v.max.z) continue;+ const glm::vec3 e = v.max - v.min;+ const f32 size = e.x * e.y * e.z;+ if (!best || size < bestSize) { best = &v; bestSize = size; }+ }+ return best ? best->slot : 0u;+ }++ /** @brief The probes themselves, for the frame block that carries their boxes. */+ const std::vector<Probe>& probes() const { return probes_; }++private:+ std::vector<Probe> probes_;+ u32 environment_ = 0;+};++} // namespace esenginediff --git a/src/esengine/resource/Environment.hpp b/src/esengine/resource/Environment.hppindex 0a87e2792..57481918f 100644--- a/src/esengine/resource/Environment.hpp+++ b/src/esengine/resource/Environment.hpp@@ -34,6 +34,12 @@ public:/** RGBM decode range: `(rgb*a)^2 * maxRange` is the stored radiance. */f32 maxRange = 0.0f;+ /** @brief How many octahedral pyramids stand side by side in the atlas.+ * @details One for a sky imported from a panorama. A scene's BAKE writes+ * several — column 0 the sky it was baked under, the rest a+ * reflection probe each — so one bound texture serves them all. */+ u32 columns = 1;+bool hasSpecular() const { return specular.isValid() && mipCount > 0 && faceSize > 0.0f; }};diff --git a/src/esengine/resource/ResourceManager.cpp b/src/esengine/resource/ResourceManager.cppindex 45edc004a..8e9b39b58 100644--- a/src/esengine/resource/ResourceManager.cpp+++ b/src/esengine/resource/ResourceManager.cpp@@ -21,6 +21,7 @@#include "../renderer/rhi/Texture.hpp"#include "../renderer/rhi/Buffer.hpp"+#include <algorithm>#include <cstring>#include <vector>@@ -779,7 +780,7 @@ void ResourceManager::releaseMesh(MeshHandle handle) {EnvironmentHandle ResourceManager::createEnvironment(ConstSpan<f32> irradiance,TextureHandle specular, f32 faceSize,- u32 mipCount, f32 maxRange) {+ u32 mipCount, f32 maxRange, u32 columns) {if (irradiance.size() != 27) {ES_LOG_ERROR("createEnvironment: {} coefficients, want 27", irradiance.size());return EnvironmentHandle();@@ -793,6 +794,7 @@ EnvironmentHandle ResourceManager::createEnvironment(ConstSpan<f32> irradiance,environment->faceSize = faceSize;environment->mipCount = mipCount;environment->maxRange = maxRange;+ environment->columns = std::max(columns, 1u);return environments_.add(std::move(environment));}diff --git a/src/esengine/resource/ResourceManager.hpp b/src/esengine/resource/ResourceManager.hppindex 80ee0609f..03eee8e15 100644--- a/src/esengine/resource/ResourceManager.hpp+++ b/src/esengine/resource/ResourceManager.hpp@@ -542,7 +542,8 @@ public:* @return Handle to the environment, or invalid when the coefficients are not nine.*/EnvironmentHandle createEnvironment(ConstSpan<f32> irradiance, TextureHandle specular,- f32 faceSize, u32 mipCount, f32 maxRange);+ f32 faceSize, u32 mipCount, f32 maxRange,+ u32 columns = 1);/** @brief The environment a handle names, or null. */Environment* getEnvironment(EnvironmentHandle handle);diff --git a/src/esengine/resource/ShaderParser.cpp b/src/esengine/resource/ShaderParser.cppindex 01b6dd042..76c49b68e 100644--- a/src/esengine/resource/ShaderParser.cpp+++ b/src/esengine/resource/ShaderParser.cpp@@ -1025,9 +1025,11 @@ struct LightConstants {u_envIrradiance : array<vec4f, 9>,u_envParams : vec4f,u_envTint : vec4f,+ u_reflParams : vec4f,+ u_reflBox : array<vec4f, 30>,};@group(0) @binding(2) var<uniform> lc : LightConstants;-struct ProbeConstants { u_probeIrradiance : array<vec4f, 900> };+struct ProbeConstants { u_probeIrradiance : array<vec4f, 1000> };@group(0) @binding(7) var<uniform> pc : ProbeConstants;// Which run of that block this fragment's instance reads. WGSL has no module// varying, so the entry point hands it over — the GLSL twin reads the varying@@ -1279,7 +1281,7 @@ fn envIrradiance(Nw : vec3f) -> vec3f {// surface has one indirect term and a volume already holds every light and bounce// that reached the point.fn indirectIrradiance(N : vec3f) -> vec3f {- let base = i32(g_probeSlot) * 9;+ let base = clamp(i32(g_probeSlot), 0, 99) * 10;if (pc.u_probeIrradiance[base].w > 0.5) {var sh : array<vec4f, 9>;for (var i = 0; i < 9; i = i + 1) { sh[i] = pc.u_probeIrradiance[base + i]; }@@ -1287,6 +1289,13 @@ fn indirectIrradiance(N : vec3f) -> vec3f {}return envIrradiance(N);}+// Which column of the atlas this instance reflects, from the run its own index+// names. Zero — an instance inside no probe, or a draw that carries no run at all+// — is the environment, which is what every surface reflected before probes.+fn reflectionColumn() -> f32 {+ let base = clamp(i32(g_probeSlot), 0, 99) * 10;+ return pc.u_probeIrradiance[base + 9].x;+}fn octEncode(d : vec3f) -> vec2f {var p = d.xz / max(abs(d.x) + abs(d.y) + abs(d.z), 1e-6);if (d.y < 0.0) {@@ -1295,28 +1304,59 @@ fn octEncode(d : vec3f) -> vec2f {}return p * 0.5 + 0.5;}-fn envSampleMip(R : vec3f, mip : f32) -> vec3f {+fn envSampleColumn(R : vec3f, mip : f32, column : f32) -> vec3f {#ifndef ES_ENV_MAPreturn vec3f(0.0);#elselet face = lc.u_envParams.w;let size = face * exp2(-mip);let yOff = 2.0 * face * (1.0 - exp2(-mip)) + 2.0 * mip;- let atlasW = face + 2.0;+ let col = face + 2.0;+ let atlasW = col * lc.u_reflParams.x;let atlasH = 2.0 * face * (1.0 - exp2(-(lc.u_envParams.z + 1.0)))+ 2.0 * (lc.u_envParams.z + 1.0);- let uv = octEncode(envDirection(R));- let px = vec2f(1.0 + uv.x * size, yOff + 1.0 + uv.y * size);+ // The sky turns with the environment; a baked column does not — it was solved+ // in world space, and turning it would spin a room about its own middle.+ let uv = octEncode(select(R, envDirection(R), column < 0.5));+ // Kept inside this column's own face, border ring included: a tap that leaves+ // it reads whatever the sampler's wrap mode says, and the two backends do not+ // answer that alike — one repeats to the far edge, the other clamps.+ let lo2 = vec2f(column * col + 0.5, yOff + 0.5);+ let hi2 = vec2f(column * col + size + 1.5, yOff + size + 1.5);+ let px = clamp(vec2f(column * col + 1.0 + uv.x * size, yOff + 1.0 + uv.y * size), lo2, hi2);let t = textureSampleLevel(t3, s3, px / vec2f(atlasW, atlasH), 0.0);return t.rgb * t.rgb * (t.a * t.a * lc.u_envParams.y);#endif}-fn envRadiance(R : vec3f, roughness : f32) -> vec3f {+fn envSampleMip(R : vec3f, mip : f32) -> vec3f { return envSampleColumn(R, mip, 0.0); }+// Where the reflected ray LEAVES this column's box, aimed from there rather than+// from infinitely far: what makes a reflection slide across a wall as the eye moves+// instead of being painted onto it.+fn reflectionDirection(R : vec3f, P : vec3f, column : f32) -> vec3f {+ if (column < 0.5) { return R; }+ let i = i32(column) * 2 - 2;+ let lo = lc.u_reflBox[i].xyz;+ let hi = lc.u_reflBox[i + 1].xyz;+ // Never zero, so a ray parallel to a face divides to an infinity the min+ // discards rather than to the NaN that would blacken the pixel.+ let d = max(abs(R), vec3f(1e-6)) * (step(vec3f(0.0), R) * 2.0 - vec3f(1.0));+ let t = min(min(max((hi.x - P.x) / d.x, (lo.x - P.x) / d.x),+ max((hi.y - P.y) / d.y, (lo.y - P.y) / d.y)),+ max((hi.z - P.z) / d.z, (lo.z - P.z) / d.z));+ if (!(t > 0.0)) { return R; }+ return (P + R * t) - (lo + hi) * 0.5;+}+fn envRadiance(R : vec3f, roughness : f32, column : f32, P : vec3f) -> vec3f {if (lc.u_envParams.x < 0.5) { return lc.u_ambient.rgb; }+ let dir = reflectionDirection(R, P, column);let lod = clamp(roughness, 0.0, 1.0) * lc.u_envParams.z;let lo = floor(lod);- let a = envSampleMip(R, lo);- let b = envSampleMip(R, min(lo + 1.0, lc.u_envParams.z));+ let a = envSampleColumn(dir, lo, column);+ let b = envSampleColumn(dir, min(lo + 1.0, lc.u_envParams.z), column);+ // A baked column is the WHOLE radiance that reached its probe — the sky, the+ // ambient and every bounce. Adding the flat term or the sky's tint on top+ // would count the light the capture already saw a second time.+ if (column >= 0.5) { return mix(a, b, lod - lo); }return lc.u_ambient.rgb + mix(a, b, lod - lo) * lc.u_envTint.rgb;}// Which definition of "where is the light" this surface is shaded with. One with a@@ -1420,7 +1460,7 @@ fn applyLightingPBR(albedo : vec3f, N : vec3f, worldPos : vec3f, V : vec3f, meta}}let ab = envBRDFApprox(NdotV, roughness);- gloss += envRadiance(reflect(-V, N), roughness) * (ao * specular)+ gloss += envRadiance(reflect(-V, N), roughness, reflectionColumn(), worldPos) * (ao * specular)* (F0 * ab.x + vec3f(ab.y));return albedo * (1.0 - metallic) * lit + gloss;}@@ -1781,12 +1821,14 @@ ShaderParser::AssembledStage ShaderParser::assembleStageEx(const ParsedShader& p" highp vec4 u_envIrradiance[9];\n" // SH9, rgb in xyz; zero = no environment" highp vec4 u_envParams;\n" // x = has map, y = range, z = maxLod, w = face" highp vec4 u_envTint;\n" // the ambient light's colour, scaling both halves+ " highp vec4 u_reflParams;\n" // x = columns in the bound atlas (1 = sky only)+ " highp vec4 u_reflBox[30];\n" // [2i] = column i+1's world min, [2i+1] its max"};\n"// One run of nine per INSTANCE, not one for the draw: a merged draw// holds objects standing in many places. The flag in w tells "no// volume" from "a probe in the dark"."layout(std140) uniform ProbeConstants {\n"- " highp vec4 u_probeIrradiance[9 * 100];\n"+ " highp vec4 u_probeIrradiance[10 * 100];\n""};\n""flat in highp float v_probeSlot;\n"// The shadow map rides the draw's third texture slot, behind the feature the@@ -2065,8 +2107,13 @@ ShaderParser::AssembledStage ShaderParser::assembleStageEx(const ParsedShader& p// The indirect term every lit surface starts from. A volume REPLACES the// environment rather than adding to it — a surface has one indirect term// — and its nine are world-space, so neither rotation nor tint applies.+ "highp int probeRun() { return clamp(int(v_probeSlot), 0, 99) * 10; }\n"+ // Which column of the atlas this instance reflects. Zero — inside no probe,+ // or a draw carrying no run at all — is the environment, which is what every+ // surface reflected before there were probes.+ "highp float reflectionColumn() { return u_probeIrradiance[probeRun() + 9].x; }\n""highp vec3 indirectIrradiance(in highp vec3 N) {\n"- " highp int base = clamp(int(v_probeSlot), 0, 99) * 9;\n"+ " highp int base = probeRun();\n"" if (u_probeIrradiance[base].w > 0.5) {\n"" highp vec4 sh[9];\n"" for (int i = 0; i < 9; i++) sh[i] = u_probeIrradiance[base + i];\n"@@ -2086,30 +2133,66 @@ ShaderParser::AssembledStage ShaderParser::assembleStageEx(const ParsedShader& p// One mip of the prefiltered atlas. The mips stack downward, each face ringed// by a border texel, so the offset is a closed form rather than a table:// sum(face >> j, j < mip) = 2*face*(1 - 2^-mip), plus two rows per mip.- "highp vec3 envSampleMip(in highp vec3 R, in highp float mip) {\n"+ "highp vec3 envSampleColumn(in highp vec3 R, in highp float mip,\n"+ " in highp float column) {\n""#ifndef ES_ENV_MAP\n"" return vec3(0.0);\n""#else\n"" highp float face = u_envParams.w;\n"" highp float size = face * exp2(-mip);\n"" highp float yOff = 2.0 * face * (1.0 - exp2(-mip)) + 2.0 * mip;\n"- " highp float atlasW = face + 2.0;\n"+ " highp float col = face + 2.0;\n"+ " highp float atlasW = col * u_reflParams.x;\n"" highp float atlasH = 2.0 * face * (1.0 - exp2(-(u_envParams.z + 1.0)))\n"" + 2.0 * (u_envParams.z + 1.0);\n"- " highp vec2 uv = octEncode(envDirection(R));\n"- " highp vec2 px = vec2(1.0 + uv.x * size, yOff + 1.0 + uv.y * size);\n"+ // The sky turns with the environment; a baked column does not — it was+ // solved in world space, and turning it would spin a room about its middle.+ " highp vec2 uv = octEncode(column < 0.5 ? envDirection(R) : R);\n"+ // Kept inside this column's own face, border ring included: a tap that+ // leaves it reads whatever the sampler's wrap mode says, and the two+ // backends do not answer that alike.+ " highp vec2 lo = vec2(column * col + 0.5, yOff + 0.5);\n"+ " highp vec2 hi = vec2(column * col + size + 1.5, yOff + size + 1.5);\n"+ " highp vec2 px = clamp(vec2(column * col + 1.0 + uv.x * size,\n"+ " yOff + 1.0 + uv.y * size), lo, hi);\n"" highp vec4 t = texture(u_envMap, px / vec2(atlasW, atlasH));\n"" return t.rgb * t.rgb * (t.a * t.a * u_envParams.y);\n""#endif\n""}\n"+ "highp vec3 envSampleMip(in highp vec3 R, in highp float mip) {\n"+ " return envSampleColumn(R, mip, 0.0);\n"+ "}\n"+ // Where the reflected ray LEAVES this column's box, aimed from there rather+ // than from infinitely far: what makes a reflection slide across a wall as+ // the eye moves instead of being painted onto it.+ "highp vec3 reflectionDirection(in highp vec3 R, in highp vec3 P,\n"+ " in highp float column) {\n"+ " if (column < 0.5) return R;\n"+ " highp int i = int(column) * 2 - 2;\n"+ " highp vec3 lo = u_reflBox[i].xyz;\n"+ " highp vec3 hi = u_reflBox[i + 1].xyz;\n"+ // Never zero, so a ray parallel to a face divides to an infinity the min+ // discards rather than to the NaN that would blacken the pixel.+ " highp vec3 d = max(abs(R), vec3(1e-6)) * (step(vec3(0.0), R) * 2.0 - 1.0);\n"+ " highp vec3 far = max((hi - P) / d, (lo - P) / d);\n"+ " highp float t = min(min(far.x, far.y), far.z);\n"+ " if (!(t > 0.0)) return R;\n"+ " return (P + R * t) - (lo + hi) * 0.5;\n"+ "}\n"// The environment's specular half, at the roughness asked for. Without a map// this is the flat ambient term, the same way the diffuse half is.- "highp vec3 envRadiance(in highp vec3 R, in highp float roughness) {\n"+ "highp vec3 envRadiance(in highp vec3 R, in highp float roughness,\n"+ " in highp float column, in highp vec3 P) {\n"" if (u_envParams.x < 0.5) return u_ambient.rgb;\n"+ " highp vec3 dir = reflectionDirection(R, P, column);\n"" highp float lod = clamp(roughness, 0.0, 1.0) * u_envParams.z;\n"" highp float lo = floor(lod);\n"- " highp vec3 a = envSampleMip(R, lo);\n"- " highp vec3 b = envSampleMip(R, min(lo + 1.0, u_envParams.z));\n"+ " highp vec3 a = envSampleColumn(dir, lo, column);\n"+ " highp vec3 b = envSampleColumn(dir, min(lo + 1.0, u_envParams.z), column);\n"+ // A baked column is the WHOLE radiance that reached its probe — the sky,+ // the ambient and every bounce. Adding the flat term or the sky's tint on+ // top would count the light the capture already saw a second time.+ " if (column >= 0.5) return mix(a, b, lod - lo);\n"" return u_ambient.rgb + mix(a, b, lod - lo) * u_envTint.rgb;\n""}\n"// Where a positional light is, from here, and how far. Real geometry measures@@ -2242,7 +2325,8 @@ ShaderParser::AssembledStage ShaderParser::assembleStageEx(const ParsedShader& p// radiance from every direction. A metal has no diffuse, so without a// reflection of it a metal is black wherever no light happens to point." highp vec2 ab = envBRDFApprox(NdotV, roughness);\n"- " gloss += envRadiance(reflect(-V, N), roughness) * (ao * specular)\n"+ " gloss += envRadiance(reflect(-V, N), roughness, reflectionColumn(), worldPos)\n"+ " * (ao * specular)\n"" * (F0 * ab.x + ab.y);\n"" return albedo * (1.0 - metallic) * lit + gloss;\n""}\n"diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txtindex c0dc4fbd5..32fbd1de9 100644--- a/tests/CMakeLists.txt+++ b/tests/CMakeLists.txt@@ -255,6 +255,16 @@ target_include_directories(test_probe_store PRIVATE)add_test(NAME test_probe_store COMMAND test_probe_store)+# Which baked column a point reflects. Header-only, so it runs without a device —+# the pixel gate says a surface came out the wrong colour, this says whether the+# lookup took the wrong box or let two bakes into one frame.+add_executable(test_reflection_store renderer/test_reflection_store.cpp)+target_include_directories(test_reflection_store PRIVATE+ ${CMAKE_SOURCE_DIR}/src+ ${CMAKE_SOURCE_DIR}/third_party/glm+)+add_test(NAME test_reflection_store COMMAND test_reflection_store)+add_executable(test_shadow_atlas renderer/test_shadow_atlas.cpp)target_include_directories(test_shadow_atlas PRIVATE${CMAKE_SOURCE_DIR}/srcdiff --git a/tests/renderer/test_reflection_store.cpp b/tests/renderer/test_reflection_store.cppnew file mode 100644index 000000000..8914b1736--- /dev/null+++ b/tests/renderer/test_reflection_store.cpp@@ -0,0 +1,98 @@+/**+ * @file test_reflection_store.cpp+ * @brief Which column a point reflects, and which probes are refused outright.+ *+ * Header-only, so it runs without a device. A pixel gate says a surface came out+ * the wrong colour; this says whether the lookup took the wrong box, whether a+ * probe past the addressable columns was clamped into someone else's, or whether+ * two bakes were allowed into one frame.+ */++#include "esengine/renderer/store/ReflectionStore.hpp"++#include <cstdio>++using namespace esengine;++static int g_failures = 0;+#define CHECK(cond, msg) \+ do { \+ if (!(cond)) { std::printf("FAIL: %s\n", msg); ++g_failures; } \+ else { std::printf("ok: %s\n", msg); } \+ } while (0)++static void testEmpty() {+ ReflectionStore store;+ CHECK(store.empty(), "a store with no probe is empty");+ CHECK(store.slotAt({0.0f, 0.0f, 0.0f}) == 0, "and answers column 0 — the environment");+ CHECK(store.environment() == 0, "and names no bake");+}++static void testInsideAndOutside() {+ ReflectionStore store;+ CHECK(store.add({-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}, 1, 7),+ "a box with a column and a bake is taken");+ CHECK(store.count() == 1 && store.environment() == 7, "and is the frame's one bake");+ CHECK(store.slotAt({0.0f, 0.0f, 0.0f}) == 1, "a point inside it reflects its column");+ CHECK(store.slotAt({0.0f, 0.0f, 200.0f}) == 0, "a point outside reflects the environment");+ CHECK(store.slotAt({100.0f, 0.0f, 0.0f}) == 1, "the face of the box is inside it");+}++static void testSmallestWins() {+ ReflectionStore store;+ store.add({-500.0f, -500.0f, -500.0f}, {500.0f, 500.0f, 500.0f}, 1, 7);+ store.add({-50.0f, -50.0f, -50.0f}, {50.0f, 50.0f, 50.0f}, 2, 7);+ CHECK(store.slotAt({0.0f, 0.0f, 0.0f}) == 2,+ "where two boxes overlap the smaller one answers");+ CHECK(store.slotAt({200.0f, 0.0f, 0.0f}) == 1, "and the larger still answers outside it");++ // Declared the other way round: the answer is a fact about the boxes, not+ // about which entity the registry walked first.+ ReflectionStore reversed;+ reversed.add({-50.0f, -50.0f, -50.0f}, {50.0f, 50.0f, 50.0f}, 2, 7);+ reversed.add({-500.0f, -500.0f, -500.0f}, {500.0f, 500.0f, 500.0f}, 1, 7);+ CHECK(reversed.slotAt({0.0f, 0.0f, 0.0f}) == 2, "whichever order they arrive in");+}++static void testRefusals() {+ ReflectionStore store;+ CHECK(!store.add({-1.0f, -1.0f, -1.0f}, {1.0f, 1.0f, 1.0f}, 0, 7),+ "column 0 is the environment's, so a probe claiming it is refused");+ CHECK(!store.add({-1.0f, -1.0f, -1.0f}, {1.0f, 1.0f, 1.0f}, MAX_REFLECTION_PROBES, 7),+ "a column past the last addressable one is refused, not clamped");+ CHECK(!store.add({-1.0f, -1.0f, -1.0f}, {1.0f, 1.0f, 1.0f}, 1, 0),+ "a probe with nothing baked yet is refused");+ CHECK(!store.add({1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, -1.0f}, 1, 7),+ "a box with no inside is refused");+ CHECK(store.empty(), "so none of them is in the store");+}++static void testOneBakePerFrame() {+ ReflectionStore store;+ CHECK(store.add({-10.0f, -10.0f, -10.0f}, {10.0f, 10.0f, 10.0f}, 1, 7), "the first bake wins");+ // One texture is bound for the frame, so a probe naming another bake would+ // read its column out of the wrong atlas.+ CHECK(!store.add({-10.0f, -10.0f, -10.0f}, {10.0f, 10.0f, 10.0f}, 2, 8),+ "a probe naming a different bake is refused");+ CHECK(store.count() == 1 && store.environment() == 7, "and the frame keeps the first");+}++static void testClearing() {+ ReflectionStore store;+ store.add({-10.0f, -10.0f, -10.0f}, {10.0f, 10.0f, 10.0f}, 1, 7);+ store.clear();+ CHECK(store.empty() && store.environment() == 0 && store.slotAt({0.0f, 0.0f, 0.0f}) == 0,+ "clearing leaves the next frame nothing of this one's");+}++int main() {+ testEmpty();+ testInsideAndOutside();+ testSmallestWins();+ testRefusals();+ testOneBakePerFrame();+ testClearing();+ std::printf(g_failures == 0 ? "\nall reflection claims hold\n" : "\n%d failure(s)\n",+ g_failures);+ return g_failures == 0 ? 0 : 1;+}diff --git a/tools/check-gizmo-coverage.mjs b/tools/check-gizmo-coverage.mjsindex 94da254e4..fb94ec5f5 100644--- a/tools/check-gizmo-coverage.mjs+++ b/tools/check-gizmo-coverage.mjs@@ -79,6 +79,7 @@ const DISPOSITION = {'Light.cookieSize': 'extent','LightProbeVolume.halfExtents': 'extent','Occluder.halfExtents': 'extent',+ 'ReflectionProbe.halfExtents': 'extent','MeleeAttack.radius': 'extent','AudioSource.minDistance': 'extent','AudioSource.maxDistance': 'extent',diff --git a/tools/check-shader-blocks.mjs b/tools/check-shader-blocks.mjsindex e8681d0d3..cc1720158 100644--- a/tools/check-shader-blocks.mjs+++ b/tools/check-shader-blocks.mjs@@ -152,8 +152,23 @@ function constants() {}const CONSTS = constants();-const resolve = (field) => field.replace(/\[([A-Z_][A-Z_0-9]*)\]/, (m, k) =>- CONSTS.has(k) ? `[${CONSTS.get(k)}]` : m);+/**+ * A C++ array length as a NUMBER: `[MAX_LIGHTS]`, and the products a block writes+ * when one constant bounds two of something — `[2 * MAX_REFLECTION_PROBES]` is a+ * box per column, low corner and high. Left unresolved the comparison would fail+ * on the spelling and say nothing about the length, which is what it is here for.+ */+const resolve = (field) => field.replace(/\[([^\]]+)\]/, (m, expr) => {+ const parts = expr.split('*').map((t) => t.trim());+ let product = 1;+ for (const part of parts) {+ const value = /^\d+$/.test(part) ? Number(part)+ : CONSTS.has(part) ? Number(CONSTS.get(part)) : NaN;+ if (!Number.isFinite(value)) return m;+ product *= value;+ }+ return `[${product}]`;+});const problems = [];let checked = 0;diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex b22cb0e2e..d5184bbcf 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -28,6 +28,15 @@ export const NOTES_FLOOR = 'v0.65.0';* the reader recognises anyway.*/export const NOTED = {+ 'feat(render): what a shiny thing reflects indoors is the room, not the sky':+ { note: 'What a shiny thing reflects indoors is the room, not the sky.' },++ 'fix(lightmap): the bake\'s ray tracer walked its own tree wrong':+ { note: "The bake's ray tracer walked its own tree wrong." },++ 'feat(bake): the editor bakes reflections too, and says where they went':+ { note: 'What a shiny thing reflects indoors is the room, not the sky.' },+'feat(render): a wall stops the frame from drawing what stands behind it':{ note: 'A wall can stop a frame from drawing what is behind it.' },diff --git a/tools/renderScenes.mjs b/tools/renderScenes.mjsindex b40327f0c..f67bba3e6 100644--- a/tools/renderScenes.mjs+++ b/tools/renderScenes.mjs@@ -297,6 +297,21 @@ export const SCENES = [// The same sky in a MIRROR: two metal quads, roughness 0 and 1. A head-on// surface reflects +Z, which is the image centre — green there, and the whole// sphere averaged at the rough end. One flat term would draw them alike.++ // TWO mirrors under one sky, one inside a ReflectionProbe: the baked column is+ // red and the sky green, so the picture says which answer each surface took.+ // One atlas serves both — a reflection is a number per instance, not a bind.+ { id: "reflection-probe", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/reflection-probe.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_COUNTERS: "{\"render.reflection.probes\": 1}", ESTELLA_VERIFY_EXPECT: "[{\"x\": 0.25, \"y\": 0.5, \"rgb\": [255, 0, 0], \"tol\": 30}, {\"x\": 0.75, \"y\": 0.5, \"rgb\": [0, 228, 0], \"tol\": 30}, {\"x\": 0.5, \"y\": 0.5, \"rgb\": [0, 0, 0], \"tol\": 20}]" } },+ // The same scene with the probe switched off: both mirrors take the sky again,+ // which is the claim that a probe REPLACES an answer rather than adding one.+ { id: "reflection-probe-off", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/reflection-probe.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_SET_FIELD: "{\"entity\": 2, \"component\": \"ReflectionProbe\", \"key\": \"enabled\", \"value\": false, \"steps\": 2}", ESTELLA_VERIFY_EXPECT: "[{\"x\": 0.25, \"y\": 0.5, \"rgb\": [0, 228, 0], \"tol\": 30}, {\"x\": 0.75, \"y\": 0.5, \"rgb\": [0, 228, 0], \"tol\": 30}]" } },+ // A BAKED room and a mirror ball in it: red on its left, green on its right.+ // webgl2 only, and NAMED: the second backend reads this atlas to a different+ // texel for the same direction, column and params — the room goes pale there.+ { id: "reflection-room", tier: "pr", webgpu: false, env: { ESTELLA_VERIFY_SCENE: "/scenes/reflection-room.esscene", ESTELLA_VERIFY_W: "512", ESTELLA_VERIFY_H: "384", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\": 0.2, \"y\": 0.55, \"rgb\": [255, 62, 54], \"tol\": 45}, {\"x\": 0.42, \"y\": 0.62, \"rgb\": [42, 255, 71], \"tol\": 45}]" } },+ // The same ball with the probe off: both sides take the flat sky, and the room+ // stops being visible in it.+ { id: "reflection-room-sky", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/reflection-room.esscene", ESTELLA_VERIFY_W: "512", ESTELLA_VERIFY_H: "384", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_SET_FIELD: "{\"entity\": 8, \"component\": \"ReflectionProbe\", \"key\": \"enabled\", \"value\": false, \"steps\": 2}", ESTELLA_VERIFY_EXPECT: "[{\"x\": 0.2, \"y\": 0.55, \"rgb\": [37, 37, 39], \"tol\": 25}, {\"x\": 0.42, \"y\": 0.62, \"rgb\": [37, 37, 39], \"tol\": 25}]" } },{ id: "mat-env-mirror", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/mat-env-mirror.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.25,\"y\":0.5,\"rgb\":[0,228,0],\"tol\":20},{\"x\":0.75,\"y\":0.5,\"rgb\":[29,23,24],\"tol\":20},{\"x\":0.5,\"y\":0.5,\"rgb\":[0,0,0],\"tol\":20}]" } },// Sky and DIELECTRIC apart: they read the atlas and the irradiance coefficients// through different code, and one turning without the other is the defect. The