dwelling act 4 (live motion cap w/ kinect azure)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

52 lines
1012 B

#pragma kernel BakeColorInfrared
uint2 _ColorRes;
uint2 _DepthRes;
StructuredBuffer<uint> _InfraredMap;
StructuredBuffer<float> _Color2DepthMap;
RWStructuredBuffer<uint> _ColorInfraredMap;
[numthreads(8, 8, 1)]
void BakeColorInfrared(uint3 id : SV_DispatchThreadID)
{
//if (id.x & 1 == 0)
{
// depth0
uint ci = id.x + id.y * _ColorRes.x;
uint ir = 0;
if (!isinf(_Color2DepthMap[ci << 1]))
{
int dx = _Color2DepthMap[ci << 1];
int dy = _Color2DepthMap[(ci << 1) + 1];
uint di = dx + dy * _DepthRes.x;
uint ir2 = _InfraredMap[di >> 1];
ir = di & 1 != 0 ? ir2 >> 16 : ir2 & 0xffff;
}
uint cir0 = ir;
// depth1
uint ci1 = ci + 1;
ir = 0;
if (!isinf(_Color2DepthMap[ci1 << 1]))
{
int dx = _Color2DepthMap[ci1 << 1];
int dy = _Color2DepthMap[(ci1 << 1) + 1];
uint di = dx + dy * _DepthRes.x;
uint ir2 = _InfraredMap[di >> 1];
ir = di & 1 != 0 ? ir2 >> 16 : ir2 & 0xffff;
}
uint cir1 = ir << 16;
_ColorInfraredMap[ci >> 1] = cir0 | cir1;
}
}