Hi all,
I am having problems using the BitMask material function - or even recreating what it does;
Let say I am using the Red Channel of a texture, as a mask, however I only want to use the mask where the Red Value = 0, consider the below scenario:
As you can see, by previewing the BitMask node, it appears to be working as intended: The texture provided is a series of vertical lines with increasing Red Value, from 0, to eventually 255 (brightest lines near the centre of the texture). The BitMask function is correctly returning a value of 1 for where the red = 0 and a value of 0 for everything else.
The problem occurs when I increase the bit from 0. The node wants to accept any number between 0 to 255, I would of thought passing a value of 16 would return the appropriate mask of 1 where red = 16, and 0 everywhere else. However it does not.
Investigating this further - I recreated my own bit mask function (see the original function below) its very simply and works via the IF node:
I believe the issue is due to the circled parameter regarding the equals threshold. Something about the Math seems to mean that 16/255 is slightly off whatever that is in the red value is of the actual texture (which appears to be between 0 - 1). By fiddling with the equals threshold value, I can almost get my desired result - but the resolution is poor (can not distinguish between a red value smaller than 32) It is also no predictable, eg asking for mask value 16 will give me the red values >128… asking for mask value 15 would give me red values ~50-80… weird stuff like that.
Could this be something to do with how the colours are stored? i.e. maybe the 0-1 values are the stored coloured squared values, whereas the 0-255 isn’t squared?
Has anyone tried doing this before? I feel like I missing something simple or committing some trick for new players (Somewhat of a Unreal4 novice)
Any help appreciated! Cheers.