Closed
Description
Describe the bug
DDS and PNG textures lose all color, I don't know how to really explain, I attached screenshots bellow. Since I only use these 2 types of textures, I can't test other types.
If the browser has DDS support, it will be used, otherwise fallback to PNG. This happens on all browsers and devices I tested.
To Reproduce
Steps to reproduce the behavior:
Go to either of the live examples below and press on a weapon or amor icon, the differences will be visible.
Code
A code snippet of how I'm using it.
const manager = new THREE.LoadingManager(() => {
const loadingScreen = document.getElementById('loading-screen')
if (loadingScreen) {
loadingScreen.classList.add('fade-out')
loadingScreen!.addEventListener('transitionend', onTransitionEnd)
}
})
manager.addHandler(/\.dds$/i, new DDSLoader())
const mtlLoader = new MTLLoader(manager)
mtlLoader.setPath(url!)
mtlLoader.load(`${model}.mtl`, (materials) => {
materials.preload()
const objLoader = new OBJLoader(manager)
objLoader.setMaterials(materials)
objLoader.setPath(url!)
objLoader.load(`${model}.obj`, (object) => {
object.scale.setScalar(1 / 200)
object.traverse((child) => {
child.frustumCulled = false
if ((child as any).material instanceof THREE.MeshPhongMaterial) {
(child as any).material.side = THREE.DoubleSide
}
})
scene.add(object)
}, undefined, (error) => console.error(error))
})
Live example
Screenshots
Platform:
- Device: Desktop, Mobile
- OS: Windows, Android
- Browser: Tested on Vivaldi (both Desktop and Android), Chrome, Firefox and Edge
- Three.js version: r137
Metadata
Metadata
Assignees
Labels
No labels