Hi I trying to make a shader to make an outline like toons or something like that. But in the .hlsl file the compiler mark this error and I don’t understand it
This is the code on hlsl file:
#ifndef BACKFACEOUTLINES_INCLUDED
#define BACKFACEOUTLINES_INCLUDED
// Include helper functions form URP
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
// Data from meshes
struct Attribures {
float4 positionOS : POSITION; // Position in obj space
float3 normalOS : NORMAL; // Normal vector in object space
};
// Output from the vertex functions and input to the fragment function
struct VertexOutput {
float4 positionCS : SV_POSITION; // Position in clip space
};
//Properties
float _Thickness;
float4 _Color;
VertexOutput Vertex(Attributes input) {
VertexOutput output = (VertexOutput)0;
float3 normalOS = input.normalOS;
// Extrude the object space position along a normal vector
float3 posOS = input.positionOS.xyz + normalOS * _Thickness;
// Convert this position to world and clip space
output.positionCS = GetVertexPositionInputs(posOS).positionCS;
return output;
}
float4 Fragment(VertexOutput input) : SV_Target{
return _Color;
}
#endif
The error happens in this line: VertexOutput Vertex(Attributes input)
And this is the code form shader
Shader "Outlines/BackFaceOutlines" {
Properties {
_Thickness("Thickness", Float) = 1
_Color("Color", Color) = (1, 1, 1, 1)
}
SubShader {
Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline" }
Pass
{
Name "Outlines"
// Cull front faces
Cull Front
HLSLPROGRAM
// Standard URP requirements
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
// Register functions
#pragma vertex vert
#pragma fragment frag
// Include logic files
#include "BackFaceOutlines.hlsl"
ENDHLSL
}
}
}
I’m using Unity 2020.3.26f1
Hope can help me.