Unable to create RenderTargetTexture with TEXTUREFORMAT_ALPHA

Hi everybody,
it seems to be impossible to create a RenderTargetTexture (or potentially any Texture) with TEXTUREFORMAT_ALPHA. This can be verified by opening the Inspector in this minimal playground:

The format shows up as RGBA at Scene/Textures/rtt.
I think this happens due to the enum value of TEXTUREFORMAT_ALPHA being 0 and the constructor of Texture checking the format option for truthiness instead of nullishness at Babylon.js/packages/dev/core/src/Materials/Textures/texture.ts at 13d0e6df24ed2c4373c423ef186004c5a697a687 · BabylonJS/Babylon.js · GitHub
Is it worth opening a github issue or pull request for this?

Welcome aboard!

You are right about checking the format. This PR will fix it:

However, TEXTUREFORMAT_ALPHA is not renderable, so even with the fix, if you try to render something into the texture, you will get an error:

image

Hi Evgeni,
thank you very much for that amazingly quick reply and fix!
I guess I won’t be able to use the result of that fix after all, but maybe it’ll spare somebody a headache at some point :wink: