Bitmap Output Amount, Offset, RGB Level and Premultiplied Alpha

Bitmap Output Amount, Offset, RGB Level and Premultiplied Alpha

robert3dsmax
Participant Participant
1,564 Views
2 Replies
Message 1 of 3

Bitmap Output Amount, Offset, RGB Level and Premultiplied Alpha

robert3dsmax
Participant
Participant

Dear all,

 

I am tearing my hairs out trying to figure out how the Bitmap Operators work. I want to create them in a hlsl shader and try to figure out how it works:

 

Here is what I have got for Output, Offset and rgb Level:

 

 

Bitmap.rgb *= rgbLevel; 
Bitmap.rgb = clamp(Bitmap.rgb + offset * Bitmap.a, 0, 1);
Bitmap.rgba = Bitmap.rgba * outputAmount;

The Output amount seams not to be correct, the Color is different from the Max material.

 


Does anybody know where I can find the resources how 3dsmax treats the Bitmap internally?

 

Thank you much


Robert

0 Likes
Accepted solutions (1)
1,565 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Is the output of your shader just darker/brighter than the Max material? Then you'll probably need to do gamma correction

 

float gamma = 2.2;
Bitmap.rgb = pow(Bitmap.rgb, vec3(1.0/gamma));
0 Likes
Message 3 of 3

robert3dsmax
Participant
Participant
Accepted solution

Thank you for your answer and my very late reply. I fixed it that time (I hope), the order is important as well:

 

//rgbLevel:

bitmap.rgb =  bitmap.rgb * rgbLevel;

//offset:

bitmap.rgb = bitmap.rgb + offset * bitmap.a;

//outputAmount:

bitmap.rgba = bitmap.rgba * outputAmount;

//inbetween clamp:

bitmap.rgba = clamp(bitmap.rgba, 0.0, 1.0);

//invert
bitmap.rgb = 1.0 - bitmap.rgb;
//clamp
bitmap.rgba = clamp(bitmap.rgba, 0, 1);
//alpha from rgb Amount
bitmap.a = (bitmap.r + bitmap.g + bitmap.b) / 3.0;

0 Likes