From 1c0393e5dda9bda0a44431bb3dd2e95f1cf5a94a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 2 Nov 2026 08:39:01 +0000 Subject: [PATCH 1/2] Camera: a camera's post effects draw over the cameras before it A stage's cameras draw in order, each over the ones before it. With post effects, a camera's pass started like a frame instead: its target was cleared to the background colour and the result copied over the whole screen, so a second full-screen camera with bloom or a vignette wiped out everything the cameras before it drew (a 3D background camera under a 2D game, for one). Stage#draw now marks every camera after the first, and for those both GPU renderers clear the pass to transparent and blend the result over the frame, as they already do for a renderable's effects. The first camera is unchanged: its pass still starts the frame. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JnzwA2BZwXkRJLpNxCXBNt --- packages/melonjs/CHANGELOG.md | 1 + .../melonjs-camera-and-drawing/SKILL.md | 9 + .../melonjs-effects-and-shaders/SKILL.md | 1 + packages/melonjs/src/camera/camera2d.ts | 4 +- packages/melonjs/src/renderable/renderable.js | 9 + packages/melonjs/src/state/stage.ts | 9 + .../melonjs/src/video/webgl/webgl_renderer.js | 14 +- .../src/video/webgpu/webgpu_renderer.js | 13 +- .../tests/camera-post-effect-over.spec.js | 159 ++++++++++++++++++ 9 files changed, 214 insertions(+), 5 deletions(-) create mode 100644 packages/melonjs/tests/camera-post-effect-over.spec.js diff --git a/packages/melonjs/CHANGELOG.md b/packages/melonjs/CHANGELOG.md index 16eb999db..ac9aba27e 100644 --- a/packages/melonjs/CHANGELOG.md +++ b/packages/melonjs/CHANGELOG.md @@ -23,6 +23,7 @@ - UI: `UITextButton#bitmapText`, for `label` ### Fixed +- Camera: a camera with post effects, drawn after another camera, draws over it. Its effect pass started like a frame, cleared to the background colour and copied over the whole screen, so a second full-screen camera with bloom or a vignette wiped out everything the cameras before it drew. A minimap with post effects no longer fills its rectangle with the background colour either: as one without them, it shows the view behind where it draws nothing (give it a `ColorLayer` for a background) - Loader: assets on the game's own origin are requested with its cookies and HTTP auth, so a game behind a login no longer gets a 403 for every asset ([#1801](https://github.com/melonjs/melonJS/issues/1801)) - Loader: an asset on another origin loads whenever its server allows it (CORS), without `crossOrigin`, and one it does not allow fails at load with an error naming it, instead of later with "Unexpected end of input" or "The source image could not be decoded". `crossOrigin` now only applies to the `