If alpha is 0, RGB is 0 even with premultipyAlpha to false

Hi,

I have a 3D model with a RGBA texture where the alpha value should be ignored (I must use those alpha values differently for some reflections effects).

PNG specs say : colors are not premultiplied by alpha.

Then, in shaders we should be able to ignore alpha values and only displaying RGB colors.

I tried many things, disabling premultipliedAlpha in WebGLRenderer, Textures and Material but RGB values are 0 if alpha is 0.

In the example below, the models should have skin colored hands and neck but appear white.
On the center texture is loaded natively by the FBXLoader.
On the right texture is loaded by the TextureLoader.
On the left another texture without alpha is loaded by the TextureLoader for demonstration purpose.

Codesandbox

What I am doing wrong ? Is that a WebGL or THREE limitation ?

PS: using 2 textures is not an option

Works for me, Win10 / Brave, maybe something related to your system / browser ?

image

2 Likes

@tfoller This confirms it, on Ubuntu 22.04, Firefox at the top, Chromium at the bottom, the funny thing is that brave is chromium based (may be windows version).

1 Like

Can you refresh your browser ? I think that a compression happens when the image is cached (in browser or cdn)

Yes, it looks like if I refresh the browser a couple times, I start seeing the issue. Probably because of an unusual internal file format that is not preserved in the cached copy.

1 Like

I have a feeling that they also share the cache or maybe it happens at the OS level.

1 Like

@tfoller
Q: Does google chrome and brave share the same cache?

ChatGPT:

Google Chrome and Brave are both Chromium-based browsers, which means they share many similarities in terms of functionality and features. However, each browser maintains its own cache directory, and the files stored in one browser’s cache directory are not accessible to the other browser. However, it is possible to change the default cache directory for either browser, which would allow them to share the same cache.

This thing never fails to entertain me :laughing:

Yesterday, this thing wrote a JS function for matrix inversion, that is faster than I had. Damn it :wink:

1 Like

I know how you feel, It took me half a day writing a queue system for some async methods, then I asked it, it took it 6 seconds to make me feel obsolete.

1 Like