Shader "Custom/URP/HoleEffect"
{
Properties
{
_Color("Main Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType" = "Opaque" "Queue" = "Geometry+2" }
// Render pipeline settings for URP
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
// Surface color property
float4 _Color;
// Define vertex and fragment input/output structures
struct InputV
{
float4 position : POSITION;
float3 normal : NORMAL;
};
struct OutputI
{
float4 position : SV_POSITION;
float3 worldNormal : NORMAL;
};
// Vertex shader
OutputI vert(InputV v)
{
OutputI o;
o.position = TransformObjectToHClip(v.position);
o.worldNormal = TransformObjectToWorldNormal(v.normal);
return o;
}
// Fragment shader
half4 frag(OutputI i) : SV_Target
{
half4 color = _Color;
color.a = 1;
return color;
}
ENDHLSL
Stencil
{
Ref 1
Comp Equal
Pass Keep
}
// Render settings
ZWrite On
Cull Front // Culls front faces to make the hole visible
}
FallBack "Diffuse"
}
In this code
Shader error in ‘’: Parse error: syntax error, unexpected ‘}’ at line 63
An error has occurred. What is the solution?
Add images