float4 EncodeRGBM(float3 rgb)
{
float3 DecodeRGBM(float4 rgbm)
{
{
float maxRGB = max(rgb.x,max(rgb.g,rgb.b));
float M = maxRGB / MaxRange;
M = ceil(M * 255.0) / 255.0;
return float4(rgb / (M * MaxRange ), M);
float M = maxRGB / MaxRange;
M = ceil(M * 255.0) / 255.0;
return float4(rgb / (M * MaxRange ), M);
}
float3 DecodeRGBM(float4 rgbm)
{
return rgbm.rgb * (rgbm.a * MaxRange );
}
float4 EncodeRGBD(float3 rgb)
{
float4 EncodeRGBD(float3 rgb)
{
float maxRGB = max(rgb.x,max(rgb.g,rgb.b));
float D = max(MaxRange / maxRGB, 1);
D = saturate(floor(D) / 255.0);
return float4(rgb.rgb * (D * (255.0 / MaxRange)), D);
float D = max(MaxRange / maxRGB, 1);
D = saturate(floor(D) / 255.0);
return float4(rgb.rgb * (D * (255.0 / MaxRange)), D);
}
float3 DecodeRGBD(float4 rgbd)
{
{
return rgbd.rgb * ((MaxRange / 255.0) / rgbd.a);
}
'Misc' 카테고리의 다른 글
| RGBM & RGBD (0) | 2011/08/25 |
|---|---|
| Unsharp mask (0) | 2009/10/07 |

Prev
Rss Feed