-
-
Notifications
You must be signed in to change notification settings - Fork 36.3k
Description
Description
When using a storage texture that is marked as "FloatType" it seems to not be possible to use it at all for rendering on devices that do not support float32-filterable even when the texture settings are set to NearestFilter. This happens when simply assigning the texture to a material "map" or even when using the texture with "textureLoad" which requires no sampler at all, which is what I have been trying to use:
const storageTex = new StorageTexture( 1, 1 );
storageTex.type = FloatType;
storageTex.minFilter = NearestFilter;
storageTex.magFilter = NearestFilter;
wgslFn( /* wgsl */`
fn sampleTexel( tex: texture_2d<f32>, coord: vec2f ) -> vec4f {
// Manual bilinear filtering using textureLoad to support filterable float32 textures
// on all devices
let size = vec2f( textureDimensions( tex, 0 ) );
let pxCoord = coord * size - 0.5;
let px = vec2i( floor( pxCoord ) );
// get the four sibling samples
return textureLoad( tex, px, 0 );
}`, {
tex: texture( storageTex ).setSampler( false ),
coord: varing( uv() ),
} );This is again something I ran into while working on the path tracer and trying to get it working on mobile. Ideally using something like "setSampler( false )" would be enough to guarantee this to work in addition to respecting the system flags and checking the filter settings.
Reproduction steps
- Create a float-type storage texture
- Hook it up to use texture sampling or
textureLoadwith no filtering set on the texture - Render on a device with no float32-filterable support
- See failure
Code
const storageTexture = new THREE.StorageTexture( 1, 1 );
storageTexture.type = THREE.FloatType;
storageTexture.minFilter = THREE.NearestFilter;
storageTexture.magFilter = THREE.NearestFilter;
const material = new MeshBasicMaterial( { map: storageTexture } );Live example
https://jsfiddle.net/bo3nys2a/
Screenshots
Version
r183
Device
No response
Browser
No response
OS
No response