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(post): AgX is its own effect group, esengine/fx-agx, so a package that does not use it does not carry its 80 KB of tables

yhhc13d0c6a727a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a92d89d9c..579b6f3d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ published separately; it ships inside the editor.
- **The 3D Starter looks finished out of the box.** Its sun casts mesh shadows (they were off, so every object floated), its camera carries a `PostProcessVolume` with a sky that lights the scene, height fog, GTAO, auto exposure, bloom, grade, vignette and FXAA, and its ground reaches the horizon. The editor's MCP teaches the same: `audit_look` says what a flat 3D scene lacks (shadow maps off, no sky light, fog, exposure or grade, gamma colour) with the fix for each, and `apply_look` adds it in one undo step, in a day, overcast or dusk mood.
## [0.102.0] - 2026-11-11
+- **AgX is its own effect group, `esengine/fx-agx`.** It brings Blender's tables (about 80 KB of source), so it no longer rides in `esengine/fx-basic`: a package whose volumes name `bloom`, `vignette` or `colorGrade` and not `agx` is about 92 KB smaller (measured on a WeChat export of the 3D Starter with a bloom volume against one with an agx volume), and the export still takes the group by itself for a volume that names `agx`. An AgX effect added from a script needs `import 'esengine/fx-agx'` (or the module set to Include in Project Settings), like the other groups; the editor and any entry that is not lean carry it as before.
### Added
diff --git a/docs/astro/src/content/docs/graphics/post-processing.mdx b/docs/astro/src/content/docs/graphics/post-processing.mdx
index 1f6eeff86..84ba2d509 100644
--- a/docs/astro/src/content/docs/graphics/post-processing.mdx
+++ b/docs/astro/src/content/docs/graphics/post-processing.mdx
@@ -577,19 +577,20 @@ stack.addPass('lutGrade', getEffectDef('lutGrade')!.factory())
## In a package
-An effect's definition (its name and parameters) is in every package; its shaders are most of the bytes, so they come in three groups that a
+An effect's definition (its name and parameters) is in every package; its shaders are most of the bytes, so they come in four groups that a
package carries only when its content uses one:
| Group | Subpath | Effects |
|---|---|---|
-| Basic | `esengine/fx-basic` | blur, bloom, vignette, grayscale, colorGrade, lutGrade, agx, chromaticAberration, tonemap, fxaa, sharpen, lensDistortion, pixelate, palette, outline, depthOutline, edgeOutline, filmGrain, motionBlur, lensFlare |
+| Basic | `esengine/fx-basic` | blur, bloom, vignette, grayscale, colorGrade, lutGrade, chromaticAberration, tonemap, fxaa, sharpen, lensDistortion, pixelate, palette, outline, depthOutline, edgeOutline, filmGrain, motionBlur, lensFlare |
| Atmosphere | `esengine/fx-atmosphere` | mist2d, rain2d, fog2d, skyAtmosphere, heightFog, distanceFog, rain |
| Lighting | `esengine/fx-lighting` | ssao, gtao, ssr, ssgi, voxelGI, contactShadows, lightShafts, autoExposure, depthOfField, subsurface, taa |
+| AgX | `esengine/fx-agx` | agx (it carries Blender's AgX tables, about 80 KB, so a package that uses bloom or a vignette and not AgX does not pay for them) |
The export reads the effects a `PostProcessVolume` names (and a `Weather` or `TimeOfDay` component, which drive the atmosphere group) and imports
the groups they need. An effect you add **from a script** — `getEffectDef('bloom')!.factory()` — leaves no trace in the content, so import its group
(`import 'esengine/fx-basic'`) or set the module to **Include** in Project Settings; otherwise the effect says which group it needs when it is
-first used. The editor, and any entry that is not lean, carries all three.
+first used. The editor, and any entry that is not lean, carries all four.
## Best practices
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 3828b047d..59a6ad078 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
@@ -452,17 +452,18 @@ stack.addPass('lutGrade', getEffectDef('lutGrade')!.factory())
## 在包里
-效果的定义(名字和参数)每个包都带;它的着色器才是大头,所以分成三组,包里只带内容用到的那几组:
+效果的定义(名字和参数)每个包都带;它的着色器才是大头,所以分成四组,包里只带内容用到的那几组:
| 组 | 子路径 | 效果 |
|---|---|---|
-| 基础 | `esengine/fx-basic` | blur、bloom、vignette、grayscale、colorGrade、lutGrade、agx、chromaticAberration、tonemap、fxaa、sharpen、lensDistortion、pixelate、palette、outline、depthOutline、edgeOutline、filmGrain、motionBlur、lensFlare |
+| 基础 | `esengine/fx-basic` | blur、bloom、vignette、grayscale、colorGrade、lutGrade、chromaticAberration、tonemap、fxaa、sharpen、lensDistortion、pixelate、palette、outline、depthOutline、edgeOutline、filmGrain、motionBlur、lensFlare |
| 大气 | `esengine/fx-atmosphere` | mist2d、rain2d、fog2d、skyAtmosphere、heightFog、distanceFog、rain |
| 光照 | `esengine/fx-lighting` | ssao、gtao、ssr、ssgi、voxelGI、contactShadows、lightShafts、autoExposure、depthOfField、subsurface、taa |
+| AgX | `esengine/fx-agx` | agx(带 Blender 的 AgX 表,约 80 KB,所以只用泛光、暗角而不用 AgX 的包不必为它们付出体积) |
导出会读 `PostProcessVolume` 里写了哪些效果(以及驱动大气组的 `Weather`、`TimeOfDay` 组件),并导入它们需要的组。**从脚本里**加的效果——
`getEffectDef('bloom')!.factory()`——在内容里没有痕迹,所以要自己导入对应的组(`import 'esengine/fx-basic'`),或在项目设置里把该模块设为**包含**;否则这个效果第一次
-被用到时会告诉你它需要哪一组。编辑器和任何非精简入口三组都带。
+被用到时会告诉你它需要哪一组。编辑器和任何非精简入口四组都带。
## 最佳实践
diff --git a/pipeline/src/bundle/engineSubpaths.ts b/pipeline/src/bundle/engineSubpaths.ts
index db091cb4f..089f45238 100644
--- a/pipeline/src/bundle/engineSubpaths.ts
+++ b/pipeline/src/bundle/engineSubpaths.ts
@@ -17,6 +17,7 @@ export const ESENGINE_SUBPATHS: Readonly<Record<string, string>> = {
'esengine/fx-basic': 'fx-basic/index.js',
'esengine/fx-atmosphere': 'fx-atmosphere/index.js',
'esengine/fx-lighting': 'fx-lighting/index.js',
+ 'esengine/fx-agx': 'fx-agx/index.js',
'esengine/foliage': 'foliage/index.js',
'esengine/worldgen': 'worldgen/index.js',
'esengine/water': 'water/index.js',
diff --git a/pipeline/src/project/targetSupport.ts b/pipeline/src/project/targetSupport.ts
index 13a32f739..d9f4c79e6 100644
--- a/pipeline/src/project/targetSupport.ts
+++ b/pipeline/src/project/targetSupport.ts
@@ -27,7 +27,7 @@ import { NATIVE_PLATFORMS, type ExportPlatform } from './platforms';
/** An engine subsystem a build target may lack. */
export type Subsystem =
- | 'text' | 'tilemap' | 'terrain' | 'foliage' | 'worldgen' | 'water' | 'spline' | 'voxel' | 'rig2d' | 'importedScene' | 'skeletalAnimation' | 'characterShaders' | 'timeline' | 'fxBasic' | 'fxAtmosphere' | 'fxLighting' | 'particles' | 'postprocess' | 'physics' | 'physics3d'
+ | 'text' | 'tilemap' | 'terrain' | 'foliage' | 'worldgen' | 'water' | 'spline' | 'voxel' | 'rig2d' | 'importedScene' | 'skeletalAnimation' | 'characterShaders' | 'timeline' | 'fxBasic' | 'fxAtmosphere' | 'fxLighting' | 'fxAgx' | 'particles' | 'postprocess' | 'physics' | 'physics3d'
| 'spine' | 'dragonbones' | 'video' | 'ai' | 'logic' | 'replication' | 'gameplay';
/**
@@ -45,6 +45,7 @@ export const SUBSYSTEM_COMPONENTS: Readonly<Record<Subsystem, readonly string[]>
fxBasic: [],
fxAtmosphere: ['Weather', 'TimeOfDay'],
fxLighting: [],
+ fxAgx: [],
foliage: ['Foliage', 'PlacedFoliage', 'FoliageContact', 'PlantProxy'],
worldgen: ['WorldGen', 'WorldZone'],
water: ['WaterBody', 'WaterZone', 'Floating'],
@@ -88,7 +89,7 @@ export const SUBSYSTEM_COMPONENTS: Readonly<Record<Subsystem, readonly string[]>
export const POST_PROCESS_EFFECT_GROUP: Readonly<Record<string, Subsystem>> = {
blur: 'fxBasic', bloom: 'fxBasic', vignette: 'fxBasic', grayscale: 'fxBasic', colorGrade: 'fxBasic',
chromaticAberration: 'fxBasic', tonemap: 'fxBasic', fxaa: 'fxBasic', lensDistortion: 'fxBasic', pixelate: 'fxBasic',
- outline: 'fxBasic', depthOutline: 'fxBasic', edgeOutline: 'fxBasic', lutGrade: 'fxBasic', palette: 'fxBasic', agx: 'fxBasic', sharpen: 'fxBasic', filmGrain: 'fxBasic',
+ outline: 'fxBasic', depthOutline: 'fxBasic', edgeOutline: 'fxBasic', lutGrade: 'fxBasic', palette: 'fxBasic', agx: 'fxAgx', sharpen: 'fxBasic', filmGrain: 'fxBasic',
motionBlur: 'fxBasic', lensFlare: 'fxBasic',
mist2d: 'fxAtmosphere', rain2d: 'fxAtmosphere', fog2d: 'fxAtmosphere', distanceFog: 'fxAtmosphere', skyAtmosphere: 'fxAtmosphere', heightFog: 'fxAtmosphere', rain: 'fxAtmosphere',
voxelGI: 'fxLighting', ssgi: 'fxLighting', contactShadows: 'fxLighting', lightShafts: 'fxLighting',
@@ -115,6 +116,7 @@ export const SUBSYSTEM_LABEL: Readonly<Record<Subsystem, string>> = {
fxBasic: 'Post-process effects (colour, lens, edges)',
fxAtmosphere: 'Post-process effects (sky, fog, rain)',
fxLighting: 'Post-process effects (occlusion, reflections, exposure)',
+ fxAgx: 'Post-process effect (AgX view transform and its tables)',
foliage: 'Foliage',
worldgen: 'Generated worlds (biomes, zones, placement)',
water: 'Water',
@@ -153,6 +155,7 @@ export const SUBSYSTEM_INSTALL: Readonly<Record<Subsystem, string>> = {
fxBasic: 'esengine/fx-basic',
fxAtmosphere: 'esengine/fx-atmosphere',
fxLighting: 'esengine/fx-lighting',
+ fxAgx: 'esengine/fx-agx',
foliage: 'esengine/foliage',
worldgen: 'esengine/worldgen',
water: 'esengine/water',
diff --git a/pipeline/tests/engine-installs.test.ts b/pipeline/tests/engine-installs.test.ts
index 23f60e5e2..5c2efe826 100644
--- a/pipeline/tests/engine-installs.test.ts
+++ b/pipeline/tests/engine-installs.test.ts
@@ -67,6 +67,14 @@ describe('the engine modules a package installs', () => {
expect([...collectSubsystems({ components: [{ type: 'Weather', data: {} }] })]).toEqual(['fxAtmosphere']);
});
+ it('carries AgX and its tables only for a volume that names agx, not for the other colour effects', async () => {
+ const { collectSubsystems } = await import('../src/project/targetSupport');
+ const volume = (types: string[]) => ({ entities: [{ components: [{ type: 'PostProcessVolume', data: { effects: types.map((type) => ({ type })) } }] }] });
+ expect([...collectSubsystems(volume(['bloom', 'vignette', 'colorGrade']))].sort()).toEqual(['fxBasic', 'postprocess']);
+ expect([...collectSubsystems(volume(['agx']))].sort()).toEqual(['fxAgx', 'postprocess']);
+ expect(engineInstalls({ subsystems: ['fxBasic', 'fxAgx'] }).subpaths).toEqual(['esengine/fx-agx', 'esengine/fx-basic']);
+ });
+
it('takes timelines from a TimelinePlayer or from the .estimeline it plays', () => {
expect(engineInstalls({ subsystems: ['timeline'] }).subpaths).toEqual(['esengine/timeline']);
expect(engineInstalls({ assetPaths: ['assets/cutscenes/Intro.estimeline'] }).subpaths).toEqual(['esengine/timeline']);
diff --git a/sdk/etc/fx-agx.api.md b/sdk/etc/fx-agx.api.md
new file mode 100644
index 000000000..0725823d4
--- /dev/null
+++ b/sdk/etc/fx-agx.api.md
@@ -0,0 +1,5 @@
+# API surface — esengine/fx-agx
+
+<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
+Symbols: 0 public · 0 beta · 0 experimental · 0 deprecated
+
diff --git a/sdk/package.json b/sdk/package.json
index 7fd770f08..cf71d0c98 100644
--- a/sdk/package.json
+++ b/sdk/package.json
@@ -22,6 +22,7 @@
"./dist/fx-basic/index.js",
"./dist/fx-atmosphere/index.js",
"./dist/fx-lighting/index.js",
+ "./dist/fx-agx/index.js",
"./dist/foliage/index.js",
"./dist/worldgen/index.js",
"./dist/water/index.js",
@@ -99,6 +100,10 @@
"import": "./dist/fx-lighting/index.js",
"types": "./dist/fx-lighting/index.d.ts"
},
+ "./fx-agx": {
+ "import": "./dist/fx-agx/index.js",
+ "types": "./dist/fx-agx/index.d.ts"
+ },
"./timeline": {
"import": "./dist/timeline/index.js",
"types": "./dist/timeline/index.d.ts"
diff --git a/sdk/rolldown.config.js b/sdk/rolldown.config.js
index 2754ca609..c50a4dd5d 100644
--- a/sdk/rolldown.config.js
+++ b/sdk/rolldown.config.js
@@ -108,6 +108,7 @@ export default defineConfig([
'fx-basic/index': 'src/postprocess/fxBasic.ts',
'fx-atmosphere/index': 'src/postprocess/fxAtmosphere.ts',
'fx-lighting/index': 'src/postprocess/fxLighting.ts',
+ 'fx-agx/index': 'src/postprocess/fxAgx.ts',
'foliage/index': 'src/foliage/index.ts',
'worldgen/index': 'src/worldgen/entry.ts',
'water/index': 'src/water/index.ts',
@@ -120,9 +121,9 @@ export default defineConfig([
'logic/index': 'src/logic/entry.ts',
'debug-channel/index': 'src/debug-channel/index.ts',
'ai/index': 'src/ai/entry.ts',
- 'net/replication/index': 'src/net/replication/index.ts',
+ 'net/replication/index': 'src/net/replication/entry.ts',
'net/session/index': 'src/net/session/index.ts',
- 'gameplay/index': 'src/gameplay/index.ts',
+ 'gameplay/index': 'src/gameplay/entry.ts',
'dragonbones/index': 'src/dragonbones/entry.ts',
'douyin/index': 'src/platform/douyin/index.ts',
'kuaishou/index': 'src/platform/kuaishou/index.ts',
diff --git a/sdk/rollup.config.js b/sdk/rollup.config.js
index 0c97fa0e2..f67443d92 100644
--- a/sdk/rollup.config.js
+++ b/sdk/rollup.config.js
@@ -30,6 +30,7 @@ export default [
'fx-basic/index': 'src/postprocess/fxBasic.ts',
'fx-atmosphere/index': 'src/postprocess/fxAtmosphere.ts',
'fx-lighting/index': 'src/postprocess/fxLighting.ts',
+ 'fx-agx/index': 'src/postprocess/fxAgx.ts',
'foliage/index': 'src/foliage/index.ts',
'worldgen/index': 'src/worldgen/entry.ts',
'water/index': 'src/water/index.ts',
@@ -42,9 +43,9 @@ export default [
'logic/index': 'src/logic/entry.ts',
'debug-channel/index': 'src/debug-channel/index.ts',
'ai/index': 'src/ai/entry.ts',
- 'net/replication/index': 'src/net/replication/index.ts',
+ 'net/replication/index': 'src/net/replication/entry.ts',
'net/session/index': 'src/net/session/index.ts',
- 'gameplay/index': 'src/gameplay/index.ts',
+ 'gameplay/index': 'src/gameplay/entry.ts',
'dragonbones/index': 'src/dragonbones/entry.ts',
'wasm': 'src/wasm.ts',
},
diff --git a/sdk/src/platform/nativeModuleRegistry.ts b/sdk/src/platform/nativeModuleRegistry.ts
index fc04bc8b5..4dba41539 100644
--- a/sdk/src/platform/nativeModuleRegistry.ts
+++ b/sdk/src/platform/nativeModuleRegistry.ts
@@ -29,6 +29,7 @@ import * as TimelineModule from '../timeline/api';
import * as FxBasicModule from '../postprocess/fxBasic';
import * as FxAtmosphereModule from '../postprocess/fxAtmosphere';
import * as FxLightingModule from '../postprocess/fxLighting';
+import * as FxAgxModule from '../postprocess/fxAgx';
import * as FoliageModule from '../foliage';
import * as WorldGenModule from '../worldgen';
import * as WaterModule from '../water';
@@ -63,6 +64,7 @@ export const NATIVE_MODULE_NAMESPACES: Readonly<Record<string, unknown>> = {
'esengine/fx-basic': FxBasicModule,
'esengine/fx-atmosphere': FxAtmosphereModule,
'esengine/fx-lighting': FxLightingModule,
+ 'esengine/fx-agx': FxAgxModule,
'esengine/foliage': FoliageModule,
'esengine/worldgen': WorldGenModule,
'esengine/water': WaterModule,
diff --git a/sdk/src/postprocess/effectSources.ts b/sdk/src/postprocess/effectSources.ts
index 8518661a5..db523e6fb 100644
--- a/sdk/src/postprocess/effectSources.ts
+++ b/sdk/src/postprocess/effectSources.ts
@@ -55,7 +55,7 @@ export function effectSourcesOf<T extends object>(): T {
const fn = factories.get(key);
if (!fn) {
throw new Error(`The post-process effect needs "${key}", which this package does not carry. `
- + 'Import the effect group that has it (esengine/fx-basic, esengine/fx-atmosphere or esengine/fx-lighting), '
+ + 'Import the effect group that has it (esengine/fx-basic, esengine/fx-atmosphere, esengine/fx-lighting or esengine/fx-agx), '
+ 'or set the module to Include in Project Settings.');
}
return (fn as (...a: unknown[]) => unknown)(...args);
diff --git a/sdk/src/postprocess/effects.ts b/sdk/src/postprocess/effects.ts
index 60ec558fb..f700ed489 100644
--- a/sdk/src/postprocess/effects.ts
+++ b/sdk/src/postprocess/effects.ts
@@ -8,6 +8,7 @@ import { effectSourcesOf, computeSourceOf } from './effectSources';
import type { basicEffects } from './sources/basic';
import type { atmosphereEffects } from './sources/atmosphere';
import type { lightingEffects } from './sources/lighting';
+import type { agxEffects } from './sources/agx';
import type { lensEffects as LensEffects } from './lensEffects';
import type { gtaoPasses as GtaoPasses } from './gtao';
import type { subsurfacePasses as SubsurfacePasses } from './subsurface';
@@ -16,7 +17,7 @@ import { VOXEL_ATLAS } from './voxelAtlas';
// The effect shaders are installed by group (see effectSources.ts). These read like the objects they stand for.
/** The factories of the built-in effects' shaders. Calling one needs the group that carries it installed. */
-export const postProcessEffects = effectSourcesOf<typeof basicEffects & typeof atmosphereEffects & typeof lightingEffects>();
+export const postProcessEffects = effectSourcesOf<typeof basicEffects & typeof atmosphereEffects & typeof lightingEffects & typeof agxEffects>();
const lensEffects = effectSourcesOf<typeof LensEffects>();
const gtaoPasses = effectSourcesOf<typeof GtaoPasses>();
const subsurfacePasses = effectSourcesOf<typeof SubsurfacePasses>();
diff --git a/sdk/src/postprocess/fxAgx.ts b/sdk/src/postprocess/fxAgx.ts
new file mode 100644
index 000000000..9ab37bd95
--- /dev/null
+++ b/sdk/src/postprocess/fxAgx.ts
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * The `esengine/fx-agx` subpath. Importing it INSTALLS the shader and the tables of the AgX view transform — see
+ * effectSources.ts. A package that does not use AgX imports nothing and carries none of it.
+ */
+import { registerAgxEffectSources } from './sources/agx';
+
+registerAgxEffectSources();
+
+export {};
diff --git a/sdk/src/postprocess/sources/agx.ts b/sdk/src/postprocess/sources/agx.ts
new file mode 100644
index 000000000..7474b5a81
--- /dev/null
+++ b/sdk/src/postprocess/sources/agx.ts
@@ -0,0 +1,184 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file agx.ts
+ * @brief The AgX view transform's shader and its tables, installed by a package that uses AgX.
+ *
+ * @details AgX is a group of its own, apart from the other colour effects, because it brings data: Blender's two tables, about
+ * 80 KB as the SDK carries them. A package that uses bloom or a vignette and not AgX should not carry them.
+ */
+import type { ShaderHandle } from '../../render/material';
+import { Material } from '../../render/material';
+import { registerEffectSources } from '../effectSources';
+import { agxBaseTexture, agxLookHighTexture, agxLookLowTexture, agxAtlasColumns, AGX_BASE_SIZE, AGX_LOOK_SIZE } from '../agxTables';
+
+/** The atlas layout of the two AgX tables (see agxTables.ts), spelt into the shader the same way the tables are written. */
+const AGX_BASE_COLUMNS = agxAtlasColumns(AGX_BASE_SIZE);
+const AGX_LOOK_COLUMNS = agxAtlasColumns(AGX_LOOK_SIZE);
+
+export const agxEffects = {
+ /** The AgX table, for the effect to upload once (see `builtinTextures` on its definition). */
+ agxLut: agxBaseTexture,
+ /** The luminance-compensation table of the contrast looks, in two textures: its top eight bits and its low four. */
+ agxLookHigh: agxLookHighTexture,
+ agxLookLow: agxLookLowTexture,
+ createAgx(): ShaderHandle {
+ // AgX, the view transform Blender uses, from the data Blender ships (agxTables.ts): the colour to FilmLight E-Gamut, a log2 encode over
+ // -12.47393 .. +12.5260688 stops, the 57^3 table read tetrahedrally (as Blender's configuration says), and the display's own encode.
+ // The contrast looks ("Medium High Contrast" is 1.2) are Blender's too: the colour first goes through the luminance-compensation
+ // table, into the inset Rec.2020 gamut AgX's log is taken in, takes its contrast about 0.4 there, and comes back. 1 is AgX Base and
+ // skips all of that. It writes display-linear, so it goes last and the project's output transform stays "none".
+ const source = `#pragma shader "PP AgX"
+#pragma version 300 es
+#pragma domain PostProcess
+#pragma param u_contrast float default(1) range(0.5,2)
+#pragma param u_lut texture default(white)
+#pragma param u_lookHigh texture default(white)
+#pragma param u_lookLow texture default(white)
+
+#pragma fragment
+precision highp float;
+
+in vec2 v_texCoord;
+uniform sampler2D u_texture;
+out vec4 fragColor;
+
+// Scene-linear Rec.709 to FilmLight E-Gamut (Rec.709 to XYZ D65, then XYZ to E-Gamut).
+const mat3 TO_EGAMUT = mat3(0.5593711, 0.0762207, 0.0655267, 0.3047833, 0.7879718, 0.1645467, 0.1358455, 0.1358075, 0.7699265);
+// E-Gamut linear to the inset Rec.2020 gamut AgX Log is taken in, and back (the inset and rotation Blender's config gives, over E-Gamut to Rec.2020).
+const mat3 TO_LOOK = mat3(0.9679715, 0.1318101, 0.0468787, 0.1178901, 0.9160784, 0.0124328, -0.0858616, -0.0478886, 0.9406886);
+const mat3 FROM_LOOK = mat3(1.0473108, -0.1533149, -0.0501658, -0.1359818, 1.1107622, -0.0079040, 0.0886710, 0.0425528, 1.0580698);
+
+const float LOG_LOW = -12.47393;
+const float LOG_SPAN = 25.0;
+vec3 encodeLog(vec3 e) { return clamp((log2(max(e, vec3(1e-10))) - LOG_LOW) / LOG_SPAN, 0.0, 1.0); }
+vec3 decodeLog(vec3 t) { return exp2(t * LOG_SPAN + LOG_LOW); }
+
+// A table is read by tetrahedral interpolation, which is what Blender's configuration names for these tables. Trilinear interpolation is
+// exact on a table's nodes and not between them, and these tables bend fast: inside a cell the grey axis of the cube is not an edge of the
+// interpolation, so a neutral input came out tinted. A tetrahedron has it for an edge. From the cell's low corner it walks along the axes,
+// the one with the biggest fraction first, four nodes in all.
+void tetraCell(vec3 t, int size, out ivec3 n0, out ivec3 n1, out ivec3 n2, out ivec3 n3, out vec3 f) {
+ vec3 p = clamp(t, 0.0, 1.0) * float(size - 1);
+ ivec3 i0 = ivec3(min(floor(p), vec3(float(size - 2))));
+ vec3 g = p - vec3(i0);
+ ivec3 a1 = ivec3(1, 0, 0), a2 = ivec3(0, 1, 0), a3 = ivec3(0, 0, 1);
+ float f1 = g.r, f2 = g.g, f3 = g.b;
+ if (f2 > f1) { ivec3 ta = a1; a1 = a2; a2 = ta; float tf = f1; f1 = f2; f2 = tf; }
+ if (f3 > f2) { ivec3 ta = a2; a2 = a3; a3 = ta; float tf = f2; f2 = f3; f3 = tf; }
+ if (f2 > f1) { ivec3 ta = a1; a1 = a2; a2 = ta; float tf = f1; f1 = f2; f2 = tf; }
+ n0 = i0; n1 = n0 + a1; n2 = n1 + a2; n3 = n2 + a3;
+ f = vec3(f1, f2, f3);
+}
+
+// The tables are atlases of slices (agxTables.ts): the blue index picks the tile, red runs along it and green down it.
+vec3 baseNode(ivec3 n) { return texelFetch(u_lut, ivec2((n.b % ${AGX_BASE_COLUMNS}) * ${AGX_BASE_SIZE} + n.r, (n.b / ${AGX_BASE_COLUMNS}) * ${AGX_BASE_SIZE} + n.g), 0).rgb; }
+// Twelve bits a value, split over two textures: the top eight, and the low four held in the top of a byte.
+vec3 lookNode(ivec3 n) {
+ ivec2 at = ivec2((n.b % ${AGX_LOOK_COLUMNS}) * ${AGX_LOOK_SIZE} + n.r, (n.b / ${AGX_LOOK_COLUMNS}) * ${AGX_LOOK_SIZE} + n.g);
+ vec3 high = floor(texelFetch(u_lookHigh, at, 0).rgb * 255.0 + 0.5);
+ vec3 low = floor(texelFetch(u_lookLow, at, 0).rgb * 255.0 / 16.0 + 0.5);
+ return (high * 16.0 + low) / 4095.0;
+}
+
+vec3 sampleBase(vec3 t) {
+ ivec3 n0, n1, n2, n3; vec3 f;
+ tetraCell(t, ${AGX_BASE_SIZE}, n0, n1, n2, n3, f);
+ vec3 c0 = baseNode(n0), c1 = baseNode(n1), c2 = baseNode(n2), c3 = baseNode(n3);
+ return c0 + (c1 - c0) * f.x + (c2 - c1) * f.y + (c3 - c2) * f.z;
+}
+vec3 sampleLook(vec3 t) {
+ ivec3 n0, n1, n2, n3; vec3 f;
+ tetraCell(t, ${AGX_LOOK_SIZE}, n0, n1, n2, n3, f);
+ vec3 c0 = lookNode(n0), c1 = lookNode(n1), c2 = lookNode(n2), c3 = lookNode(n3);
+ return c0 + (c1 - c0) * f.x + (c2 - c1) * f.y + (c3 - c2) * f.z;
+}
+
+void main() {
+ vec4 color = texture(u_texture, v_texCoord);
+ vec3 e = TO_EGAMUT * max(color.rgb, vec3(0.0));
+ if (u_contrast != 1.0) {
+ // AgX Log: through the luminance compensation, into the inset gamut, log-encoded, and the contrast about 0.4 (the log of 18% grey).
+ vec3 t = (encodeLog(TO_LOOK * decodeLog(sampleLook(encodeLog(e)))) - 0.4) * u_contrast + 0.4;
+ e = FROM_LOOK * decodeLog(t);
+ }
+ vec3 encoded = sampleBase(encodeLog(e));
+ // Back to display-linear: the blit that follows applies the display's own encode.
+ fragColor = vec4(pow(encoded, vec3(2.4)), color.a);
+}
+#pragma end
+
+#pragma fragment wgsl
+const TO_EGAMUT = mat3x3f(vec3f(0.5593711, 0.0762207, 0.0655267), vec3f(0.3047833, 0.7879718, 0.1645467), vec3f(0.1358455, 0.1358075, 0.7699265));
+const TO_LOOK = mat3x3f(vec3f(0.9679715, 0.1318101, 0.0468787), vec3f(0.1178901, 0.9160784, 0.0124328), vec3f(-0.0858616, -0.0478886, 0.9406886));
+const FROM_LOOK = mat3x3f(vec3f(1.0473108, -0.1533149, -0.0501658), vec3f(-0.1359818, 1.1107622, -0.0079040), vec3f(0.0886710, 0.0425528, 1.0580698));
+
+const LOG_LOW : f32 = -12.47393;
+const LOG_SPAN : f32 = 25.0;
+fn encodeLog(e : vec3f) -> vec3f { return clamp((log2(max(e, vec3f(1e-10))) - LOG_LOW) / LOG_SPAN, vec3f(0.0), vec3f(1.0)); }
+fn decodeLog(t : vec3f) -> vec3f { return exp2(t * LOG_SPAN + LOG_LOW); }
+
+struct Cell { n0 : vec3i, n1 : vec3i, n2 : vec3i, n3 : vec3i, f : vec3f }
+
+fn tetraCell(t : vec3f, size : i32) -> Cell {
+ let p = clamp(t, vec3f(0.0), vec3f(1.0)) * f32(size - 1);
+ let i0 = vec3i(min(floor(p), vec3f(f32(size - 2))));
+ let g = p - vec3f(i0);
+ var a1 = vec3i(1, 0, 0);
+ var a2 = vec3i(0, 1, 0);
+ var a3 = vec3i(0, 0, 1);
+ var f1 = g.x;
+ var f2 = g.y;
+ var f3 = g.z;
+ if (f2 > f1) { let ta = a1; a1 = a2; a2 = ta; let tf = f1; f1 = f2; f2 = tf; }
+ if (f3 > f2) { let ta = a2; a2 = a3; a3 = ta; let tf = f2; f2 = f3; f3 = tf; }
+ if (f2 > f1) { let ta = a1; a1 = a2; a2 = ta; let tf = f1; f1 = f2; f2 = tf; }
+ let n1 = i0 + a1;
+ let n2 = n1 + a2;
+ return Cell(i0, n1, n2, n2 + a3, vec3f(f1, f2, f3));
+}
+
+fn baseNode(n : vec3i) -> vec3f { return textureLoad(u_lut, vec2i((n.z % ${AGX_BASE_COLUMNS}) * ${AGX_BASE_SIZE} + n.x, (n.z / ${AGX_BASE_COLUMNS}) * ${AGX_BASE_SIZE} + n.y), 0).rgb; }
+fn lookNode(n : vec3i) -> vec3f {
+ let at = vec2i((n.z % ${AGX_LOOK_COLUMNS}) * ${AGX_LOOK_SIZE} + n.x, (n.z / ${AGX_LOOK_COLUMNS}) * ${AGX_LOOK_SIZE} + n.y);
+ let high = floor(textureLoad(u_lookHigh, at, 0).rgb * 255.0 + 0.5);
+ let low = floor(textureLoad(u_lookLow, at, 0).rgb * 255.0 / 16.0 + 0.5);
+ return (high * 16.0 + low) / 4095.0;
+}
+
+fn sampleBase(t : vec3f) -> vec3f {
+ let c = tetraCell(t, ${AGX_BASE_SIZE});
+ let c0 = baseNode(c.n0);
+ let c1 = baseNode(c.n1);
+ let c2 = baseNode(c.n2);
+ let c3 = baseNode(c.n3);
+ return c0 + (c1 - c0) * c.f.x + (c2 - c1) * c.f.y + (c3 - c2) * c.f.z;
+}
+fn sampleLook(t : vec3f) -> vec3f {
+ let c = tetraCell(t, ${AGX_LOOK_SIZE});
+ let c0 = lookNode(c.n0);
+ let c1 = lookNode(c.n1);
+ let c2 = lookNode(c.n2);
+ let c3 = lookNode(c.n3);
+ return c0 + (c1 - c0) * c.f.x + (c2 - c1) * c.f.y + (c3 - c2) * c.f.z;
+}
+
+@fragment fn fs_main(v : VSOut) -> @location(0) vec4f {
+ let color = textureSampleLevel(t0, s0, v.v_texCoord, 0.0);
+ var e = TO_EGAMUT * max(color.rgb, vec3f(0.0));
+ if (mc.u_contrast != 1.0) {
+ let t = (encodeLog(TO_LOOK * decodeLog(sampleLook(encodeLog(e)))) - 0.4) * mc.u_contrast + 0.4;
+ e = FROM_LOOK * decodeLog(t);
+ }
+ let encoded = sampleBase(encodeLog(e));
+ return vec4f(pow(encoded, vec3f(2.4)), color.a);
+}
+#pragma end
+`;
+ return Material.compileShader(source);
+ },
+};
+
+export function registerAgxEffectSources(): void {
+ registerEffectSources(agxEffects);
+}
diff --git a/sdk/src/postprocess/sources/basic.ts b/sdk/src/postprocess/sources/basic.ts
index 35a9ef022..eb3f53861 100644
--- a/sdk/src/postprocess/sources/basic.ts
+++ b/sdk/src/postprocess/sources/basic.ts
@@ -10,13 +10,8 @@ import { linearColorSpace } from '../../ecs/env';
import { registerEffectSources, registerComputeSource } from '../effectSources';
import { SHARPEN_WGSL } from '../computeEffects';
import { lensEffects } from '../lensEffects';
-import { agxBaseTexture, agxLookHighTexture, agxLookLowTexture, agxAtlasColumns, AGX_BASE_SIZE, AGX_LOOK_SIZE } from '../agxTables';
import { SSAO_GLSL, SSAO_WGSL, GBUFFER_GLSL, GBUFFER_WGSL } from './shared';
-/** The atlas layout of the two AgX tables (see agxTables.ts), spelt into the shader the same way the tables are written. */
-const AGX_BASE_COLUMNS = agxAtlasColumns(AGX_BASE_SIZE);
-const AGX_LOOK_COLUMNS = agxAtlasColumns(AGX_LOOK_SIZE);
-
/**
* A downsample of bloom's pyramid, in both languages. Thirteen taps around the destination texel, in source texels: the
* centre box (j k l m) and four corner boxes sharing the centre. Weighted 0.5 / 0.125 x 4 as a filter; the prefilter also
@@ -150,166 +145,6 @@ void main() {
}
export const basicEffects = {
- /** The AgX table, for the effect to upload once (see `builtinTextures` on its definition). */
- agxLut: agxBaseTexture,
- /** The luminance-compensation table of the contrast looks, in two textures: its top eight bits and its low four. */
- agxLookHigh: agxLookHighTexture,
- agxLookLow: agxLookLowTexture,
- createAgx(): ShaderHandle {
- // AgX, the view transform Blender uses, from the data Blender ships (agxTables.ts): the colour to FilmLight E-Gamut, a log2 encode over
- // -12.47393 .. +12.5260688 stops, the 57^3 table read tetrahedrally (as Blender's configuration says), and the display's own encode.
- // The contrast looks ("Medium High Contrast" is 1.2) are Blender's too: the colour first goes through the luminance-compensation
- // table, into the inset Rec.2020 gamut AgX's log is taken in, takes its contrast about 0.4 there, and comes back. 1 is AgX Base and
- // skips all of that. It writes display-linear, so it goes last and the project's output transform stays "none".
- const source = `#pragma shader "PP AgX"
-#pragma version 300 es
-#pragma domain PostProcess
-#pragma param u_contrast float default(1) range(0.5,2)
-#pragma param u_lut texture default(white)
-#pragma param u_lookHigh texture default(white)
-#pragma param u_lookLow texture default(white)
-
-#pragma fragment
-precision highp float;
-
-in vec2 v_texCoord;
-uniform sampler2D u_texture;
-out vec4 fragColor;
-
-// Scene-linear Rec.709 to FilmLight E-Gamut (Rec.709 to XYZ D65, then XYZ to E-Gamut).
-const mat3 TO_EGAMUT = mat3(0.5593711, 0.0762207, 0.0655267, 0.3047833, 0.7879718, 0.1645467, 0.1358455, 0.1358075, 0.7699265);
-// E-Gamut linear to the inset Rec.2020 gamut AgX Log is taken in, and back (the inset and rotation Blender's config gives, over E-Gamut to Rec.2020).
-const mat3 TO_LOOK = mat3(0.9679715, 0.1318101, 0.0468787, 0.1178901, 0.9160784, 0.0124328, -0.0858616, -0.0478886, 0.9406886);
-const mat3 FROM_LOOK = mat3(1.0473108, -0.1533149, -0.0501658, -0.1359818, 1.1107622, -0.0079040, 0.0886710, 0.0425528, 1.0580698);
-
-const float LOG_LOW = -12.47393;
-const float LOG_SPAN = 25.0;
-vec3 encodeLog(vec3 e) { return clamp((log2(max(e, vec3(1e-10))) - LOG_LOW) / LOG_SPAN, 0.0, 1.0); }
-vec3 decodeLog(vec3 t) { return exp2(t * LOG_SPAN + LOG_LOW); }
-
-// A table is read by tetrahedral interpolation, which is what Blender's configuration names for these tables. Trilinear interpolation is
-// exact on a table's nodes and not between them, and these tables bend fast: inside a cell the grey axis of the cube is not an edge of the
-// interpolation, so a neutral input came out tinted. A tetrahedron has it for an edge. From the cell's low corner it walks along the axes,
-// the one with the biggest fraction first, four nodes in all.
-void tetraCell(vec3 t, int size, out ivec3 n0, out ivec3 n1, out ivec3 n2, out ivec3 n3, out vec3 f) {
- vec3 p = clamp(t, 0.0, 1.0) * float(size - 1);
- ivec3 i0 = ivec3(min(floor(p), vec3(float(size - 2))));
- vec3 g = p - vec3(i0);
- ivec3 a1 = ivec3(1, 0, 0), a2 = ivec3(0, 1, 0), a3 = ivec3(0, 0, 1);
- float f1 = g.r, f2 = g.g, f3 = g.b;
- if (f2 > f1) { ivec3 ta = a1; a1 = a2; a2 = ta; float tf = f1; f1 = f2; f2 = tf; }
- if (f3 > f2) { ivec3 ta = a2; a2 = a3; a3 = ta; float tf = f2; f2 = f3; f3 = tf; }
- if (f2 > f1) { ivec3 ta = a1; a1 = a2; a2 = ta; float tf = f1; f1 = f2; f2 = tf; }
- n0 = i0; n1 = n0 + a1; n2 = n1 + a2; n3 = n2 + a3;
- f = vec3(f1, f2, f3);
-}
-
-// The tables are atlases of slices (agxTables.ts): the blue index picks the tile, red runs along it and green down it.
-vec3 baseNode(ivec3 n) { return texelFetch(u_lut, ivec2((n.b % ${AGX_BASE_COLUMNS}) * ${AGX_BASE_SIZE} + n.r, (n.b / ${AGX_BASE_COLUMNS}) * ${AGX_BASE_SIZE} + n.g), 0).rgb; }
-// Twelve bits a value, split over two textures: the top eight, and the low four held in the top of a byte.
-vec3 lookNode(ivec3 n) {
- ivec2 at = ivec2((n.b % ${AGX_LOOK_COLUMNS}) * ${AGX_LOOK_SIZE} + n.r, (n.b / ${AGX_LOOK_COLUMNS}) * ${AGX_LOOK_SIZE} + n.g);
- vec3 high = floor(texelFetch(u_lookHigh, at, 0).rgb * 255.0 + 0.5);
- vec3 low = floor(texelFetch(u_lookLow, at, 0).rgb * 255.0 / 16.0 + 0.5);
- return (high * 16.0 + low) / 4095.0;
-}
-
-vec3 sampleBase(vec3 t) {
- ivec3 n0, n1, n2, n3; vec3 f;
- tetraCell(t, ${AGX_BASE_SIZE}, n0, n1, n2, n3, f);
- vec3 c0 = baseNode(n0), c1 = baseNode(n1), c2 = baseNode(n2), c3 = baseNode(n3);
- return c0 + (c1 - c0) * f.x + (c2 - c1) * f.y + (c3 - c2) * f.z;
-}
-vec3 sampleLook(vec3 t) {
- ivec3 n0, n1, n2, n3; vec3 f;
- tetraCell(t, ${AGX_LOOK_SIZE}, n0, n1, n2, n3, f);
- vec3 c0 = lookNode(n0), c1 = lookNode(n1), c2 = lookNode(n2), c3 = lookNode(n3);
- return c0 + (c1 - c0) * f.x + (c2 - c1) * f.y + (c3 - c2) * f.z;
-}
-
-void main() {
- vec4 color = texture(u_texture, v_texCoord);
- vec3 e = TO_EGAMUT * max(color.rgb, vec3(0.0));
- if (u_contrast != 1.0) {
- // AgX Log: through the luminance compensation, into the inset gamut, log-encoded, and the contrast about 0.4 (the log of 18% grey).
- vec3 t = (encodeLog(TO_LOOK * decodeLog(sampleLook(encodeLog(e)))) - 0.4) * u_contrast + 0.4;
- e = FROM_LOOK * decodeLog(t);
- }
- vec3 encoded = sampleBase(encodeLog(e));
- // Back to display-linear: the blit that follows applies the display's own encode.
- fragColor = vec4(pow(encoded, vec3(2.4)), color.a);
-}
-#pragma end
-
-#pragma fragment wgsl
-const TO_EGAMUT = mat3x3f(vec3f(0.5593711, 0.0762207, 0.0655267), vec3f(0.3047833, 0.7879718, 0.1645467), vec3f(0.1358455, 0.1358075, 0.7699265));
-const TO_LOOK = mat3x3f(vec3f(0.9679715, 0.1318101, 0.0468787), vec3f(0.1178901, 0.9160784, 0.0124328), vec3f(-0.0858616, -0.0478886, 0.9406886));
-const FROM_LOOK = mat3x3f(vec3f(1.0473108, -0.1533149, -0.0501658), vec3f(-0.1359818, 1.1107622, -0.0079040), vec3f(0.0886710, 0.0425528, 1.0580698));
-
-const LOG_LOW : f32 = -12.47393;
-const LOG_SPAN : f32 = 25.0;
-fn encodeLog(e : vec3f) -> vec3f { return clamp((log2(max(e, vec3f(1e-10))) - LOG_LOW) / LOG_SPAN, vec3f(0.0), vec3f(1.0)); }
-fn decodeLog(t : vec3f) -> vec3f { return exp2(t * LOG_SPAN + LOG_LOW); }
-
-struct Cell { n0 : vec3i, n1 : vec3i, n2 : vec3i, n3 : vec3i, f : vec3f }
-
-fn tetraCell(t : vec3f, size : i32) -> Cell {
- let p = clamp(t, vec3f(0.0), vec3f(1.0)) * f32(size - 1);
- let i0 = vec3i(min(floor(p), vec3f(f32(size - 2))));
- let g = p - vec3f(i0);
- var a1 = vec3i(1, 0, 0);
- var a2 = vec3i(0, 1, 0);
- var a3 = vec3i(0, 0, 1);
- var f1 = g.x;
- var f2 = g.y;
- var f3 = g.z;
- if (f2 > f1) { let ta = a1; a1 = a2; a2 = ta; let tf = f1; f1 = f2; f2 = tf; }
- if (f3 > f2) { let ta = a2; a2 = a3; a3 = ta; let tf = f2; f2 = f3; f3 = tf; }
- if (f2 > f1) { let ta = a1; a1 = a2; a2 = ta; let tf = f1; f1 = f2; f2 = tf; }
- let n1 = i0 + a1;
- let n2 = n1 + a2;
- return Cell(i0, n1, n2, n2 + a3, vec3f(f1, f2, f3));
-}
-
-fn baseNode(n : vec3i) -> vec3f { return textureLoad(u_lut, vec2i((n.z % ${AGX_BASE_COLUMNS}) * ${AGX_BASE_SIZE} + n.x, (n.z / ${AGX_BASE_COLUMNS}) * ${AGX_BASE_SIZE} + n.y), 0).rgb; }
-fn lookNode(n : vec3i) -> vec3f {
- let at = vec2i((n.z % ${AGX_LOOK_COLUMNS}) * ${AGX_LOOK_SIZE} + n.x, (n.z / ${AGX_LOOK_COLUMNS}) * ${AGX_LOOK_SIZE} + n.y);
- let high = floor(textureLoad(u_lookHigh, at, 0).rgb * 255.0 + 0.5);
- let low = floor(textureLoad(u_lookLow, at, 0).rgb * 255.0 / 16.0 + 0.5);
- return (high * 16.0 + low) / 4095.0;
-}
-
-fn sampleBase(t : vec3f) -> vec3f {
- let c = tetraCell(t, ${AGX_BASE_SIZE});
- let c0 = baseNode(c.n0);
- let c1 = baseNode(c.n1);
- let c2 = baseNode(c.n2);
- let c3 = baseNode(c.n3);
- return c0 + (c1 - c0) * c.f.x + (c2 - c1) * c.f.y + (c3 - c2) * c.f.z;
-}
-fn sampleLook(t : vec3f) -> vec3f {
- let c = tetraCell(t, ${AGX_LOOK_SIZE});
- let c0 = lookNode(c.n0);
- let c1 = lookNode(c.n1);
- let c2 = lookNode(c.n2);
- let c3 = lookNode(c.n3);
- return c0 + (c1 - c0) * c.f.x + (c2 - c1) * c.f.y + (c3 - c2) * c.f.z;
-}
-
-@fragment fn fs_main(v : VSOut) -> @location(0) vec4f {
- let color = textureSampleLevel(t0, s0, v.v_texCoord, 0.0);
- var e = TO_EGAMUT * max(color.rgb, vec3f(0.0));
- if (mc.u_contrast != 1.0) {
- let t = (encodeLog(TO_LOOK * decodeLog(sampleLook(encodeLog(e)))) - 0.4) * mc.u_contrast + 0.4;
- e = FROM_LOOK * decodeLog(t);
- }
- let encoded = sampleBase(encodeLog(e));
- return vec4f(pow(encoded, vec3f(2.4)), color.a);
-}
-#pragma end
-`;
- return Material.compileShader(source);
- },
createLutGrade(): ShaderHandle {
// True LUT color grading: a 2D-packed 32^3 LUT (1024x32 — 32 slices of
// 32x32 laid out along X; slice index = blue). Sampled twice around the
diff --git a/sdk/src/runtime/optionalPlugins.ts b/sdk/src/runtime/optionalPlugins.ts
index 45ef375f3..fce9a3212 100644
--- a/sdk/src/runtime/optionalPlugins.ts
+++ b/sdk/src/runtime/optionalPlugins.ts
@@ -23,6 +23,7 @@ import { registerTilemapSupport } from '../tilemap/tilemapSupport';
import { registerBasicEffectSources } from '../postprocess/sources/basic';
import { registerAtmosphereEffectSources } from '../postprocess/sources/atmosphere';
import { registerLightingEffectSources } from '../postprocess/sources/lighting';
+import { registerAgxEffectSources } from '../postprocess/sources/agx';
import { registerSkeletalAnimationSupport } from '../animation/skeletalAnimationSupport';
import { registerTimelineSupport } from '../timeline/timelineSupport';
import { registerTerrainSupport } from '../terrain/terrainSupport';
@@ -51,6 +52,7 @@ export function installOptionalPlugins(): void {
registerBasicEffectSources();
registerAtmosphereEffectSources();
registerLightingEffectSources();
+ registerAgxEffectSources();
registerTerrainSupport();
registerFoliageSupport();
registerWorldGenSupport();
diff --git a/sdk/tests/agx-lut.test.ts b/sdk/tests/agx-lut.test.ts
index e1445c21a..b9c13b471 100644
--- a/sdk/tests/agx-lut.test.ts
+++ b/sdk/tests/agx-lut.test.ts
@@ -2,13 +2,13 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
import { deflateRawSync } from 'node:zlib';
-import { basicEffects } from '../src/postprocess/sources/basic';
+import { agxEffects } from '../src/postprocess/sources/agx';
import { getEffectDef } from '../src/postprocess/effects';
import { inflateRaw } from '../src/postprocess/inflate';
import { AGX_BASE_SIZE, AGX_LOOK_SIZE, agxAtlasColumns } from '../src/postprocess/agxTables';
describe('the AgX tables an effect brings itself', () => {
- const base = basicEffects.agxLut();
+ const base = agxEffects.agxLut();
const baseAt = (r: number, g: number, b: number): number[] => {
const columns = agxAtlasColumns(AGX_BASE_SIZE);
const x = (b % columns) * AGX_BASE_SIZE + r, y = Math.floor(b / columns) * AGX_BASE_SIZE + g, i = (y * base.width + x) * 4;
@@ -38,7 +38,7 @@ describe('the AgX tables an effect brings itself', () => {
});
it('carries the look table as two textures that put back its twelve bits', () => {
- const high = basicEffects.agxLookHigh(), low = basicEffects.agxLookLow();
+ const high = agxEffects.agxLookHigh(), low = agxEffects.agxLookLow();
const columns = agxAtlasColumns(AGX_LOOK_SIZE);
expect([high.width, high.height, low.width, low.height]).toEqual([columns * AGX_LOOK_SIZE, Math.ceil(AGX_LOOK_SIZE / columns) * AGX_LOOK_SIZE, high.width, high.height]);
// The corners of a luminance-compensation table: nothing in is nothing out, and a full-scale input stays near full.
diff --git a/tools/lib/sdkProgram.mjs b/tools/lib/sdkProgram.mjs
index 1c8892eab..91f6d8367 100644
--- a/tools/lib/sdkProgram.mjs
+++ b/tools/lib/sdkProgram.mjs
@@ -64,6 +64,7 @@ export const ENTRIES = {
'fx-basic': 'src/postprocess/fxBasic.ts',
'fx-atmosphere': 'src/postprocess/fxAtmosphere.ts',
'fx-lighting': 'src/postprocess/fxLighting.ts',
+ 'fx-agx': 'src/postprocess/fxAgx.ts',
'foliage': 'src/foliage/index.ts',
'worldgen': 'src/worldgen/entry.ts',
'water': 'src/water/index.ts',
@@ -76,9 +77,9 @@ export const ENTRIES = {
'logic': 'src/logic/entry.ts',
'debug-channel': 'src/debug-channel/index.ts',
'ai': 'src/ai/entry.ts',
- 'replication': 'src/net/replication/index.ts',
+ 'replication': 'src/net/replication/entry.ts',
'session': 'src/net/session/index.ts',
- 'gameplay': 'src/gameplay/index.ts',
+ 'gameplay': 'src/gameplay/entry.ts',
'wasm': 'src/wasm.ts',
'wechat': 'src/index.wechat.ts',
'minigame': 'src/index.minigame.ts',
diff --git a/tools/nativeScriptModules.js b/tools/nativeScriptModules.js
index 751c69060..3b2ee59ef 100644
--- a/tools/nativeScriptModules.js
+++ b/tools/nativeScriptModules.js
@@ -70,6 +70,7 @@ export const MODULES = {
'esengine/fx-basic': { disposition: 'native-subpath' },
'esengine/fx-atmosphere': { disposition: 'native-subpath' },
'esengine/fx-lighting': { disposition: 'native-subpath' },
+ 'esengine/fx-agx': { disposition: 'native-subpath' },
'esengine/foliage': { disposition: 'native-subpath' },
'esengine/worldgen': { disposition: 'native-subpath' },
'esengine/water': { disposition: 'native-subpath' },