Search code examples
three.jstextures

Texture Format In Threejs


I couldn't actually understand the concept of Texture.Format in threejs Docs, Does the luminescence format has any relationship with YCbCr format? When I tried debugging this I got a numerical value like 1025 for format, What does this number actually means?


Solution

  • THREE.LuminanceFormat and THREE.LuminanceAlphaFormat representing the internalformat of the texture. According to the documentation of MDN the internalformat specifies the color components in the texture (amount of color channels and bytes per pixel).

    When I tried debugging this I got a numerical value like 1025 for format, What does that actually means?

    The value of the constant THREE.LuminanceFormat is 1024 and the value of THREE.LuminanceAlphaFormat is 1025. These values have no further meaning since it could be anything. three.js internally converts them to the actual WebGL constant like so:

    if ( p === LuminanceFormat ) return gl.LUMINANCE; // assuming p is a concrete value of a texture