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

Nodes: Add TransitionNode. #28847

Merged
merged 10 commits into from
Jul 18, 2024
Merged

Conversation

cmhhelgeson
Copy link
Contributor

Related issue -

Port of existing transition post processing feature of RenderTransitionPass to node post processing system.

Copy link

github-actions bot commented Jul 11, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.7 kB (169.3 kB) 683.7 kB (169.3 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
460.9 kB (111.2 kB) 460.9 kB (111.2 kB) +0 B


window.addEventListener( 'resize', onWindowResize );

function onWindowResize() {3

Check warning

Code scanning / CodeQL

Expression has no effect Warning

This expression has no effect.
@@ -0,0 +1,64 @@
import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UVNode.js';
import { addNodeElement, tslFn, nodeObject, float, If } from '../shadernode/ShaderNode.js';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import If.
@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 16, 2024

Is this PR ready to review?

@cmhhelgeson
Copy link
Contributor Author

Is this PR ready to review?

Unfortunately no, I'm trying to investigate the proper way to dynamically change the value of the mixTextureNode, using the 3DLut example as a reference (i.e the value of the mixTexture used by the pass is directly updated in the animate loop). However, for whatever reason, I haven't been successful in replicating the approach.

import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UVNode.js';
import { addNodeElement, tslFn, nodeObject, float, If } from '../shadernode/ShaderNode.js';
import { NodeUpdateType } from '../core/constants.js';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import NodeUpdateType.

import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
import TWEEN from 'three/addons/libs/tween.module.js';
import { uniform, transition, pass, texture } from 'three/tsl'

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import texture.
@cmhhelgeson cmhhelgeson marked this pull request as ready for review July 16, 2024 21:18
@Mugen87 Mugen87 changed the title Nodes: Add TransitionNode Nodes: Add TransitionNode. Jul 18, 2024
@Mugen87 Mugen87 added this to the r167 milestone Jul 18, 2024

const color = vec4().toVar();

If( useTextureNode.equal( int( 1 ) ), () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have refactored this bit since I think the if clause makes the code more readable.


} ).else( () => {

color.assign( mix( texelTwo, texelOne, mixRatioNode ) );
Copy link
Collaborator

@Mugen87 Mugen87 Jul 18, 2024

Choose a reason for hiding this comment

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

The transition was broken when useTextureNode is set to 0 since texelTwo and texelOne should be switched in this mix statement.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 18, 2024

BTW: You should be able to avoid any code formatting issues by integrating ESLint in your editor. VSCode for example can automatically detect the ESLint configuration of the project and auto-format files to avoid linter issues.

@Mugen87 Mugen87 merged commit ffef510 into mrdoob:dev Jul 18, 2024
12 checks passed
@mrdoob
Copy link
Owner

mrdoob commented Jul 18, 2024

The code for these new nodes is beautiful ~

@cmhhelgeson cmhhelgeson deleted the webgpu_transition_pass branch July 18, 2024 16:35
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