浏览代码

Segmentation Alpha Bug Fix (#53)

* Segmentation Alpha Bug Fix

Capped the max opacity allowed in the shader to an extremely high value (0.995) to stop a weird issue caused by alpha being set to 1.0

* Segmentation Alpha Bug Fix

Capped the max opacity allowed in the shader to an extremely high value (0.995) to stop a weird issue caused by alpha being set to 1.0. Incorporated the suggestion on how to clean up shader code
/main
GitHub 4 年前
当前提交
e9398442
共有 1 个文件被更改,包括 5 次插入13 次删除
  1. 18
      com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegRemoveBackgroundShader.shader

18
com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegRemoveBackgroundShader.shader


Shader "Perception/SegRemoveBackgroundShader"
Shader "Perception/SegRemoveBackgroundShader"
{
Properties
{

// sample the texture
fixed4 col = tex2D(_MainTex, i.uv);
if (abs(col.r - _RemoveColor.r) < .01f)
{
if (abs(col.g - _RemoveColor.g) < .01f)
{
if (abs(col.b - _RemoveColor.b) < .01f)
{
col.a = _BackTransparency;
}
}
}
if (abs(col.a - _BackTransparency) > .01f) col.a = _SegmentTransparency;
if (abs(col.r - _RemoveColor.r) < .001f && abs(col.g - _RemoveColor.g) < .001f && abs(col.b - _RemoveColor.b) < .001f)
col.a = _BackTransparency;
else
col.a = _SegmentTransparency;
return col;
}

正在加载...
取消
保存