I am trying to get a shader to work for rendering entities with an object render pass for object picking. It is supposed to render every entity in a fixed color, but it only considers some faces and the box on the left does not even have entities behind it.
Using a Shadergraph-Shader instead renders the correct parts of the screen (but has color inaccuracies), so my assumption was that something in this shader is missing. What am I doing wrong here?
Shader "ObjectPicking/TestDotsSimple"
{
SubShader
{
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" }
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 4.5
#pragma multi_compile _ DOTS_INSTANCING_ON
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
};
struct Varyings
{
float4 positionHCS : SV_POSITION;
};
Varyings vert(Attributes IN)
{
Varyings OUT;
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
return OUT;
}
float4 frag() : SV_Target
{
return float4(0,0,1,0);
}
ENDHLSL
}
}
}