-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Description
Hi! I'm trying to add a depth camera simulation to AWSIM as part of a university project. I prepared a shader based on a different project that involved depth rendering I found on the internet, and it works for this version of Unity (tested in a blank project). This is what the shader looks like:
Shader "Hidden/DepthShader"
{
Properties
{
_MainTex ("", 2D) = "white" {}
}
SubShader
{
CGINCLUDE
float4 Output(float depth01)
{
float k = 0.25;
return depth01;
}
ENDCG
Tags { "RenderType" = "Opaque" }
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f
{
float4 pos : SV_POSITION;
float depth : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata_base v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = UnityObjectToClipPos(v.vertex);
o.depth = COMPUTE_DEPTH_01;
return o;
}
fixed4 frag(v2f i) : SV_Target
{
return Output(i.depth);
}
ENDCG
}
}
Fallback Off
}
The problem is, it doesn't seem to work inside AWSIM project - my guess is that it's because of the render pipeline. Since I'm not familiar with the render pipeline used in AWSIM, are there any tips or ways to make the shader work inside AWSIM project? Or are there other recommended ways to generate a depth image in Unity, more suitable for AWSIM? Any help is appreciated.
Metadata
Metadata
Assignees
Labels
No labels