Hi,
There is a character in my space for which I want to cast shadows on the meshes generated using spatial mapping. I am able to visualize the shadows on the mesh when using the default green material for the meshes as shown below:
For the Occlusion, I am using the following Occlusion Shader :
Shader "Universal Render Pipeline/VR/SpatialMapping/Occlusion"
{
SubShader
{
Tags { "RenderPipeline" = "UniversalPipeline" "Queue" = "Geometry-1" }
LOD 100
ZWrite On
ZTest LEqual
Colormask 0
Cull Off
Pass
{
Name "Spatial Mapping Occlusion"
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
// -------------------------------------
// Unity defined keywords
#pragma multi_compile_instancing
#include "UnlitInput.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 vertex : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
Varyings vert(Attributes input)
{
Varyings output = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
output.vertex = vertexInput.positionCS;
return output;
}
half4 frag(Varyings input) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(input);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
return half4(0,0,0,0);
}
ENDHLSL
}
}
FallBack "Hidden/Universal Render Pipeline/FallbackError"
}
When I switch to the Occlusion shader, there is no shadow received as seen below:
The occlusion aspect works fine; however I also want to enable shadows for the character. Can you please provide some insights on this matter? Thanks.