three-nebula
three-nebula copied to clipboard
GPURenderer transparent vs non-transparent texture issue
Currently non transparent textures will be given background colours when the GPURenderer is used in a three WebGLRenderer alpha: true
context.

^ Notice how every texture other than the middle one has a black square background.
This can be "solved" in two ways. Firstly, turn alpha: true
off for the WebGLRenderer. Not ideal, as the user may want to have a transparent canvas.
Secondly, we could change the fragment shader gl_FragColor
calculation from
gl_FragColor = gl_FragColor * texture2D(uTexture, uv)
to
gl_FragColor = gl_FragColor * texture2D(uTexture, uv).rgbr
However this borks transparent textures

^ Notice how the middle texture looks completely different now to the first image.
We do need to support both, so for now, we will leave things as is and ask users to do alpha: false
if they are using non transparent textures, saying the alternative is not supported right now.