Lighting.j3md 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. MaterialDef Phong Lighting {
  2. MaterialParameters {
  3. // Compute vertex lighting in the shader
  4. // For better performance
  5. Boolean VertexLighting
  6. // Use more efficent algorithms to improve performance
  7. Boolean LowQuality
  8. // Improve quality at the cost of performance
  9. Boolean HighQuality
  10. // Output alpha from the diffuse map
  11. Boolean UseAlpha
  12. // Alpha threshold for fragment discarding
  13. Float AlphaDiscardThreshold (AlphaTestFallOff)
  14. // Normal map is in BC5/ATI2n/LATC/3Dc compression format
  15. Boolean LATC
  16. // Use the provided ambient, diffuse, and specular colors
  17. Boolean UseMaterialColors
  18. // Activate shading along the tangent, instead of the normal
  19. // Requires tangent data to be available on the model.
  20. Boolean VTangent
  21. // Use minnaert diffuse instead of lambert
  22. Boolean Minnaert
  23. // Use ward specular instead of phong
  24. Boolean WardIso
  25. // Use vertex color as an additional diffuse color.
  26. Boolean UseVertexColor
  27. // Ambient color
  28. Color Ambient (MaterialAmbient)
  29. // Diffuse color
  30. Color Diffuse (MaterialDiffuse)
  31. // Specular color
  32. Color Specular (MaterialSpecular)
  33. // Specular power/shininess
  34. Float Shininess (MaterialShininess) : 1
  35. // Diffuse map
  36. Texture2D DiffuseMap
  37. // Normal map
  38. Texture2D NormalMap
  39. // Specular/gloss map
  40. Texture2D SpecularMap
  41. // Parallax/height map
  42. Texture2D ParallaxMap
  43. //Set to true is parallax map is stored in the alpha channel of the normal map
  44. Boolean PackedNormalParallax
  45. //Sets the relief height for parallax mapping
  46. Float ParallaxHeight : 0.05
  47. //Set to true to activate Steep Parallax mapping
  48. Boolean SteepParallax
  49. // Texture that specifies alpha values
  50. Texture2D AlphaMap
  51. // Color ramp, will map diffuse and specular values through it.
  52. Texture2D ColorRamp
  53. // Texture of the glowing parts of the material
  54. Texture2D GlowMap
  55. // Set to Use Lightmap
  56. Texture2D LightMap
  57. // Set to use TexCoord2 for the lightmap sampling
  58. Boolean SeparateTexCoord
  59. // The glow color of the object
  60. Color GlowColor
  61. // Parameters for fresnel
  62. // X = bias
  63. // Y = scale
  64. // Z = power
  65. Vector3 FresnelParams
  66. // Env Map for reflection
  67. TextureCubeMap EnvMap
  68. // the env map is a spheremap and not a cube map
  69. Boolean EnvMapAsSphereMap
  70. //shadows
  71. Int FilterMode
  72. Boolean HardwareShadows
  73. Texture2D ShadowMap0
  74. Texture2D ShadowMap1
  75. Texture2D ShadowMap2
  76. Texture2D ShadowMap3
  77. //pointLights
  78. Texture2D ShadowMap4
  79. Texture2D ShadowMap5
  80. Float ShadowIntensity
  81. Vector4 Splits
  82. Vector2 FadeInfo
  83. Matrix4 LightViewProjectionMatrix0
  84. Matrix4 LightViewProjectionMatrix1
  85. Matrix4 LightViewProjectionMatrix2
  86. Matrix4 LightViewProjectionMatrix3
  87. //pointLight
  88. Matrix4 LightViewProjectionMatrix4
  89. Matrix4 LightViewProjectionMatrix5
  90. Vector3 LightPos
  91. Vector3 LightDir
  92. Float PCFEdge
  93. Float ShadowMapSize
  94. // For hardware skinning
  95. Int NumberOfBones
  96. Matrix4Array BoneMatrices
  97. }
  98. Technique {
  99. LightMode MultiPass
  100. VertexShader GLSL100: Common/MatDefs/Light/Lighting.vert
  101. FragmentShader GLSL100: Common/MatDefs/Light/Lighting.frag
  102. WorldParameters {
  103. WorldViewProjectionMatrix
  104. NormalMatrix
  105. WorldViewMatrix
  106. ViewMatrix
  107. CameraPosition
  108. WorldMatrix
  109. }
  110. Defines {
  111. LATC : LATC
  112. VERTEX_COLOR : UseVertexColor
  113. VERTEX_LIGHTING : VertexLighting
  114. ATTENUATION : Attenuation
  115. MATERIAL_COLORS : UseMaterialColors
  116. V_TANGENT : VTangent
  117. MINNAERT : Minnaert
  118. WARDISO : WardIso
  119. LOW_QUALITY : LowQuality
  120. HQ_ATTENUATION : HighQuality
  121. DIFFUSEMAP : DiffuseMap
  122. NORMALMAP : NormalMap
  123. SPECULARMAP : SpecularMap
  124. PARALLAXMAP : ParallaxMap
  125. NORMALMAP_PARALLAX : PackedNormalParallax
  126. STEEP_PARALLAX : SteepParallax
  127. ALPHAMAP : AlphaMap
  128. COLORRAMP : ColorRamp
  129. LIGHTMAP : LightMap
  130. SEPARATE_TEXCOORD : SeparateTexCoord
  131. USE_REFLECTION : EnvMap
  132. SPHERE_MAP : SphereMap
  133. NUM_BONES : NumberOfBones
  134. }
  135. }
  136. Technique PreShadow {
  137. VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
  138. FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
  139. WorldParameters {
  140. WorldViewProjectionMatrix
  141. WorldViewMatrix
  142. }
  143. Defines {
  144. COLOR_MAP : ColorMap
  145. DISCARD_ALPHA : AlphaDiscardThreshold
  146. NUM_BONES : NumberOfBones
  147. }
  148. ForcedRenderState {
  149. FaceCull Off
  150. DepthTest On
  151. DepthWrite On
  152. PolyOffset 5 3
  153. ColorWrite Off
  154. }
  155. }
  156. Technique PostShadow15{
  157. VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow15.vert
  158. FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow15.frag
  159. WorldParameters {
  160. WorldViewProjectionMatrix
  161. WorldMatrix
  162. }
  163. Defines {
  164. HARDWARE_SHADOWS : HardwareShadows
  165. FILTER_MODE : FilterMode
  166. PCFEDGE : PCFEdge
  167. DISCARD_ALPHA : AlphaDiscardThreshold
  168. COLOR_MAP : ColorMap
  169. SHADOWMAP_SIZE : ShadowMapSize
  170. FADE : FadeInfo
  171. PSSM : Splits
  172. POINTLIGHT : LightViewProjectionMatrix5
  173. NUM_BONES : NumberOfBones
  174. }
  175. ForcedRenderState {
  176. Blend Modulate
  177. DepthWrite Off
  178. PolyOffset -0.1 0
  179. }
  180. }
  181. Technique PostShadow{
  182. VertexShader GLSL100: Common/MatDefs/Shadow/PostShadow.vert
  183. FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
  184. WorldParameters {
  185. WorldViewProjectionMatrix
  186. WorldMatrix
  187. }
  188. Defines {
  189. HARDWARE_SHADOWS : HardwareShadows
  190. FILTER_MODE : FilterMode
  191. PCFEDGE : PCFEdge
  192. DISCARD_ALPHA : AlphaDiscardThreshold
  193. COLOR_MAP : ColorMap
  194. SHADOWMAP_SIZE : ShadowMapSize
  195. FADE : FadeInfo
  196. PSSM : Splits
  197. POINTLIGHT : LightViewProjectionMatrix5
  198. NUM_BONES : NumberOfBones
  199. }
  200. ForcedRenderState {
  201. Blend Modulate
  202. DepthWrite Off
  203. PolyOffset -0.1 0
  204. }
  205. }
  206. Technique PreNormalPass {
  207. VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
  208. FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
  209. WorldParameters {
  210. WorldViewProjectionMatrix
  211. WorldViewMatrix
  212. NormalMatrix
  213. }
  214. Defines {
  215. DIFFUSEMAP_ALPHA : DiffuseMap
  216. NUM_BONES : NumberOfBones
  217. }
  218. }
  219. Technique PreNormalPassDerivative {
  220. VertexShader GLSL100 : Common/MatDefs/MSSAO/normal.vert
  221. FragmentShader GLSL100 : Common/MatDefs/MSSAO/normal.frag
  222. WorldParameters {
  223. WorldViewProjectionMatrix
  224. WorldViewMatrix
  225. NormalMatrix
  226. }
  227. Defines {
  228. DIFFUSEMAP_ALPHA : DiffuseMap
  229. NUM_BONES : NumberOfBones
  230. }
  231. }
  232. Technique GBuf {
  233. VertexShader GLSL100: Common/MatDefs/Light/GBuf.vert
  234. FragmentShader GLSL100: Common/MatDefs/Light/GBuf.frag
  235. WorldParameters {
  236. WorldViewProjectionMatrix
  237. NormalMatrix
  238. WorldViewMatrix
  239. WorldMatrix
  240. }
  241. Defines {
  242. VERTEX_COLOR : UseVertexColor
  243. MATERIAL_COLORS : UseMaterialColors
  244. V_TANGENT : VTangent
  245. MINNAERT : Minnaert
  246. WARDISO : WardIso
  247. DIFFUSEMAP : DiffuseMap
  248. NORMALMAP : NormalMap
  249. SPECULARMAP : SpecularMap
  250. PARALLAXMAP : ParallaxMap
  251. }
  252. }
  253. Technique {
  254. LightMode FixedPipeline
  255. }
  256. Technique Glow {
  257. VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
  258. FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
  259. WorldParameters {
  260. WorldViewProjectionMatrix
  261. }
  262. Defines {
  263. NEED_TEXCOORD1
  264. HAS_GLOWMAP : GlowMap
  265. HAS_GLOWCOLOR : GlowColor
  266. NUM_BONES : NumberOfBones
  267. }
  268. }
  269. }