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: Introduce node.toTexture() and rtt() #28773

Merged
merged 11 commits into from
Jul 1, 2024
Merged

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Jun 30, 2024

Related issue: Closes #28754. Closes #27508.

Description

This PR simplifies the creation of procedural textures and solves the problem where sampler custom shading is required in Post Processing and Materials.

Example

https://raw.githack.com/sunag/three.js/dev-rtt-node/examples/webgpu_procedural_texture.html

const uvScale = uniform( 4 );
const blurIntensity = uniform( .5 );

const procedural = checker( uv().mul( uvScale ) );
const proceduralToTexture = procedural.toTexture( 512, 512 ); // ( width, height ) <- texture size

material.colorNode = proceduralToTexture.gaussianBlur( blurIntensity, 10 );

image

@sunag sunag added this to the r167 milestone Jun 30, 2024
Copy link

github-actions bot commented Jun 30, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
682.2 kB (169 kB) 682.2 kB (169 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
459.4 kB (110.9 kB) 459.4 kB (110.9 kB) +0 B

@sunag sunag marked this pull request as ready for review July 1, 2024 02:34
@@ -76,7 +76,7 @@
const dotScreenPass = scenePassColor.dotScreen();
dotScreenPass.scale.value = 0.3;

const rgbShiftPass = dotScreenPass.getTextureNode().rgbShift();
const rgbShiftPass = dotScreenPass.rgbShift();
Copy link
Collaborator

@Mugen87 Mugen87 Jul 1, 2024

Choose a reason for hiding this comment

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

Excited to see getTextureNode() is not required here anymore! 🙌

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 1, 2024

Nit: We should try to not add build files to the PRs.

@Mugen87 Mugen87 merged commit 08d5412 into mrdoob:dev Jul 1, 2024
12 checks passed
@mrdoob
Copy link
Owner

mrdoob commented Jul 1, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
682.2 kB (169 kB) 682.2 kB (169 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
459.4 kB (110.9 kB) 459.4 kB (110.9 kB) +0 B

We should probably start tracking the size of three.webgpu.js here too 👀

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 1, 2024

We should probably start tracking the size of three.webgpu.js here too 👀

@marcofugaro Can you help us with this? There is now a separate three.js build with WebGPURenderer instead of WebGLRenderer. Ideally the report added in #25615 now honors both types of builds.

@marcofugaro
Copy link
Contributor

Oh finally! Knew this day would come. Let's test tree-shaking for the WebGPURenderer!!

@sunag
Copy link
Collaborator Author

sunag commented Jul 1, 2024

Oh finally! Knew this day would come. Let's test tree-shaking for the WebGPURenderer!!

Thanks @marcofugaro, tree-shaking is still in progress, initially here but it would be great if we could test it to check the progress of the updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants