-dane-

OutlineShared.hlsl

Sep 27th, 2021 (edited)
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This file is just some shared placeholder attributes and varyings for Outline Post Process
  2.  
  3. // I've included some informative comments from Colin Leung's example URPToonLitShader which has some interesting organization.
  4. // https://github.com/ColinLeung-NiloCat/UnityURPToonLitShaderExample/blob/master/SimpleURPToonLitOutlineExample_Shared.hlsl
  5.  
  6. // #pragma once is a safe guard best practice in almost every .hlsl (need Unity2020 or up),
  7. // doing this can make sure your .hlsl's user can include this .hlsl anywhere anytime without producing any multi include conflict
  8. #pragma once
  9.  
  10. // We don't have "UnityCG.cginc" in SRP/URP's package anymore, so:
  11. // Including the following two hlsl files is enough for shading with Universal Pipeline. Everything is included in them.
  12. // Core.hlsl will include SRP shader library, all constant buffers not related to materials (perobject, percamera, perframe).
  13. // It also includes matrix/space conversion functions and fog.
  14. // Lighting.hlsl will include the light functions/data to abstract light constants. You should use GetMainLight and GetLight functions
  15. // that initialize Light struct. Lighting.hlsl also include GI, Light BDRF functions. It also includes Shadows.
  16.  
  17. // Required by all Universal Render Pipeline shaders.
  18. // It will include Unity built-in shader variables (except the lighting variables)
  19. // (https://docs.unity3d.com/Manual/SL-UnityShaderVariables.html
  20. // It will also include many utilitary functions.
  21. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  22.  
  23. // Include this if you are doing a lit shader. This includes lighting shader variables,
  24. // lighting and shadow functions
  25. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  26.  
  27. struct Attributes
  28. {
  29.     float4 positionOS : POSITION;
  30.     float2 uv : TEXCOORD0;
  31. };
  32.  
  33. struct Varyings
  34. {
  35.     float4 positionHCS : SV_POSITION;
  36.     float2 uv : TEXCOORD0;
  37. };
  38.  
Add Comment
Please, Sign In to add comment