Skip to content

WebGPURenderer: Support for access previous frame textures using pass()#29069

Merged
sunag merged 9 commits into
mrdoob:devfrom
sunag:dev-pass-previous
Aug 6, 2024
Merged

WebGPURenderer: Support for access previous frame textures using pass()#29069
sunag merged 9 commits into
mrdoob:devfrom
sunag:dev-pass-previous

Conversation

@sunag
Copy link
Copy Markdown
Collaborator

@sunag sunag commented Aug 5, 2024

Related issue: #29058 (comment)

Description

Add support for accessing previous textures, without needing special configuration, just like the syntax below:

const scenePass = pass( scene, camera );

const currentTexture = scenePass.getTextureNode();
const previousTexture = scenePass.getPreviousTextureNode();

postProcessing.outputNode = mix( currentTexture, previousTexture, .5 ); // simple motion blur

@sunag sunag added this to the r168 milestone Aug 5, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 5, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
685.1 kB (169.6 kB) 685.1 kB (169.6 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
462 kB (111.5 kB) 462 kB (111.5 kB) +0 B

Comment thread examples/webgpu_postprocessing_difference.html Fixed
@sunag sunag changed the title WebGPURenderer: Support for previous frame textures WebGPURenderer: Support for access previous frame textures using pass() Aug 5, 2024
@sunag
Copy link
Copy Markdown
Collaborator Author

sunag commented Aug 6, 2024

Several revisions have been made, now MRT is working on WebGLBackend as shown in the screenshots.

@sunag sunag marked this pull request as ready for review August 6, 2024 04:55
@sunag sunag merged commit fffc941 into mrdoob:dev Aug 6, 2024
@sunag sunag deleted the dev-pass-previous branch August 6, 2024 04:56
@cmhhelgeson
Copy link
Copy Markdown
Contributor

cmhhelgeson commented Aug 6, 2024

I'm getting an error on this code ( just modifying the after image sample ):

const scenePass = pass( scene, camera );
const scenePassColor = scenePass.getTextureNode();
const scenePassPrevColor = scenePass.getPreviousTextureNode();

// combinedPass = scenePassColor;
// combinedPass = combinedPass.afterImage( params.damp );

postProcessing.outputNode = scenePassPrevColor; //combinedPass;
three.js.examples.-.Google.Chrome.2024-08-05.23-05-57.mp4

Full error is as follows. As expected, the error and flickering goes away when antialiasing is turned off since the default sample count for the WebGPUBackend is 1.

The depth stencil attachment [TextureView of Texture "depth"] sample count (4) does not match the sample count of the other attachments (1).
 - While validating depthStencilAttachment.
 - While encoding [CommandEncoder "renderContext_1"].BeginRenderPass([null]).

@sunag
Copy link
Copy Markdown
Collaborator Author

sunag commented Aug 6, 2024

I think it is { antialias: true }, WebGPURenderer does not yet fully support this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants