WebGLProgram: Unsupported encoding

Converting some old code to modules, with latest threejs, and when I add a texture to a material I get this. Uncertain of what I am doing or how threejs may have changed.

THREE.WebGLProgram: Unsupported encoding
three.module.js:1035 Uncaught TypeError: Cannot read property ‘elements’ of undefined
at Matrix3.copy (three.module.js:1035)
at refreshUniformsCommon (three.module.js:22700)
at Object.refreshMaterialUniforms (three.module.js:22482)
at setProgram (three.module.js:24770)
at WebGLRenderer.renderBufferDirect (three.module.js:23841)
at renderObject (three.module.js:24394)
at renderObjects (three.module.js:24366)
at WebGLRenderer.render (three.module.js:24166)

Try removing specific parts of your app and pinning down the issue.

Just using a trace stack in this case may be hard, since it looks like a runtime rendering error (that can be caused by pretty much any material you have in your scene.)

Sadly this only happens when I add a map:texture to a material, I suspect the “unsupported encoding” is the key

You should check the value of the encoding property of your texture. It should not be undefined or null. The default is THREE.LinearEncoding.

However, “Cannot read property ‘elements’ of undefined” is the real runtime error. It would be good if you could share a live example that demonstrates this issue.

1 Like

Sooo depressing, somehow my vscode autocomplete…missed the last letter??? Why does this happen to me :disappointed_relieved:

1 Like