You will find inside Assets/Ressources/Materials the shader files needed for the tutorial
- SolidColor is a simple vertex and pixel shader which output a single color for each fragment
- GeometryShader is a simple geometry shader which will make the underlying geometry grows over time, also apply a smooth gradient based on 2 input properties inside the editor.
- SolidWithShadow same as SolidColor but add an extra include file at the end which will allow the mesh to cast a shadow on the scene, the codes came from a default ShaderGraph file, see in Shader graph's editor "View Generated Shader"
HLSLPROGRAM
// List all the attributes needed in your shader (will be passed to the vertex shader)
// you can see the complete list of these attributes in VaryingMesh.hlsl
#define ATTRIBUTES_NEED_TEXCOORD0
#define ATTRIBUTES_NEED_NORMAL
#define ATTRIBUTES_NEED_TANGENT
// List all the varyings needed in your fragment shader
#define VARYINGS_NEED_TEXCOORD0
#define VARYINGS_NEED_TANGENT_TO_WORLD
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassRenderers.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/VertMesh.hlsl"
float4 _ColorMap_ST;
float4 _Color;
PackedVaryingsType Vert(AttributesMesh inputMesh)
{
VaryingsType varyingsType;
varyingsType.vmesh = VertMesh(inputMesh);
return PackVaryingsType(varyingsType);
}
float4 Frag(PackedVaryingsToPS packedInput) : SV_Target
{
float4 outColor = float4(0.0, 0.2, 0.8, 1.0);
return outColor;
}
#pragma vertex Vert
#pragma fragment Frag
ENDHLSL