three-nebula icon indicating copy to clipboard operation
three-nebula copied to clipboard

GPURenderer transparent vs non-transparent texture issue

Open rohan-deshpande opened this issue 4 years ago • 0 comments

Currently non transparent textures will be given background colours when the GPURenderer is used in a three WebGLRenderer alpha: true context.

Screen Shot 2020-11-20 at 7 32 58 am

^ 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

Screen Shot 2020-11-20 at 9 04 25 am

^ 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.

rohan-deshpande avatar Nov 19 '20 22:11 rohan-deshpande