[ad_1]
I am unable to get my colours again.
What I’m utilizing to encode/decode:
static const float Scale = 255.0f;//or 256 not working both
static const float Scale2 = Scale*Scale;
static const float Scale3 = Scale2*Scale;
static const float Scale4 = Scale3*Scale;
static const float4 bitSh = float4( 1.0f, Scale, Scale2, Scale3);
static const float4 bitMsk = float4(1.0f/Scale, 1.0f/Scale, 1.0f/Scale, 0);
static const float4 bitShifts = float4(1.0, 1.0/Scale, 1.0/Scale2, 1.0/Scale3);
RGBA to Float to be saved as R16_FLOAT or UNORM (I’ve tried each none works effective)
float C16 = dot(Color, bitShifts);
Output.Color = C16;
float to RGBA
float4 C16 = txDiffuse.Load(int3(960*Input.Tex.x, 540*Input.Tex.y, 0)).r*bitSh;
float4 rgba = frac(C16);
rgba -=rgba.yzww*bitMsk;
float4 Color = rgba;
As defined right here some further modifications can be utilized to take care about preŃision. What I’ve when manipulating the rgb is both a full pink or full blue scene. There can also be an issue with the frac outcome that offers flickering random colours.
The bitXXX information could be reversed (e.g. xyzw values are in wzyx order) however the outcomes are the identical.
[ad_2]