浏览代码

WIP self-occlusion checks.

/keypoint_self_occlusion
Jon Hogins 4 年前
当前提交
fb1f5a6a
共有 1 个文件被更改,包括 24 次插入0 次删除
  1. 24
      com.unity.perception/Runtime/GroundTruth/Labelers/KeypointLabeler.cs

24
com.unity.perception/Runtime/GroundTruth/Labelers/KeypointLabeler.cs


/// </summary>
public List<AnimationPoseConfig> animationPoseConfigs;
private ComputeShader m_KeypointDepthTestShader;
/// <inheritdoc/>

m_AsyncAnnotations = new Dictionary<int, (AsyncAnnotation, Dictionary<uint, KeypointEntry>)>();
m_KeypointEntriesToReport = new List<KeypointEntry>();
m_CurrentFrame = 0;
m_KeypointDepthTestShader = (ComputeShader) Resources.Load("KeypointDepthTest");
perceptionCamera.InstanceSegmentationImageReadback += OnInstanceSegmentationImageReadback;
perceptionCamera.RenderedObjectInfosCalculated += OnRenderedObjectInfoReadback;

asyncAnnotation.annotation.ReportValues(m_KeypointEntriesToReport);
}
struct KeypointDepthCheckData
{
private float3 position;
}
/// <param name="scriptableRenderContext"></param>
/// <inheritdoc/>
protected override void OnEndRendering(ScriptableRenderContext scriptableRenderContext)

foreach (var label in LabelManager.singleton.registeredLabels)
ProcessLabel(label);
var keypointCount = keypoints.Count * activeTemplate.keypoints.Length;
var commandBuffer = CommandBufferPool.Get();
var depthTexture = Shader.GetGlobalTexture("_CameraDepthTexture");
commandBuffer.SetComputeTextureParam(m_KeypointDepthTestShader, 0, "depth", depthTexture);
var keypointDepthCheckData =
new NativeArray<KeypointDepthCheckData>(keypointCount, Allocator.Temp, NativeArrayOptions.UninitializedMemory);
var keypointDataComputeBuffer = new ComputeBuffer(keypointCount, 4, ComputeBufferType.Default, ComputeBufferMode.Dynamic);
keypointDataComputeBuffer.SetData(keypointDepthCheckData);
var resultsComputeBuffer = new ComputeBuffer(keypointCount, 4, ComputeBufferType.Default, ComputeBufferMode.Dynamic);
commandBuffer.SetComputeBufferParam(m_KeypointDepthTestShader, 0, "keypoints", keypointDataComputeBuffer);
commandBuffer.DispatchCompute(m_KeypointDepthTestShader, 0, keypointCount, 1, 1);
scriptableRenderContext.ExecuteCommandBuffer(commandBuffer);
CommandBufferPool.Release(commandBuffer);
}
// ReSharper disable InconsistentNaming

正在加载...
取消
保存