pbrFragmentSamplersDeclaration.fx 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #ifdef ALBEDO
  2. #if ALBEDODIRECTUV == 1
  3. #define vAlbedoUV vMainUV1
  4. #elif ALBEDODIRECTUV == 2
  5. #define vAlbedoUV vMainUV2
  6. #else
  7. varying vec2 vAlbedoUV;
  8. #endif
  9. uniform sampler2D albedoSampler;
  10. #endif
  11. #ifdef AMBIENT
  12. #if AMBIENTDIRECTUV == 1
  13. #define vAmbientUV vMainUV1
  14. #elif AMBIENTDIRECTUV == 2
  15. #define vAmbientUV vMainUV2
  16. #else
  17. varying vec2 vAmbientUV;
  18. #endif
  19. uniform sampler2D ambientSampler;
  20. #endif
  21. #ifdef OPACITY
  22. #if OPACITYDIRECTUV == 1
  23. #define vOpacityUV vMainUV1
  24. #elif OPACITYDIRECTUV == 2
  25. #define vOpacityUV vMainUV2
  26. #else
  27. varying vec2 vOpacityUV;
  28. #endif
  29. uniform sampler2D opacitySampler;
  30. #endif
  31. #ifdef EMISSIVE
  32. #if EMISSIVEDIRECTUV == 1
  33. #define vEmissiveUV vMainUV1
  34. #elif EMISSIVEDIRECTUV == 2
  35. #define vEmissiveUV vMainUV2
  36. #else
  37. varying vec2 vEmissiveUV;
  38. #endif
  39. uniform sampler2D emissiveSampler;
  40. #endif
  41. #ifdef LIGHTMAP
  42. #if LIGHTMAPDIRECTUV == 1
  43. #define vLightmapUV vMainUV1
  44. #elif LIGHTMAPDIRECTUV == 2
  45. #define vLightmapUV vMainUV2
  46. #else
  47. varying vec2 vLightmapUV;
  48. #endif
  49. uniform sampler2D lightmapSampler;
  50. #endif
  51. #ifdef REFLECTIVITY
  52. #if REFLECTIVITYDIRECTUV == 1
  53. #define vReflectivityUV vMainUV1
  54. #elif REFLECTIVITYDIRECTUV == 2
  55. #define vReflectivityUV vMainUV2
  56. #else
  57. varying vec2 vReflectivityUV;
  58. #endif
  59. uniform sampler2D reflectivitySampler;
  60. #endif
  61. #ifdef MICROSURFACEMAP
  62. #if MICROSURFACEMAPDIRECTUV == 1
  63. #define vMicroSurfaceSamplerUV vMainUV1
  64. #elif MICROSURFACEMAPDIRECTUV == 2
  65. #define vMicroSurfaceSamplerUV vMainUV2
  66. #else
  67. varying vec2 vMicroSurfaceSamplerUV;
  68. #endif
  69. uniform sampler2D microSurfaceSampler;
  70. #endif
  71. #ifdef CLEARCOAT
  72. #ifdef CLEARCOAT_TEXTURE
  73. #if CLEARCOAT_TEXTUREDIRECTUV == 1
  74. #define vClearCoatUV vMainUV1
  75. #elif CLEARCOAT_TEXTUREDIRECTUV == 2
  76. #define vClearCoatUV vMainUV2
  77. #else
  78. varying vec2 vClearCoatUV;
  79. #endif
  80. uniform sampler2D clearCoatSampler;
  81. #endif
  82. #ifdef CLEARCOAT_BUMP
  83. #if CLEARCOAT_BUMPDIRECTUV == 1
  84. #define vClearCoatBumpUV vMainUV1
  85. #elif CLEARCOAT_BUMPDIRECTUV == 2
  86. #define vClearCoatBumpUV vMainUV2
  87. #else
  88. varying vec2 vClearCoatBumpUV;
  89. #endif
  90. uniform sampler2D clearCoatBumpSampler;
  91. #endif
  92. #ifdef CLEARCOAT_TINT_TEXTURE
  93. #if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1
  94. #define vClearCoatTintUV vMainUV1
  95. #elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2
  96. #define vClearCoatTintUV vMainUV2
  97. #else
  98. varying vec2 vClearCoatTintUV;
  99. #endif
  100. uniform sampler2D clearCoatTintSampler;
  101. #endif
  102. #endif
  103. #ifdef SHEEN
  104. #ifdef SHEEN_TEXTURE
  105. #if SHEEN_TEXTUREDIRECTUV == 1
  106. #define vSheenUV vMainUV1
  107. #elif SHEEN_TEXTUREDIRECTUV == 2
  108. #define vSheenUV vMainUV2
  109. #else
  110. varying vec2 vSheenUV;
  111. #endif
  112. uniform sampler2D sheenSampler;
  113. #endif
  114. #endif
  115. #ifdef ANISOTROPIC
  116. #ifdef ANISOTROPIC_TEXTURE
  117. #if ANISOTROPIC_TEXTUREDIRECTUV == 1
  118. #define vAnisotropyUV vMainUV1
  119. #elif ANISOTROPIC_TEXTUREDIRECTUV == 2
  120. #define vAnisotropyUV vMainUV2
  121. #else
  122. varying vec2 vAnisotropyUV;
  123. #endif
  124. uniform sampler2D anisotropySampler;
  125. #endif
  126. #endif
  127. // Refraction
  128. #ifdef REFRACTION
  129. #ifdef REFRACTIONMAP_3D
  130. #define sampleRefraction(s, c) textureCube(s, c)
  131. uniform samplerCube refractionSampler;
  132. #ifdef LODBASEDMICROSFURACE
  133. #define sampleRefractionLod(s, c, l) textureCubeLodEXT(s, c, l)
  134. #else
  135. uniform samplerCube refractionSamplerLow;
  136. uniform samplerCube refractionSamplerHigh;
  137. #endif
  138. #else
  139. #define sampleRefraction(s, c) texture2D(s, c)
  140. uniform sampler2D refractionSampler;
  141. #ifdef LODBASEDMICROSFURACE
  142. #define sampleRefractionLod(s, c, l) texture2DLodEXT(s, c, l)
  143. #else
  144. uniform samplerCube refractionSamplerLow;
  145. uniform samplerCube refractionSamplerHigh;
  146. #endif
  147. #endif
  148. #endif
  149. // Reflection
  150. #ifdef REFLECTION
  151. #ifdef REFLECTIONMAP_3D
  152. #define sampleReflection(s, c) textureCube(s, c)
  153. uniform samplerCube reflectionSampler;
  154. #ifdef LODBASEDMICROSFURACE
  155. #define sampleReflectionLod(s, c, l) textureCubeLodEXT(s, c, l)
  156. #else
  157. uniform samplerCube reflectionSamplerLow;
  158. uniform samplerCube reflectionSamplerHigh;
  159. #endif
  160. #else
  161. #define sampleReflection(s, c) texture2D(s, c)
  162. uniform sampler2D reflectionSampler;
  163. #ifdef LODBASEDMICROSFURACE
  164. #define sampleReflectionLod(s, c, l) texture2DLodEXT(s, c, l)
  165. #else
  166. uniform samplerCube reflectionSamplerLow;
  167. uniform samplerCube reflectionSamplerHigh;
  168. #endif
  169. #endif
  170. #ifdef REFLECTIONMAP_SKYBOX
  171. varying vec3 vPositionUVW;
  172. #else
  173. #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
  174. varying vec3 vDirectionW;
  175. #endif
  176. #endif
  177. #endif
  178. #ifdef ENVIRONMENTBRDF
  179. uniform sampler2D environmentBrdfSampler;
  180. #endif