Skip to content

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Sep 30, 2025

Description

Allow handling manually mipmap of StorageTexture and writing to specific mipLevel via compute:

const storageTexture = new THREE.StorageTexture( width, height );
storageTexture.generateMipmaps = true;
storageTexture.mipmapsAutoUpdate = false;
...
const createComputeTexture = ( mipLevel ) => Fn( ( { storageTexture, mipLevelIndex, mipWidth } ) => {
textureStore( storageTexture, indexUV, outputColor ).setMipLevel( mipLevel ).toWriteOnly();
})

This contribution is funded by Utsubo

Copy link

github-actions bot commented Sep 30, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.24
79.14
338.24
79.14
+0 B
+0 B
WebGPU 589.9
162.96
590.25
163.06
+348 B
+100 B
WebGPU Nodes 588.51
162.72
588.86
162.81
+348 B
+99 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 469.7
113.74
469.7
113.74
+0 B
+0 B
WebGPU 659.22
178.36
659.42
178.42
+199 B
+57 B
WebGPU Nodes 613.23
167.54
613.43
167.6
+199 B
+58 B

@Mugen87 Mugen87 added this to the r182 milestone Sep 30, 2025
@Makio64
Copy link
Contributor

Makio64 commented Sep 30, 2025

@RenaudRohlinger instead of manualMipmaps maybe computedMipmaps is more explicit ?

@RenaudRohlinger
Copy link
Collaborator Author

I think computed feels too specific, I like manualMipmaps for the concept of handling manually the mipmaps. But I get your point!

@sunag
Copy link
Collaborator

sunag commented Oct 1, 2025

I think we could use mipmapsAutoUpdate, that would be more in line with matrixAutoUpdate. Normally, automatic processes are the properties assigned as true as default.

@RenaudRohlinger
Copy link
Collaborator Author

Updated the PR accordingly to your feedbacks @sunag! Now using mipmapsAutoUpdate = false.

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.

4 participants