Textures with dimensions non power of two get always downscaled to power of two dimensions. Previous algorithm was performing a “round” to aproximate power of two dimensions rather than floor.
Example :
r89: THREE.WebGLRenderer: image is not power of two (1638×2166). Resized to 1024×2048
r80: THREE.WebGLRenderer: image is not power of two (1638×2166). Resized to 2048×2048
Code in WebGLTextures.js r89:
function makePowerOfTwo( image ) {
...
canvas.width = _Math.floorPowerOfTwo( image.width );
canvas.height = _Math.floorPowerOfTwo( image.height );
...
}
Code in WebGLTextures.js r80:
function makePowerOfTwo( image ) {
...
canvas.width = _Math.nearestPowerOfTwo( image.width );
canvas.height = _Math.nearestPowerOfTwo( image.height );
...
}
Note: nearestPowerOfTwo is now deprecated and replaced with floorPowerOfTwo.
Three.js version
- [x ] Dev
- [x ] r89
- …
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
would it be less of a hack if 3js had
and users then could override this function?
Yeah, I understand. But I bet it wouldn’t take long for someone to come with a use-case that doesn’t fit that expectation.