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.

feat(editor): Play runs on the graphics backend the project asks for

yhh8018c1d2792f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2c79cedc1..dd2ca3ba7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ published separately; it ships inside the editor.
### Added
- **Contact shadows and screen-space bounce light.** Contact Shadows and Screen Space GI effects add small sharp shadows at contacts and one bounce of colour between surfaces, and the weather softens the sun's shadows. `contactShadows` marches a short ray toward the scene's sun in the depth buffer; `ssgi` gathers eight rays a pixel over the G-buffer's normals at half size into a float target and averages the neighbours on the same surface before laying the light, times the receiver's colour, over the picture. The Weather component raises the sun's `sourceAngle` and lowers its `shadowStrength` as the sky clouds over.
+- **Play on WebGPU.** Play runs the game on the graphics backend the project asks for, so a WebGPU project is played on WebGPU and its compute effects and Voxel GI are seen in the editor. Until now Play always ran on WebGL2 whatever the project asked for; it now follows `features.rendering.backend` the way a shipped build does, and falls back to WebGL2 on a machine with no WebGPU.
- **Voxel GI.** Voxel GI adds diffuse bounce light from a world-space voxel cache the camera remembers, on WebGPU. The cache is a voxel grid around the camera that each frame takes in the lit picture (the radiance and facing of the surfaces it sees) and fades what it held; light is gathered by marching cosine-weighted rays through it, so a wall that has left the screen still tints the floor beside it and a moving light lights its surroundings, which Screen Space GI cannot do. It holds only what the camera has seen, at the voxel's size, with one diffuse bounce: it is not a trace of the scene's geometry, and not Lumen. A device with no compute stage goes without it.
- **Compute effects.** A post-process effect can be a WGSL compute shader over the picture, run on WebGPU and left out on WebGL2, and Sharpen is the first. An effect registers with `compute` instead of `factory`; it is handed the picture so far, a storage texture to write, its parameters, the size and the scene's depth. Sharpen pushes each pixel away from its neighbours and holds it inside their range, so an edge steepens without a halo. A compute effect refines a picture that is already whole, so a device with no compute stage simply goes without it.
- **Sky.** The Sky Atmosphere effect scatters the sun's light through an atmosphere and draws volumetric clouds that the sun lights and the wind moves. The dome is single scattering through a planet's atmosphere (Rayleigh and Mie), so a sunset's reds and the afterglow come from the same calculation as noon's blue; the clouds are a slab marched against a noise density, lit through what lies between them and the sun, and a Weather's overcast raises their coverage.
diff --git a/desktop b/desktop
index 27b816fa0..943eccf54 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 27b816fa07eebee018a3cedfa1f5bb5e35f27f79
+Subproject commit 943eccf547c53565d9364f308980540f4afae93b
diff --git a/docs/astro/src/content/docs/graphics/post-processing.mdx b/docs/astro/src/content/docs/graphics/post-processing.mdx
index 09bf70bad..0b76f7147 100644
--- a/docs/astro/src/content/docs/graphics/post-processing.mdx
+++ b/docs/astro/src/content/docs/graphics/post-processing.mdx
@@ -177,7 +177,7 @@ An effect can be a **compute shader** instead of a draw: WGSL run over the whole
many neighbours or keeps a result of its own is written without a render pass per step. `sharpen` is one: each pixel is
pushed away from the mean of its neighbours and then held inside the range they span, so an edge gets steeper without a halo.
-A compute effect needs a device with a compute stage, which is **WebGPU**. On WebGL2 (and in Play, which runs on WebGL2) the effect
+A compute effect needs a device with a compute stage, which is **WebGPU**. On WebGL2 the effect
is left out of the chain and the picture goes through as it was — a compute effect is for refining a picture that is already whole,
so write one that way. Ask `postprocess_supportsCompute` (or check the backend) if your game needs to know.
diff --git a/docs/astro/src/content/docs/zh-cn/graphics/post-processing.mdx b/docs/astro/src/content/docs/zh-cn/graphics/post-processing.mdx
index f15db2313..e8847d54a 100644
--- a/docs/astro/src/content/docs/zh-cn/graphics/post-processing.mdx
+++ b/docs/astro/src/content/docs/zh-cn/graphics/post-processing.mdx
@@ -139,7 +139,7 @@ Estella 通过 ping-pong 帧缓冲运行全屏后处理。加一个 `PostProcess
一个特效可以是**计算着色器**而不是绘制:在整张画面上运行的 WGSL,适合需要读取很多相邻像素、或要保留自己结果的特效,不必每一步都开一个渲染 pass。
`sharpen` 就是一个:每个像素被推离邻居的均值,再被限制在邻居所张成的范围内,所以边缘变陡却不会出光晕。
-计算特效需要有计算阶段的设备,也就是 **WebGPU**。在 WebGL2(以及运行在 WebGL2 上的 Play)里,这个特效会被从链路中拿掉,画面原样通过——
+计算特效需要有计算阶段的设备,也就是 **WebGPU**。在 WebGL2 里,这个特效会被从链路中拿掉,画面原样通过——
计算特效是用来精修一张已经完整的画面的,所以请按这个思路写。游戏需要知道时,可以问 `postprocess_supportsCompute`(或检查后端)。
像注册其他特效一样注册你自己的,用 `compute` 代替 `factory`:
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index fa6b604e0..d67dd0bf2 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -2493,6 +2493,8 @@ export const NOTED = {
{"note":"Skinned meshes are followed by their bones, from the palette they were last drawn with."},
"feat(render): fog follows the scene's sun and can walk the air against its shadow map":
{"note":"Height Fog and Light Shafts follow the scene's own sun, and Height Fog can carry the sun's shadows as volumetric light."},
+ "feat(editor): Play runs on the graphics backend the project asks for":
+ {"note":"Play runs the game on the graphics backend the project asks for, so a WebGPU project is played on WebGPU and its compute effects and Voxel GI are seen in the editor."},
"feat(render): Voxel GI lights from a world-space cache of what the camera has seen, run as compute passes":
{"note":"Voxel GI adds diffuse bounce light from a world-space voxel cache the camera remembers, on WebGPU."},
"feat(render): post-process effects can be compute shaders, and Sharpen is one":