LayaPBRStruct.cginc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. struct VertexInput
  2. {
  3. float4 vertex : POSITION;
  4. half3 normal : NORMAL;
  5. float2 uv0 : TEXCOORD0;
  6. float2 uv1 : TEXCOORD1;
  7. #ifdef _TANGENT_TO_WORLD
  8. half4 tangent : TANGENT;
  9. #endif
  10. };
  11. struct VertexOutputForwardBase
  12. {
  13. float4 pos : SV_POSITION;
  14. float4 tex : TEXCOORD0;
  15. float4 eyeVec: TEXCOORD1;
  16. float4 tangentToWorldAndPackedData[3]:TEXCOORD2;
  17. half4 ambientOrLightmapUV :TEXCOORD5;
  18. UNITY_LIGHTING_COORDS(6, 7)
  19. float3 posWorld : TEXCOORD8;
  20. };
  21. struct LayaFragmentCommonData
  22. {
  23. half3 diffColor, specColor;
  24. half oneMinusReflectivity, smoothness;
  25. float3 normalWorld;
  26. float3 eyeVec;
  27. half alpha;
  28. float3 posWorld;
  29. #if UNITY_STANDARD_SIMPLE
  30. half3 reflUVW;
  31. #endif
  32. #if UNITY_STANDARD_SIMPLE
  33. half3 tangentSpaceNormal;
  34. #endif
  35. };
  36. struct LayaLight
  37. {
  38. half3 color;
  39. half3 dir;
  40. half ndotl;
  41. };
  42. struct LayaIndirect
  43. {
  44. half3 diffuse;
  45. half3 specular;
  46. };
  47. struct LayaGI
  48. {
  49. LayaLight light;
  50. LayaIndirect indirect;
  51. };
  52. struct LayaGIInput
  53. {
  54. LayaLight light;
  55. float3 worldPos;
  56. half3 worldViewDir;
  57. half atten;
  58. half3 ambient;
  59. float4 lightmapUV;
  60. #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) || defined(UNITY_ENABLE_REFLECTION_BUFFERS)
  61. float4 boxMin[2];
  62. #endif
  63. #ifdef UNITY_SPECCUBE_BOX_PROJECTION
  64. float4 boxMax[2];
  65. float4 probePosition[2];
  66. #endif
  67. float4 probeHDR[2];
  68. };
  69. struct Laya_GlossyEnvironmentData
  70. {
  71. half roughness;
  72. half3 reflUVW;
  73. };
  74. struct VertexOutputForwardAdd
  75. {
  76. float4 pos : SV_POSITION;
  77. float4 tex : TEXCOORD0;
  78. float4 eyeVec: TEXCOORD1;
  79. float4 tangentToWorldAndLightDir[3]:TEXCOORD2;
  80. float3 posWorld :TEXCOORD5;
  81. float3 _LightCoord : TEXCOORD6;
  82. float4 _ShadowCoord : TEXCOORD7;
  83. #if defined(PARALLAXTEXTURE)
  84. half3 viewDirForParallax : TEXCOORD8;
  85. #endif
  86. UNITY_FOG_COORDS(9)
  87. };
  88. struct VertexOutputBaseSimple
  89. {
  90. float4 pos : SV_POSITION;
  91. float4 tex : TEXCOORD0;
  92. half4 eyeVec : TEXCOORD1;
  93. half4 ambientOrLightmapUV : TEXCOORD2;
  94. SHADOW_COORDS(3)
  95. half4 fogCoord :TEXCOORD4;
  96. half4 normalWorld : TEXCOORD5;
  97. #ifdef NORMALTEXTURE
  98. half3 tangentSpaceLightDir : TEXCOORD6;
  99. half3 tangentSpaceEyeVec : TEXCOORD7;
  100. #endif
  101. float3 posWorld : TEXCOORD8;
  102. };
  103. struct VertexOutputForwardAddSimple
  104. {
  105. float4 pos : SV_POSITION;
  106. float4 tex : TEXCOORD0;
  107. float3 posWorld : TEXCOORD1;
  108. #if !defined(NORMALTEXTURE)
  109. UNITY_FOG_COORDS_PACKED(2, half4)
  110. #else
  111. UNITY_FOG_COORDS_PACKED(2, half1)
  112. #endif
  113. half3 lightDir : TEXCOORD3;
  114. #if defined(NORMALTEXTURE)
  115. half3 tangentSpaceEyeVec : TEXCOORD4;
  116. #else
  117. half3 normalWorld : TEXCOORD4;
  118. #endif
  119. UNITY_LIGHTING_COORDS(5, 6)
  120. };