Advertisement
Guest User

LightingMS.j3md

a guest
Oct 30th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.46 KB | None | 0 0
  1. MaterialDef Phong Lighting {
  2.  
  3. MaterialParameters {
  4.  
  5. // Compute vertex lighting in the shader
  6. // For better performance
  7. Boolean VertexLighting
  8.  
  9. // Use more efficent algorithms to improve performance
  10. Boolean LowQuality
  11.  
  12. // Improve quality at the cost of performance
  13. Boolean HighQuality
  14.  
  15. // Output alpha from the diffuse map
  16. Boolean UseAlpha
  17.  
  18. // Alpha threshold for fragment discarding
  19. Float AlphaDiscardThreshold (AlphaTestFallOff)
  20.  
  21. // Normal map is in BC5/ATI2n/LATC/3Dc compression format
  22. Boolean LATC
  23.  
  24. // Use the provided ambient, diffuse, and specular colors
  25. Boolean UseMaterialColors
  26.  
  27. // Activate shading along the tangent, instead of the normal
  28. // Requires tangent data to be available on the model.
  29. Boolean VTangent
  30.  
  31. // Use minnaert diffuse instead of lambert
  32. Boolean Minnaert
  33.  
  34. // Use ward specular instead of phong
  35. Boolean WardIso
  36.  
  37. // Use vertex color as an additional diffuse color.
  38. Boolean UseVertexColor
  39.  
  40. // Ambient color
  41. Color Ambient (MaterialAmbient)
  42.  
  43. // Diffuse color
  44. Color Diffuse (MaterialDiffuse)
  45.  
  46. // Specular color
  47. Color Specular (MaterialSpecular)
  48.  
  49. // Specular power/shininess
  50. Float Shininess (MaterialShininess) : 1
  51.  
  52. // Diffuse map
  53. Texture2D DiffuseMap
  54.  
  55. // Normal map
  56. Texture2D NormalMap
  57.  
  58. // Specular/gloss map
  59. Texture2D SpecularMap
  60.  
  61. // Parallax/height map
  62. Texture2D ParallaxMap
  63.  
  64. //Set to true is parallax map is stored in the alpha channel of the normal map
  65. Boolean PackedNormalParallax
  66.  
  67. //Sets the relief height for parallax mapping
  68. Float ParallaxHeight : 0.05
  69.  
  70. //Set to true to activate Steep Parallax mapping
  71. Boolean SteepParallax
  72.  
  73. // Texture that specifies alpha values
  74. Texture2D AlphaMap
  75.  
  76. // Color ramp, will map diffuse and specular values through it.
  77. Texture2D ColorRamp
  78.  
  79. // Texture of the glowing parts of the material
  80. Texture2D GlowMap
  81.  
  82. // Set to Use Lightmap
  83. Texture2D LightMap
  84.  
  85. // Set to use TexCoord2 for the lightmap sampling
  86. Boolean SeparateTexCoord
  87.  
  88. // The glow color of the object
  89. Color GlowColor
  90.  
  91. // Parameters for fresnel
  92. // X = bias
  93. // Y = scale
  94. // Z = power
  95. Vector3 FresnelParams
  96.  
  97. // Env Map for reflection
  98. TextureCubeMap EnvMap
  99.  
  100. // the env map is a spheremap and not a cube map
  101. Boolean EnvMapAsSphereMap
  102.  
  103. //shadows
  104. Int FilterMode // do wywalenia
  105. Boolean HardwareShadows
  106.  
  107. Texture2D ShadowMap0
  108. Texture2D ShadowMap1
  109. Texture2D ShadowMap2
  110. Texture2D ShadowMap3
  111. //pointLights
  112. Texture2D ShadowMap4
  113. Texture2D ShadowMap5
  114.  
  115. Float ShadowIntensity
  116. Vector4 Splits
  117. Vector2 FadeInfo
  118.  
  119. Matrix4 LightViewProjectionMatrix0
  120. Matrix4 LightViewProjectionMatrix1
  121. Matrix4 LightViewProjectionMatrix2
  122. Matrix4 LightViewProjectionMatrix3
  123. //pointLight
  124. Matrix4 LightViewProjectionMatrix4
  125. Matrix4 LightViewProjectionMatrix5
  126. Vector3 LightPos
  127. Vector3 LightDir
  128.  
  129.  
  130. Int LightCount
  131. Vector4 LightPosition0
  132. Vector4 LightPosition1
  133. Vector4 LightPosition2
  134. Vector4 LightPosition3
  135. Vector4 LightPosition4
  136. Vector4 LightPosition5
  137.  
  138. Float LightRadius
  139.  
  140. Float PCFEdge
  141. Float ShadowMapSize
  142.  
  143. // For hardware skinning
  144. Int NumberOfBones
  145. Matrix4Array BoneMatrices
  146. }
  147.  
  148. Technique {
  149.  
  150. LightMode MultiPass
  151.  
  152. VertexShader GLSL100: MatDefs/Light/LightingMS.vert
  153. FragmentShader GLSL100: MatDefs/Light/LightingMS.frag
  154.  
  155. WorldParameters {
  156. WorldViewProjectionMatrix
  157. NormalMatrix
  158. WorldViewMatrix
  159. ViewMatrix
  160. CameraPosition
  161. WorldMatrix
  162. }
  163.  
  164. Defines {
  165. LATC : LATC
  166. VERTEX_COLOR : UseVertexColor
  167. VERTEX_LIGHTING : VertexLighting
  168. ATTENUATION : Attenuation
  169. MATERIAL_COLORS : UseMaterialColors
  170. V_TANGENT : VTangent
  171. MINNAERT : Minnaert
  172. WARDISO : WardIso
  173. LOW_QUALITY : LowQuality
  174. HQ_ATTENUATION : HighQuality
  175.  
  176. DIFFUSEMAP : DiffuseMap
  177. NORMALMAP : NormalMap
  178. SPECULARMAP : SpecularMap
  179. PARALLAXMAP : ParallaxMap
  180. NORMALMAP_PARALLAX : PackedNormalParallax
  181. STEEP_PARALLAX : SteepParallax
  182. ALPHAMAP : AlphaMap
  183. COLORRAMP : ColorRamp
  184. LIGHTMAP : LightMap
  185. SEPARATE_TEXCOORD : SeparateTexCoord
  186.  
  187. USE_REFLECTION : EnvMap
  188. SPHERE_MAP : SphereMap
  189.  
  190. NUM_BONES : NumberOfBones
  191.  
  192. }
  193.  
  194. }
  195.  
  196. Technique PreShadow {
  197.  
  198. VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
  199. FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
  200.  
  201. WorldParameters {
  202. WorldViewProjectionMatrix
  203. WorldViewMatrix
  204. }
  205.  
  206. Defines {
  207. COLOR_MAP : ColorMap
  208. DISCARD_ALPHA : AlphaDiscardThreshold
  209. NUM_BONES : NumberOfBones
  210. }
  211.  
  212. ForcedRenderState {
  213. FaceCull Off
  214. DepthTest On
  215. DepthWrite On
  216. PolyOffset 0.9 5
  217. ColorWrite Off
  218. }
  219.  
  220. }
  221.  
  222.  
  223. Technique PostShadow15{
  224. VertexShader GLSL150: MatDefs/Shadow/PostShadowMS15.vert
  225. FragmentShader GLSL150: MatDefs/Shadow/PostShadowMS15.frag
  226.  
  227. WorldParameters {
  228. WorldViewProjectionMatrix
  229. WorldMatrix
  230. LightPosition
  231. }
  232.  
  233. Defines {
  234. HARDWARE_SHADOWS : HardwareShadows
  235. FILTER_MODE : FilterMode
  236. PCFEDGE : PCFEdge
  237. DISCARD_ALPHA : AlphaDiscardThreshold
  238. COLOR_MAP : ColorMap
  239. SHADOWMAP_SIZE : ShadowMapSize
  240. FADE : FadeInfo
  241. PSSM : Splits
  242. POINTLIGHT : LightViewProjectionMatrix5
  243. NUM_BONES : NumberOfBones
  244. NUM_LIGHTS: LightCount
  245. }
  246.  
  247. ForcedRenderState {
  248. Blend Modulate
  249. DepthWrite Off
  250. PolyOffset -0.01 0
  251. }
  252. }
  253.  
  254. Technique PostShadow{
  255. VertexShader GLSL100: Common/MatDefs/Shadow/PostShadow.vert
  256. FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
  257.  
  258. WorldParameters {
  259. WorldViewProjectionMatrix
  260. WorldMatrix
  261. LightPosition
  262. }
  263.  
  264. Defines {
  265. HARDWARE_SHADOWS : HardwareShadows
  266. FILTER_MODE : FilterMode
  267. PCFEDGE : PCFEdge
  268. DISCARD_ALPHA : AlphaDiscardThreshold
  269. COLOR_MAP : ColorMap
  270. SHADOWMAP_SIZE : ShadowMapSize
  271. FADE : FadeInfo
  272. PSSM : Splits
  273. POINTLIGHT : LightViewProjectionMatrix5
  274. NUM_BONES : NumberOfBones
  275. NUM_LIGHTS: LightCount
  276. }
  277.  
  278. ForcedRenderState {
  279. Blend Modulate
  280. DepthWrite Off
  281. PolyOffset -0.1 0
  282. }
  283. }
  284.  
  285. Technique PreNormalPass {
  286.  
  287. VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
  288. FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
  289.  
  290. WorldParameters {
  291. WorldViewProjectionMatrix
  292. WorldViewMatrix
  293. NormalMatrix
  294. }
  295.  
  296. Defines {
  297. DIFFUSEMAP_ALPHA : DiffuseMap
  298. NUM_BONES : NumberOfBones
  299. }
  300.  
  301. }
  302.  
  303.  
  304. Technique PreNormalPassDerivative {
  305.  
  306. VertexShader GLSL100 : Common/MatDefs/MSSAO/normal.vert
  307. FragmentShader GLSL100 : Common/MatDefs/MSSAO/normal.frag
  308.  
  309. WorldParameters {
  310. WorldViewProjectionMatrix
  311. WorldViewMatrix
  312. NormalMatrix
  313. }
  314.  
  315. Defines {
  316. DIFFUSEMAP_ALPHA : DiffuseMap
  317. NUM_BONES : NumberOfBones
  318. }
  319.  
  320. }
  321.  
  322. Technique GBuf {
  323.  
  324. VertexShader GLSL100: Common/MatDefs/Light/GBuf.vert
  325. FragmentShader GLSL100: Common/MatDefs/Light/GBuf.frag
  326.  
  327. WorldParameters {
  328. WorldViewProjectionMatrix
  329. NormalMatrix
  330. WorldViewMatrix
  331. WorldMatrix
  332. }
  333.  
  334. Defines {
  335. VERTEX_COLOR : UseVertexColor
  336. MATERIAL_COLORS : UseMaterialColors
  337. V_TANGENT : VTangent
  338. MINNAERT : Minnaert
  339. WARDISO : WardIso
  340.  
  341. DIFFUSEMAP : DiffuseMap
  342. NORMALMAP : NormalMap
  343. SPECULARMAP : SpecularMap
  344. PARALLAXMAP : ParallaxMap
  345. }
  346. }
  347.  
  348. Technique {
  349. LightMode FixedPipeline
  350. }
  351.  
  352. Technique Glow {
  353.  
  354. VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
  355. FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
  356.  
  357. WorldParameters {
  358. WorldViewProjectionMatrix
  359. }
  360.  
  361. Defines {
  362. NEED_TEXCOORD1
  363. HAS_GLOWMAP : GlowMap
  364. HAS_GLOWCOLOR : GlowColor
  365.  
  366. NUM_BONES : NumberOfBones
  367. }
  368. }
  369.  
  370. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement