Jon Hogins
4 年前
当前提交
9a8f7ac3
共有 7 个文件被更改,包括 65 次插入 和 144 次删除
-
22com.unity.perception/Runtime/GroundTruth/Labelers/KeypointLabeler.cs
-
58com.unity.perception/Runtime/GroundTruth/Resources/KeypointDepthCheckHDRP.shader
-
18com.unity.perception/Tests/Runtime/GroundTruthTests/KeypointGroundTruthTests.cs
-
3com.unity.perception/Runtime/GroundTruth/Resources/KeypointDepthCheck.shader.meta
-
17com.unity.perception/Runtime/GroundTruth/Resources/KeypointDepthTest.compute
-
8com.unity.perception/Runtime/GroundTruth/Resources/KeypointDepthTest.compute.meta
-
83com.unity.perception/Runtime/GroundTruth/Resources/KeypointDepthCheck.shader
|
|||
fileFormatVersion: 2 |
|||
guid: 5fd132f5a09c4301b4c9004b241e2659 |
|||
timeCreated: 1618585131 |
|
|||
// Each #kernel tells which function to compile; you can have many kernels |
|||
#pragma kernel CSMain |
|||
|
|||
// Create a RenderTexture with enableRandomWrite flag and set it |
|||
// with cs.SetTexture |
|||
|
|||
StructuredBuffer<float3> CheckPositions; |
|||
Texture3D<float4> DepthBuffer; |
|||
RWStructuredBuffer<uint> CheckResults; |
|||
|
|||
[numthreads(16,1,1)] |
|||
void CSMain (uint3 id : SV_DispatchThreadID) |
|||
{ |
|||
float3 checkPosition = CheckPositions[id.x]; |
|||
uint result = DepthBuffer[float3(checkPosition.x, checkPosition.y, 0)] < checkPosition.z - .001 ? 0 : 1; |
|||
CheckResults[id.x] = result; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c78354f07f15bac48977fc60cc5082c9 |
|||
ComputeShaderImporter: |
|||
externalObjects: {} |
|||
currentAPIMask: 4 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Shader "Perception/KeypointDepthCheckOld" |
|||
{ |
|||
Properties |
|||
{ |
|||
_Positions("Positions", 2D) = "defaultTexture" {} |
|||
_KeypointDepth("KeypointDepth", 2D) = "defaultTexture" {} |
|||
_DepthTexture("Depth", 2DArray) = "defaultTexture" {} |
|||
} |
|||
|
|||
HLSLINCLUDE |
|||
|
|||
#pragma target 4.5 |
|||
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch |
|||
|
|||
//enable GPU instancing support |
|||
#pragma multi_compile_instancing |
|||
|
|||
ENDHLSL |
|||
|
|||
SubShader |
|||
{ |
|||
Tags { "RenderType"="Opaque" } |
|||
LOD 100 |
|||
|
|||
Pass |
|||
{ |
|||
Tags { "LightMode" = "SRP" } |
|||
|
|||
Blend Off |
|||
ZWrite On |
|||
ZTest LEqual |
|||
|
|||
Cull Back |
|||
|
|||
CGPROGRAM |
|||
|
|||
#pragma vertex depthCheckVertexStage |
|||
#pragma fragment depthCheckFragmentStage |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
UNITY_DECLARE_TEX2DARRAY(_DepthTexture); |
|||
//sampler2D _CameraDepthTexture; |
|||
|
|||
Texture2D _Positions; |
|||
SamplerState my_point_clamp_sampler; |
|||
Texture2D _KeypointDepth; |
|||
|
|||
struct in_vert |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
}; |
|||
|
|||
struct vertexToFragment |
|||
{ |
|||
float4 vertex : SV_POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
}; |
|||
|
|||
vertexToFragment depthCheckVertexStage (in_vert vertWorldSpace) |
|||
{ |
|||
vertexToFragment vertScreenSpace; |
|||
vertScreenSpace.vertex = UnityObjectToClipPos(vertWorldSpace.vertex); |
|||
vertScreenSpace.uv = vertWorldSpace.uv; |
|||
return vertScreenSpace; |
|||
} |
|||
|
|||
fixed4 depthCheckFragmentStage (vertexToFragment vertScreenSpace) : SV_Target |
|||
{ |
|||
float4 checkPosition = _Positions.Sample(my_point_clamp_sampler, vertScreenSpace.uv); |
|||
float4 checkDepth = _KeypointDepth.Sample(my_point_clamp_sampler, vertScreenSpace.uv); |
|||
float depth = UNITY_SAMPLE_TEX2DARRAY(_DepthTexture, float3(checkPosition.xy, 0)).r; //SAMPLE_DEPTH_TEXTURE(_DepthTexture, checkPosition.xy); |
|||
//float depth_decoded = LinearEyeDepth(depth); |
|||
float depth_decoded = Linear01Depth(depth); |
|||
uint result = depth_decoded < checkDepth.x - .001 ? 0 : 1; |
|||
return fixed4(result, result, result, result); |
|||
} |
|||
|
|||
ENDCG |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue