Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSL: Share context between RTT #28811

Merged
merged 1 commit into from
Jul 5, 2024
Merged

TSL: Share context between RTT #28811

merged 1 commit into from
Jul 5, 2024

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Jul 5, 2024

Related issue: #28781 (comment)

Description

Share context between RTT. There are possibly more nodes to add the .context( builder.getSharedContext() )

@sunag sunag marked this pull request as ready for review July 5, 2024 03:32
@sunag
Copy link
Collaborator Author

sunag commented Jul 5, 2024

@Mugen87 It should fix the use of toTexture() with renderOutput().

@sunag sunag added this to the r167 milestone Jul 5, 2024
Copy link

github-actions bot commented Jul 5, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
460.6 kB (111.1 kB) 460.6 kB (111.1 kB) +0 B

@sunag sunag merged commit df42a7d into mrdoob:dev Jul 5, 2024
12 checks passed
@sunag sunag deleted the dev-rtt-context branch July 5, 2024 04:52
@@ -155,7 +155,8 @@ class GaussianBlurNode extends TempNode {
//

const material = this._material || ( this._material = builder.createNodeMaterial() );
material.fragmentNode = blur();
material.fragmentNode = blur().context( builder.getSharedContext() );
Copy link
Collaborator

@Mugen87 Mugen87 Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind explaining why .context( builder.getSharedContext() ) is now used in GaussianBlurNode (and not just RTTNode)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is a different render-pass, this shader is compiled in a different NodeBuilder and will probably not share the same context or the same settings defined in the renderer, any Node that uses the RenderToTexture approach can inherit the context defined in its essence if it is transferred with this approach.

Copy link
Collaborator

@Mugen87 Mugen87 Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if this change would be missing in GaussianBlurNode, renderer settings could get out of sync and produce similar color errors like reported in #28781 (comment)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if this change would be missing in GaussianBlurNode, renderer settings could get out of sync and produce similar color errors like reported in #28781 (comment)?

Yes, that's it, but only when a node uses context to obtain parameters like the renderOutput() case, in other situations it should be ok.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 5, 2024

It should fix the use of toTexture() with renderOutput().

Indeed, colors are now correct! 🙌

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.

2 participants