Skip to content

Modernize legacy posteffect scripts to ES6 classes and fix FXAA offset bug#8397

Merged
mvaligursky merged 2 commits intomainfrom
mv-posteffect-scripts-es6
Jan 22, 2026
Merged

Modernize legacy posteffect scripts to ES6 classes and fix FXAA offset bug#8397
mvaligursky merged 2 commits intomainfrom
mv-posteffect-scripts-es6

Conversation

@mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Jan 22, 2026

Modernize legacy posteffect scripts to ES6 classes and fix FXAA offset bug

Fixes #5218

Updates all legacy posteffect scripts in scripts/posteffects/ from ES5 prototype-based inheritance to modern ES6 class syntax, and fixes a long-standing FXAA texture offset bug.

Changes

ES6 Class Modernization (all 14 posteffect files)

  • Convert function constructors to ES6 class extends pc.PostEffect
  • Replace pc.PostEffect.call(this, graphicsDevice) with super(graphicsDevice)
  • Remove prototype boilerplate (Object.create, Object.assign, etc.)
  • Convert methods to class method syntax
  • Update var declarations to const/let
  • Convert shader strings from [...].join('\n') to template literals with /* glsl */ tag for editor syntax highlighting

FXAA Fix

  • Fixed texture offset bug where corner samples were incorrectly offset by √2 pixels instead of 1 texel
  • Use WebGL2 textureOffset() for proper 1-texel sampling and better GPU performance

Updated Files

  • posteffect-blend.js
  • posteffect-bloom.js
  • posteffect-bokeh.js
  • posteffect-brightnesscontrast.js
  • posteffect-edgedetect.js
  • posteffect-fxaa.js
  • posteffect-horizontaltiltshift.js
  • posteffect-huesaturation.js
  • posteffect-luminosity.js
  • posteffect-outline.js
  • posteffect-sepia.js
  • posteffect-ssao.js
  • posteffect-verticaltiltshift.js
  • posteffect-vignette.js

@mvaligursky mvaligursky self-assigned this Jan 22, 2026
@mvaligursky mvaligursky added enhancement Request for a new feature area: graphics Graphics related issue labels Jan 22, 2026
@mvaligursky mvaligursky requested a review from a team January 22, 2026 12:38
@mvaligursky mvaligursky merged commit 940d01d into main Jan 22, 2026
7 checks passed
@mvaligursky mvaligursky deleted the mv-posteffect-scripts-es6 branch January 22, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible improvement to FXAA we have

2 participants