[WIP] Add CubeTexture blur
The idea here is to make the PMREM cubemap blur function available as a generic public blur method for a CubeTexture. So far I only have a sketch, but this being my first attempt at using TSL, I've run into some early problems that I'd like to ask @sunag about.
📦 Bundle size
Full ESM build, minified and gzipped.
| Before | After | Diff | |
|---|---|---|---|
| WebGL | 339.44 79.06 |
339.44 79.06 |
+0 B +0 B |
| WebGPU | 488.86 135.68 |
489.66 135.89 |
+798 B +212 B |
| WebGPU Nodes | 488.33 135.55 |
489.1 135.77 |
+775 B +220 B |
🌳 Bundle size after tree-shaking
Minimal build including a renderer, camera, empty scene, and dependencies.
| Before | After | Diff | |
|---|---|---|---|
| WebGL | 465.3 112.11 |
465.3 112.11 |
+0 B +0 B |
| WebGPU | 558.8 151.3 |
559.79 151.53 |
+996 B +232 B |
| WebGPU Nodes | 514.87 141.07 |
515.87 141.29 |
+996 B +224 B |
I'd like to ask @sunag about.
I can help with whatever you need :)
Thanks @sunag - that got me unstuck for a bit. However, in my last commit I'm trying to pull in some of the #29900 changes but I hit a weird error, this.value is null in the function below:
getTransformedUV( uvNode ) {
if ( this._matrixUniform === null ) this._matrixUniform = uniform( this.value.matrix );
I would guess this has something to do with my outputDirection node, but I don't think I've changed anything about it? In any case, fodder for a clearer error message. Any thoughts?
that got me unstuck for a bit. However, in my last commit I'm trying to pull in some of the https://github.com/mrdoob/three.js/pull/29900 changes but I hit a weird error, this.value is null in the function below:
I pushed a commit to fix set uniform value, this happened because texture( null ) is uniform, you can change the value by changing the .value property. But I think we can improve this error message.
Ah, thank you again! I don't know how you manage to develop all this without TS. I have the actual blur function written now - I just need to test it.
Okay, I might have this close to working, and I updated the new API with feedback from @mrdoob. However, upon trying to test it, I realized that CubeRenderTarget is not exported to the public API - it inherits from WebGLCubeRenderTarget which is, but that doesn't have any of the new TSL stuff. Where should this function be exposed?
Since this is my last day at Google (and as a maintainer of MV, see https://github.com/google/model-viewer/discussions/4975) I don't think I'll get a chance to finish this PR. Hopefully it looks useful enough for someone else to pick up and push over the finish line. Thanks for all the help, @sunag! The TSL you've built is quite impressive, though hopefully by the time I play with it again it'll have a few more docs 😄.
@elalish This news took me by surprise. You have done an incredible job over the years with MV and with all the improvements in physical-based materials, tone mapping, etc. I have always found your high level work and rich in detail, your work will certainly be missed by the community. I hope we can meet again on life's journey and I wish you all the best in your achievements.
Thanks a lot @sunag! If you ever find yourself in New Zealand, come visit.