Skip to content

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.

test(render): oracle scenes for PBR lighting - GGX direct, split-sum environment and multiple scattering against the textbook model

yhh3938252430d5
diff --git a/fixtures/scenes/oracle-pbr-both-dielectric.esscene b/fixtures/scenes/oracle-pbr-both-dielectric.esscene
new file mode 100644
index 000000000..3e0d91bfa
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-both-dielectric.esscene
@@ -0,0 +1,189 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-both-dielectric",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-both-dielectric_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.7
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Ambient",
+ "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": 0.3
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-both-dielectric_m0.esmaterial b/fixtures/scenes/oracle-pbr-both-dielectric_m0.esmaterial
new file mode 100644
index 000000000..c108a4341
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-both-dielectric_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 0,
+ "u_roughness": 0.3
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-both-metal.esscene b/fixtures/scenes/oracle-pbr-both-metal.esscene
new file mode 100644
index 000000000..95de26125
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-both-metal.esscene
@@ -0,0 +1,189 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-both-metal",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-both-metal_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.7
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Ambient",
+ "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": 0.3
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-both-metal_m0.esmaterial b/fixtures/scenes/oracle-pbr-both-metal_m0.esmaterial
new file mode 100644
index 000000000..1dab5c680
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-both-metal_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.3
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m0-r015.esscene b/fixtures/scenes/oracle-pbr-env-m0-r015.esscene
new file mode 100644
index 000000000..23aa2d4b1
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m0-r015.esscene
@@ -0,0 +1,115 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-env-m0-r015",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-env-m0-r015_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Ambient",
+ "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": 0.8
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m0-r015_m0.esmaterial b/fixtures/scenes/oracle-pbr-env-m0-r015_m0.esmaterial
new file mode 100644
index 000000000..64c3e80eb
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m0-r015_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 0,
+ "u_roughness": 0.15
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m0-r045.esscene b/fixtures/scenes/oracle-pbr-env-m0-r045.esscene
new file mode 100644
index 000000000..86ca7c9ee
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m0-r045.esscene
@@ -0,0 +1,115 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-env-m0-r045",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-env-m0-r045_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Ambient",
+ "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": 0.8
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m0-r045_m0.esmaterial b/fixtures/scenes/oracle-pbr-env-m0-r045_m0.esmaterial
new file mode 100644
index 000000000..7085e097c
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m0-r045_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 0,
+ "u_roughness": 0.45
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m0-r09.esscene b/fixtures/scenes/oracle-pbr-env-m0-r09.esscene
new file mode 100644
index 000000000..960408726
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m0-r09.esscene
@@ -0,0 +1,115 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-env-m0-r09",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-env-m0-r09_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Ambient",
+ "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": 0.8
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m0-r09_m0.esmaterial b/fixtures/scenes/oracle-pbr-env-m0-r09_m0.esmaterial
new file mode 100644
index 000000000..83e4e076d
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m0-r09_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 0,
+ "u_roughness": 0.9
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m1-r015.esscene b/fixtures/scenes/oracle-pbr-env-m1-r015.esscene
new file mode 100644
index 000000000..57889547c
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m1-r015.esscene
@@ -0,0 +1,115 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-env-m1-r015",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-env-m1-r015_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Ambient",
+ "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": 0.8
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m1-r015_m0.esmaterial b/fixtures/scenes/oracle-pbr-env-m1-r015_m0.esmaterial
new file mode 100644
index 000000000..647827260
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m1-r015_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.15
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m1-r045.esscene b/fixtures/scenes/oracle-pbr-env-m1-r045.esscene
new file mode 100644
index 000000000..3b0f9ed74
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m1-r045.esscene
@@ -0,0 +1,115 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-env-m1-r045",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-env-m1-r045_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Ambient",
+ "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": 0.8
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m1-r045_m0.esmaterial b/fixtures/scenes/oracle-pbr-env-m1-r045_m0.esmaterial
new file mode 100644
index 000000000..51b22347f
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m1-r045_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.45
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m1-r09.esscene b/fixtures/scenes/oracle-pbr-env-m1-r09.esscene
new file mode 100644
index 000000000..9bff5cba3
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m1-r09.esscene
@@ -0,0 +1,115 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-env-m1-r09",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-env-m1-r09_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Ambient",
+ "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": 0.8
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-env-m1-r09_m0.esmaterial b/fixtures/scenes/oracle-pbr-env-m1-r09_m0.esmaterial
new file mode 100644
index 000000000..c61ba2f9a
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-env-m1-r09_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.9
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-rim-dielectric.esscene b/fixtures/scenes/oracle-pbr-rim-dielectric.esscene
new file mode 100644
index 000000000..9616595f2
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-rim-dielectric.esscene
@@ -0,0 +1,157 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-rim-dielectric",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-rim-dielectric_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": 0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": -0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 1.5
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-rim-dielectric_m0.esmaterial b/fixtures/scenes/oracle-pbr-rim-dielectric_m0.esmaterial
new file mode 100644
index 000000000..c108a4341
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-rim-dielectric_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 0,
+ "u_roughness": 0.3
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-rim-metal.esscene b/fixtures/scenes/oracle-pbr-rim-metal.esscene
new file mode 100644
index 000000000..df24c946a
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-rim-metal.esscene
@@ -0,0 +1,157 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-rim-metal",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-rim-metal_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": 0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": -0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 1.5
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -2
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-rim-metal_m0.esmaterial b/fixtures/scenes/oracle-pbr-rim-metal_m0.esmaterial
new file mode 100644
index 000000000..1dab5c680
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-rim-metal_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.3
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m0-r015.esscene b/fixtures/scenes/oracle-pbr-sun-m0-r015.esscene
new file mode 100644
index 000000000..edc78bd57
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m0-r015.esscene
@@ -0,0 +1,157 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-sun-m0-r015",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-sun-m0-r015_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.8
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m0-r015_m0.esmaterial b/fixtures/scenes/oracle-pbr-sun-m0-r015_m0.esmaterial
new file mode 100644
index 000000000..64c3e80eb
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m0-r015_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 0,
+ "u_roughness": 0.15
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m0-r045.esscene b/fixtures/scenes/oracle-pbr-sun-m0-r045.esscene
new file mode 100644
index 000000000..301f3d87c
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m0-r045.esscene
@@ -0,0 +1,157 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-sun-m0-r045",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-sun-m0-r045_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.8
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m0-r045_m0.esmaterial b/fixtures/scenes/oracle-pbr-sun-m0-r045_m0.esmaterial
new file mode 100644
index 000000000..7085e097c
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m0-r045_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 0,
+ "u_roughness": 0.45
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m0-r09.esscene b/fixtures/scenes/oracle-pbr-sun-m0-r09.esscene
new file mode 100644
index 000000000..fce88d5e8
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m0-r09.esscene
@@ -0,0 +1,121 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-sun-m0-r09",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-sun-m0-r09_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.8
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m0-r09_m0.esmaterial b/fixtures/scenes/oracle-pbr-sun-m0-r09_m0.esmaterial
new file mode 100644
index 000000000..83e4e076d
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m0-r09_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 0,
+ "u_roughness": 0.9
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m1-r015.esscene b/fixtures/scenes/oracle-pbr-sun-m1-r015.esscene
new file mode 100644
index 000000000..3223b4398
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m1-r015.esscene
@@ -0,0 +1,157 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-sun-m1-r015",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-sun-m1-r015_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.8
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -3
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m1-r015_m0.esmaterial b/fixtures/scenes/oracle-pbr-sun-m1-r015_m0.esmaterial
new file mode 100644
index 000000000..647827260
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m1-r015_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.15
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m1-r025.esscene b/fixtures/scenes/oracle-pbr-sun-m1-r025.esscene
new file mode 100644
index 000000000..961c0ec29
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m1-r025.esscene
@@ -0,0 +1,157 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-sun-m1-r025",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-sun-m1-r025_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.8
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -3
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m1-r025_m0.esmaterial b/fixtures/scenes/oracle-pbr-sun-m1-r025_m0.esmaterial
new file mode 100644
index 000000000..fbb14a0d7
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m1-r025_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.25
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m1-r045.esscene b/fixtures/scenes/oracle-pbr-sun-m1-r045.esscene
new file mode 100644
index 000000000..54e77e2e9
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m1-r045.esscene
@@ -0,0 +1,157 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-sun-m1-r045",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-sun-m1-r045_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.8
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "colorGrade",
+ "enabled": true,
+ "uniforms": {
+ "u_exposure": -2
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m1-r045_m0.esmaterial b/fixtures/scenes/oracle-pbr-sun-m1-r045_m0.esmaterial
new file mode 100644
index 000000000..51b22347f
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m1-r045_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.45
+ }
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m1-r09.esscene b/fixtures/scenes/oracle-pbr-sun-m1-r09.esscene
new file mode 100644
index 000000000..2c78fc8d2
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m1-r09.esscene
@@ -0,0 +1,121 @@
+{
+ "version": 4,
+ "name": "oracle-pbr-sun-m1-r09",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ball",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": 0
+ },
+ "scale": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "color": {
+ "r": 0.8,
+ "g": 0.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "material": "/scenes/oracle-pbr-sun-m1-r09_m0.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.875426098065593,
+ "x": -0.40821789367673483,
+ "y": 0.23456971600980447,
+ "z": 0.109381654946615
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.8
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-pbr-sun-m1-r09_m0.esmaterial b/fixtures/scenes/oracle-pbr-sun-m1-r09_m0.esmaterial
new file mode 100644
index 000000000..c61ba2f9a
--- /dev/null
+++ b/fixtures/scenes/oracle-pbr-sun-m1-r09_m0.esmaterial
@@ -0,0 +1,13 @@
+{
+ "version": "1.0",
+ "type": "material",
+ "shader": "builtin:model",
+ "blendMode": 0,
+ "depthTest": true,
+ "depthWrite": true,
+ "cull": 0,
+ "properties": {
+ "u_metallic": 1,
+ "u_roughness": 0.9
+ }
+}
diff --git a/tools/oracle/index.mjs b/tools/oracle/index.mjs
index 8a8bacf12..90aab6dfb 100644
--- a/tools/oracle/index.mjs
+++ b/tools/oracle/index.mjs
@@ -15,8 +15,9 @@ import { OCCLUSION_SCENES } from './occlusion.mjs';
import { REFLECTION_SCENES } from './reflection.mjs';
import { AGX_SCENES } from './agx.mjs';
import { SOFT_LIGHT_SCENES } from './softlight.mjs';
+import { PBR_SCENES } from './pbr.mjs';
-export const ORACLE = [...LIGHT_SCENES, ...SHADOW_SCENES, ...POST_SCENES, ...SKY_SCENES, ...LENS_SCENES, ...VOLUMETRIC_SCENES, ...EXPOSURE_SCENES, ...OCCLUSION_SCENES, ...REFLECTION_SCENES, ...AGX_SCENES, ...SOFT_LIGHT_SCENES];
+export const ORACLE = [...LIGHT_SCENES, ...SHADOW_SCENES, ...POST_SCENES, ...SKY_SCENES, ...LENS_SCENES, ...VOLUMETRIC_SCENES, ...EXPOSURE_SCENES, ...OCCLUSION_SCENES, ...REFLECTION_SCENES, ...AGX_SCENES, ...SOFT_LIGHT_SCENES, ...PBR_SCENES];
/** The renderScenes.mjs entry for one oracle scene. */
export const oracleEntry = (o) => ({
diff --git a/tools/oracle/pbr.mjs b/tools/oracle/pbr.mjs
new file mode 100644
index 000000000..9a78fdba8
--- /dev/null
+++ b/tools/oracle/pbr.mjs
@@ -0,0 +1,130 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file pbr.mjs — oracle scenes for the PBR lighting model: a ball lit by a sun, by a uniform environment, and by both.
+ *
+ * The reference is the textbook model the engine claims, written here from the papers and not from its shader:
+ *
+ * direct specular D x Vis x F x pi x I x N.L, with D the GGX distribution (Walter et al. 2007, alpha = roughness^2), Vis the
+ * height-correlated Smith visibility (Heitz 2014), F Schlick's Fresnel in V.H; the engine's `I` is irradiance / pi.
+ * direct diffuse albedo x (1 - metallic) x I x N.L
+ * environment a uniform environment E lights a diffuse surface with albedo x E and a specular one with E x (F0 x A + B), where A and B
+ * are the split-sum terms of Karis (2013), INTEGRATED here by quadrature over the GGX lobe, not read from the engine's fit
+ * multiple scatter the energy a single-scattering lobe loses is put back (Fdez-Aguera 2019): the direct specular is scaled by
+ * 1 + F0 (1 / Ess - 1), the environment adds FssEss x Favg x Ems / (1 - Ems x Favg), and the diffuse under the specular
+ * keeps what is left of the energy, kd = 1 - (FssEss + FmsEms)
+ *
+ * The engine agrees with this model to 1 or 2 codes everywhere. The one exception is a highlight a few degrees wide (roughness 0.15), where the
+ * ball's interpolated mesh normals move the answer by up to 5, so those scenes carry a tolerance of 6.
+ *
+ * The camera is orthographic and looks straight down, so the view vector is +Y for every pixel and a ball's normal at a pixel is its
+ * position on the sphere. A scene with a bright highlight is dimmed by a grade (an effect already checked to the code) so that the highlight
+ * stays under 1 and an error in it shows; a scene with none is not, which keeps the small terms (Fresnel, the diffuse's energy share) readable.
+ */
+import { scene, camera, mesh, sun, ambient, volume, probe } from './scene.mjs';
+import { sunAim, dot, norm, encodeLinear8, clamp01 } from './formulas.mjs';
+
+const R = 50;
+const PROBES = [[0, 0], [14, 0], [-14, 0], [0, 14], [0, -14], [26, 10], [-26, -10], [10, -30], [-8, 33], [36, 0], [-36, 6], [0, 40]];
+
+const ggx = (noh, a) => { const a2 = a * a, d = noh * noh * (a2 - 1) + 1; return a2 / (Math.PI * d * d); };
+const visibility = (nov, nol, a) => { const a2 = a * a; return 0.5 / (nol * Math.sqrt(nov * nov * (1 - a2) + a2) + nov * Math.sqrt(nol * nol * (1 - a2) + a2)); };
+const schlick = (voh, f0) => f0.map((f) => f + (1 - f) * Math.pow(1 - voh, 5));
+
+/** The split-sum terms (A scales F0, B is the grazing share), by quadrature over the GGX lobe for a view at cosine `nov`. */
+const dfgCache = new Map();
+function dfg(nov, roughness) {
+ const key = `${nov.toFixed(4)}:${roughness}`;
+ if (dfgCache.has(key)) return dfgCache.get(key);
+ const a = Math.max(roughness * roughness, 1e-3), v = [Math.sqrt(1 - nov * nov), 0, nov], n = 160;
+ let A = 0, B = 0;
+ for (let i = 0; i < n; i++) {
+ for (let j = 0; j < n; j++) {
+ const xi1 = (i + 0.5) / n, xi2 = (j + 0.5) / n, phi = 2 * Math.PI * xi1;
+ const cosT = Math.sqrt((1 - xi2) / (1 + (a * a - 1) * xi2)), sinT = Math.sqrt(1 - cosT * cosT);
+ const h = [sinT * Math.cos(phi), sinT * Math.sin(phi), cosT], voh = dot(v, h);
+ const l = h.map((x, k) => 2 * voh * x - v[k]), nol = l[2], noh = h[2];
+ if (nol <= 0 || voh <= 0) continue;
+ const gVis = (4 * nol * nov * visibility(nov, nol, a)) * voh / (noh * nov), fc = Math.pow(1 - voh, 5);
+ A += (1 - fc) * gVis; B += fc * gVis;
+ }
+ }
+ const out = [A / (n * n), B / (n * n)];
+ dfgCache.set(key, out);
+ return out;
+}
+
+/** The environment term of the model for a view cosine: what a uniform environment of radiance 1 adds as specular, and the diffuse's share. */
+function environment(nov, roughness, f0) {
+ const [A, B] = dfg(nov, roughness), Ess = A + B;
+ const fssEss = f0.map((f) => f * A + B), favg = f0.map((f) => f + (1 - f) / 21), ems = 1 - Ess;
+ const fmsEms = fssEss.map((f, k) => (f * favg[k] * ems) / (1 - ems * favg[k]));
+ return { specular: fssEss.map((f, k) => f + fmsEms[k]), kd: fssEss.map((f, k) => Math.max(1 - (f + fmsEms[k]), 0)), Ess };
+}
+
+/** The radiance of the ball at a pixel: direct sun (if any) plus the uniform environment (if any). */
+function shade({ normal, view, toLight, sunI, sunLinear, ambientLinear, albedo, metallic, roughness }) {
+ const f0 = albedo.map((c) => 0.04 * (1 - metallic) + c * metallic), diffuse = albedo.map((c) => c * (1 - metallic));
+ const nov = Math.max(dot(normal, view), 1e-4), a = Math.max(roughness * roughness, 1e-3);
+ const env = environment(nov, roughness, f0);
+ let direct = [0, 0, 0], diffuseLight = ambientLinear.slice();
+ if (sunI > 0) {
+ const nol = Math.max(dot(normal, toLight), 0);
+ diffuseLight = diffuseLight.map((e, k) => e + sunLinear[k] * sunI * nol);
+ if (nol > 0) {
+ const h = norm(toLight.map((x, k) => x + view[k])), noh = Math.max(dot(normal, h), 0), voh = Math.max(dot(view, h), 0);
+ const F = schlick(voh, f0), d = ggx(noh, a), vis = visibility(nov, nol, a);
+ // Multiple scattering restores the energy the lobe loses, as a gain on the direct specular.
+ const gain = f0.map((f) => 1 + f * (1 / Math.max(env.Ess, 0.05) - 1));
+ direct = F.map((f, k) => f * d * vis * Math.PI * sunLinear[k] * sunI * nol * gain[k]);
+ }
+ }
+ return diffuse.map((c, k) => c * env.kd[k] * diffuseLight[k] + direct[k] + ambientLinear[k] * env.specular[k]);
+}
+
+const material = (metallic, roughness) => ({ version: '1.0', type: 'material', shader: 'builtin:model', blendMode: 0, depthTest: true, depthWrite: true, cull: 0, properties: { u_metallic: metallic, u_roughness: roughness } });
+
+function ball({ id, metallic, roughness, sunI = 0, ambientI = 0, albedo = [0.8, 0.5, 0.3], pitch = 50, yaw = 30, tol = 2, dimStops = 0 }) {
+ const aim = sunAim(pitch, yaw), materialName = `${id}_m0.esmaterial`;
+ const doc = scene(id, () => [
+ camera(),
+ mesh('Ball', 'sphere', [0, R, 0], [1, 1, 1], albedo, { material: `/scenes/${materialName}` }),
+ ...(sunI > 0 ? [sun(aim, sunI, [1, 1, 1])] : []),
+ ...(ambientI > 0 ? [ambient(ambientI, [1, 1, 1])] : []),
+ ...(dimStops > 0 ? [volume([{ type: 'colorGrade', enabled: true, uniforms: { u_exposure: -dimStops } }])] : []),
+ ]);
+ const view = [0, 1, 0], dim = 2 ** -dimStops;
+ const colourAt = (normal) => encodeLinear8(shade({ normal, view, toLight: aim.toLight, sunI, sunLinear: [1, 1, 1], ambientLinear: [ambientI, ambientI, ambientI], albedo, metallic, roughness }).map((c) => clamp01(c * dim)));
+ // The ball is a mesh: its normal between vertices is interpolated, a fraction of a degree off the true sphere's. A narrow highlight (a
+ // low roughness) falls off faster than that, so a probe on its flank asks about the mesh and not the lighting. Keep the probes whose
+ // answer holds when the normal is turned by 0.8 degrees any way.
+ const wobble = 0.8 * (Math.PI / 180);
+ const steady = (normal) => {
+ const here = colourAt(normal), t1 = norm([normal[2], 0, -normal[0]]), t2 = norm([normal[1] * t1[2], normal[2] * t1[0] - normal[0] * t1[2], -normal[1] * t1[0]]);
+ return [[1, 0], [-1, 0], [0, 1], [0, -1]].every(([a, b]) => {
+ const n = norm(normal.map((c, k) => c + wobble * (a * t1[k] + b * t2[k])));
+ return Math.max(...colourAt(n).map((c, k) => Math.abs(c - here[k]))) <= tol * 0.6;
+ });
+ };
+ // The highlight sits where the normal is the half vector between the light and the view: crowd probes round it.
+ const half = norm(aim.toLight.map((c, k) => c + view[k]));
+ const near = sunI > 0 ? [[0, 0], [5, 0], [-5, 0], [0, 5], [0, -5], [10, 0], [-10, 0], [0, 10], [0, -10], [16, 6], [-16, -6], [22, 0]].map(([dx, dz]) => [half[0] * R + dx, half[2] * R + dz]) : [];
+ const expect = [...PROBES, ...near].flatMap(([x, z]) => {
+ const p = probe(x, z), [px, pz] = p.at, r2 = px * px + pz * pz;
+ const normal = [px / R, Math.sqrt(Math.max(R * R - r2, 0)) / R, pz / R];
+ return steady(normal) ? [{ x: p.x, y: p.y, rgb: colourAt(normal), tol }] : [];
+ });
+ return { id, doc, colorSpace: 'linear', expect, files: { [materialName]: material(metallic, roughness) },
+ about: `PBR ball, metallic ${metallic}, roughness ${roughness}, sun ${sunI}, environment ${ambientI}` };
+}
+
+const SUN = [[0, 0.15, 1], [0, 0.45, 1], [0, 0.9, 0], [1, 0.15, 3], [1, 0.25, 3], [1, 0.45, 2], [1, 0.9, 0]];
+export const PBR_SCENES = [
+ ...SUN.map(([m, r, dimStops]) => ball({ id: `oracle-pbr-sun-m${m}-r${String(r).replace('.', '')}`, metallic: m, roughness: r, sunI: 0.8, dimStops, tol: r < 0.2 ? 6 : 2 })),
+ ...[[0, 0.15], [0, 0.45], [0, 0.9], [1, 0.15], [1, 0.45], [1, 0.9]].map(([m, r]) => ball({ id: `oracle-pbr-env-m${m}-r${String(r).replace('.', '')}`, metallic: m, roughness: r, ambientI: 0.8 })),
+ ball({ id: 'oracle-pbr-both-dielectric', metallic: 0, roughness: 0.3, sunI: 0.7, ambientI: 0.3, dimStops: 1 }),
+ ball({ id: 'oracle-pbr-both-metal', metallic: 1, roughness: 0.3, sunI: 0.7, ambientI: 0.3, dimStops: 1 }),
+ // A light from BELOW the ball, seen from above: it can only light the rim, where V.H is small and Schlick's (1 - V.H)^5 is large.
+ ball({ id: 'oracle-pbr-rim-dielectric', metallic: 0, roughness: 0.3, sunI: 1.5, pitch: -50, yaw: 30, dimStops: 1 }),
+ ball({ id: 'oracle-pbr-rim-metal', metallic: 1, roughness: 0.3, sunI: 1.5, pitch: -50, yaw: 30, dimStops: 2 }),
+];