浏览代码

added color override to unlabeled objects

/local-position-labeler
sleal-unity 4 年前
当前提交
eca1399b
共有 2 个文件被更改,包括 9 次插入3 次删除
  1. 7
      com.unity.perception/Runtime/GroundTruth/RenderPasses/CrossPipelinePasses/LocalPositionCrossPipelinePass.cs
  2. 5
      com.unity.perception/Runtime/GroundTruth/Resources/LocalPosition.shader

7
com.unity.perception/Runtime/GroundTruth/RenderPasses/CrossPipelinePasses/LocalPositionCrossPipelinePass.cs


class LocalPositionCrossPipelinePass : GroundTruthCrossPipelinePass
{
const string k_ShaderName = "Perception/LocalPosition";
static readonly int k_Override = Shader.PropertyToID("_Override");
static readonly int k_Center = Shader.PropertyToID("_Center");
static readonly int k_Size = Shader.PropertyToID("_Size");

MaterialPropertyBlock mpb, Renderer renderer, Labeling labeling, uint instanceId)
{
var bounds = renderer.GetComponentInChildren<MeshFilter>().sharedMesh.bounds;
mpb.SetColor(k_Override, Color.white);
public override void ClearMaterialProperties(MaterialPropertyBlock mpb, Renderer renderer, Labeling labeling, uint instanceId)
public override void ClearMaterialProperties(
MaterialPropertyBlock mpb, Renderer renderer, Labeling labeling, uint instanceId)
// mpb.SetVector(k_Center, Color.black);
mpb.SetColor(k_Override, Color.black);
}
}
}

5
com.unity.perception/Runtime/GroundTruth/Resources/LocalPosition.shader


{
_Center ("Center", Vector) = (0, 0, 0, 0)
_Size ("Size", Vector) = (1, 1, 1, 0)
_Override ("Override", Color) = (0, 0, 0, 1)
}
HLSLINCLUDE

float4 _Center;
float4 _Size;
fixed4 _Override;
struct app_to_vertex
{
float4 vertex : POSITION;

o.vertex = UnityObjectToClipPos(input.vertex);
o.vertex_object_space = (input.vertex - _Center) / _Size + float4(0.5, 0.5, 0.5, 1);
o.vertex_object_space.w = 1;
o.vertex_object_space = o.vertex_object_space * _Override;
return o;
}

正在加载...
取消
保存