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.
37 lines
895 B
37 lines
895 B
1 year ago
|
#pragma kernel EstimatePointCloudPosOfs
|
||
|
|
||
|
uint2 PointCloudRes;
|
||
|
//float2 SpaceScale;
|
||
|
float3 ImuUpVector;
|
||
|
|
||
|
uint MinDepth;
|
||
|
uint MaxDepth;
|
||
|
|
||
|
StructuredBuffer<float> SpaceTable;
|
||
|
StructuredBuffer<uint> DepthMap;
|
||
|
|
||
|
RWStructuredBuffer<float3> PointCloudPos;
|
||
|
RWStructuredBuffer<float> PointCloudOfs;
|
||
|
RWStructuredBuffer<bool> PointCloudMask;
|
||
|
|
||
|
|
||
|
[numthreads(8, 8, 1)]
|
||
|
void EstimatePointCloudPosOfs(uint3 id : SV_DispatchThreadID)
|
||
|
{
|
||
|
uint i = id.x + id.y * PointCloudRes.x;
|
||
|
|
||
|
uint depth2 = DepthMap[i >> 1];
|
||
|
uint depth = i & 1 != 0 ? depth2 >> 16 : depth2 & 0xffff;
|
||
|
depth = (depth >= MinDepth && depth <= MaxDepth) * depth;
|
||
|
|
||
|
float fDepth = (float)depth / 1000.0;
|
||
|
bool mask = depth != 0;
|
||
|
|
||
|
float3 pos = float3(SpaceTable[i * 3] * fDepth, SpaceTable[i * 3 + 1] * fDepth, fDepth);
|
||
|
float ofs = dot(ImuUpVector, pos) * mask;
|
||
|
|
||
|
PointCloudPos[i] = pos;
|
||
|
PointCloudOfs[i] = ofs;
|
||
|
PointCloudMask[i] = mask;
|
||
|
}
|