DepthShadowmap.material
上传用户:xhbjoy
上传日期:2014-10-07
资源大小:38068k
文件大小:14k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. // ***-- Begin HLSL section --**
  2. vertex_program Ogre/DepthShadowmap/CasterVP_HLSL hlsl
  3. {
  4.     source DepthShadowmap.hlsl
  5.     entry_point casterVP
  6.     target vs_2_0
  7. preprocessor_defines LINEAR_RANGE=0
  8.     default_params
  9.     {
  10.         param_named_auto worldViewProj worldviewproj_matrix
  11. param_named_auto texelOffsets texel_offsets
  12. //param_named_auto depthRange scene_depth_range
  13.     }
  14. }
  15. fragment_program Ogre/DepthShadowmap/CasterFP_HLSL hlsl
  16. {
  17.     source DepthShadowmap.hlsl
  18.     entry_point casterFP
  19.     target ps_2_0
  20. preprocessor_defines LINEAR_RANGE=0
  21.     default_params
  22.     {
  23.     }
  24. }
  25. vertex_program Ogre/DepthShadowmap/ReceiverVP_HLSL hlsl
  26. {
  27.     source DepthShadowmap.hlsl
  28.     entry_point receiverVP
  29.     target vs_2_0
  30. preprocessor_defines LINEAR_RANGE=0
  31.     default_params
  32.     {
  33.         param_named_auto world world_matrix
  34.         param_named_auto worldIT inverse_transpose_world_matrix
  35. param_named_auto worldViewProj worldviewproj_matrix
  36. param_named_auto texViewProj texture_viewproj_matrix
  37. param_named_auto lightPosition light_position 0
  38. param_named_auto lightColour light_diffuse_colour 0
  39. //param_named_auto shadowDepthRange shadow_scene_depth_range 0
  40.     }
  41. }
  42. fragment_program Ogre/DepthShadowmap/ReceiverFP_HLSL hlsl
  43. {
  44.     source DepthShadowmap.hlsl
  45.     entry_point receiverFP
  46. target ps_2_0
  47. preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
  48. default_params
  49.     {
  50.         param_named inverseShadowmapSize float 0.0009765625
  51. param_named fixedDepthBias float 0.0005
  52. param_named gradientClamp float 0.0098
  53. param_named gradientScaleBias float 0
  54. //param_named shadowFuzzyWidth float 1
  55.     }
  56. }
  57. fragment_program Ogre/DepthShadowmap/ReceiverFPPCF_HLSL hlsl
  58. {
  59.     source DepthShadowmap.hlsl
  60.     entry_point receiverFP
  61. target ps_2_0
  62. preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=1
  63. default_params
  64.     {
  65.         param_named inverseShadowmapSize float 0.0009765625
  66. param_named gradientClamp float 0.0098
  67. param_named gradientScaleBias float 0
  68. //param_named shadowFuzzyWidth float 1
  69.     }
  70. }
  71. vertex_program Ogre/DepthShadowmap/NormalMapReceiverVP_HLSL hlsl
  72. {
  73.     source DepthShadowmap.hlsl
  74.     entry_point normalMapShadowReceiverVp
  75.     target vs_2_0
  76. preprocessor_defines LINEAR_RANGE=0
  77.     default_params
  78.     {
  79.         param_named_auto world world_matrix
  80. param_named_auto worldViewProj worldviewproj_matrix
  81. param_named_auto texViewProj texture_viewproj_matrix
  82. param_named_auto lightPosition light_position_object_space 0
  83. //param_named_auto shadowDepthRange shadow_scene_depth_range 0
  84.     }
  85. }
  86. fragment_program Ogre/DepthShadowmap/NormalMapReceiverFP_HLSL hlsl
  87. {
  88.     source DepthShadowmap.hlsl
  89.     entry_point normalMapShadowReceiverFp
  90. target ps_2_0
  91. preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
  92. default_params
  93.     {
  94. param_named_auto lightColour light_diffuse_colour 0
  95.         param_named inverseShadowmapSize float 0.0009765625
  96. param_named fixedDepthBias float 0.0005
  97. param_named gradientClamp float 0.0098
  98. param_named gradientScaleBias float 0
  99. //param_named shadowFuzzyWidth float 1
  100.     }
  101. }
  102. fragment_program Ogre/DepthShadowmap/NormalMapReceiverFPPCF_HLSL hlsl
  103. {
  104.     source DepthShadowmap.hlsl
  105.     entry_point normalMapShadowReceiverFp
  106. target ps_2_0
  107. preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=1
  108. default_params
  109.     {
  110. param_named_auto lightColour light_diffuse_colour 0
  111.         param_named inverseShadowmapSize float 0.0009765625
  112. param_named fixedDepthBias float 0.0005
  113. param_named gradientClamp float 0.0098
  114. param_named gradientScaleBias float 0
  115. //param_named shadowFuzzyWidth float 1
  116.     }
  117. }
  118. // **-- End HLSL Section --**
  119. // **-- Begin GLSL Section --**
  120. vertex_program Ogre/DepthShadowmap/CasterVP_GLSL glsl
  121. {
  122.     source DepthShadowmapCasterVp.glsl
  123. preprocessor_defines LINEAR_RANGE=0
  124.     default_params
  125.     {
  126.         param_named_auto worldViewProj worldviewproj_matrix
  127. param_named_auto texelOffsets texel_offsets
  128. //param_named_auto depthRange scene_depth_range
  129.     }
  130. }
  131. fragment_program Ogre/DepthShadowmap/CasterFP_GLSL glsl
  132. {
  133.     source DepthShadowmapCasterFp.glsl
  134. preprocessor_defines LINEAR_RANGE=0
  135.     default_params
  136.     {
  137.     }
  138. }
  139. vertex_program Ogre/DepthShadowmap/ReceiverVP_GLSL glsl
  140. {
  141.     source DepthShadowmapReceiverVp.glsl
  142. preprocessor_defines LINEAR_RANGE=0
  143.     default_params
  144.     {
  145.         param_named_auto world world_matrix
  146.         param_named_auto worldIT inverse_transpose_world_matrix
  147. param_named_auto worldViewProj worldviewproj_matrix
  148. param_named_auto texViewProj texture_viewproj_matrix
  149. param_named_auto lightPosition light_position 0
  150. param_named_auto lightColour light_diffuse_colour 0
  151. //param_named_auto shadowDepthRange shadow_scene_depth_range 0
  152.     }
  153. }
  154. fragment_program Ogre/DepthShadowmap/ReceiverFP_GLSL glsl
  155. {
  156.     source DepthShadowmapReceiverFp.glsl
  157. preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
  158. default_params
  159.     {
  160. param_named shadowMap int 0
  161.         param_named inverseShadowmapSize float 0.0009765625
  162. param_named fixedDepthBias float 0.0005
  163. param_named gradientClamp float 0.0098
  164. param_named gradientScaleBias float 0
  165. //param_named shadowFuzzyWidth float 1
  166.     }
  167. }
  168. fragment_program Ogre/DepthShadowmap/ReceiverFPPCF_GLSL glsl
  169. {
  170.     source DepthShadowmapReceiverFp.glsl
  171. preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=1
  172. default_params
  173.     {
  174.         param_named inverseShadowmapSize float 0.0009765625
  175. param_named gradientClamp float 0.0098
  176. param_named gradientScaleBias float 0
  177. //param_named shadowFuzzyWidth float 1
  178.     }
  179. }
  180. vertex_program Ogre/DepthShadowmap/NormalMapReceiverVP_GLSL glsl
  181. {
  182.     source DepthShadowmapNormalMapReceiverVp.glsl
  183. preprocessor_defines LINEAR_RANGE=0
  184.     default_params
  185.     {
  186.         param_named_auto world world_matrix
  187. param_named_auto worldViewProj worldviewproj_matrix
  188. param_named_auto texViewProj texture_viewproj_matrix
  189. param_named_auto lightPosition light_position_object_space 0
  190. //param_named_auto shadowDepthRange shadow_scene_depth_range 0
  191.     }
  192. }
  193. fragment_program Ogre/DepthShadowmap/NormalMapReceiverFP_GLSL glsl
  194. {
  195.     source DepthShadowmapNormalMapReceiverFp.glsl
  196. preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
  197. default_params
  198.     {
  199. param_named_auto lightColour light_diffuse_colour 0
  200.         param_named inverseShadowmapSize float 0.0009765625
  201. param_named fixedDepthBias float 0.0005
  202. param_named gradientClamp float 0.0098
  203. param_named gradientScaleBias float 0
  204. //param_named shadowFuzzyWidth float 1
  205. param_named shadowMap int 0
  206. param_named normalMap int 1
  207.     }
  208. }
  209. fragment_program Ogre/DepthShadowmap/NormalMapReceiverFPPCF_GLSL glsl
  210. {
  211.     source DepthShadowmapNormalMapReceiverFp.glsl
  212. preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=1
  213. default_params
  214.     {
  215. param_named_auto lightColour light_diffuse_colour 0
  216.         param_named inverseShadowmapSize float 0.0009765625
  217. param_named fixedDepthBias float 0.0005
  218. param_named gradientClamp float 0.0098
  219. param_named gradientScaleBias float 0
  220. //param_named shadowFuzzyWidth float 1
  221. param_named shadowMap int 0
  222. param_named normalMap int 1
  223.     }
  224. }
  225. // **-- End GLSL Section --**
  226. // **-- Begin Unified Section --**
  227. vertex_program Ogre/DepthShadowmap/CasterVP unified
  228. {
  229. delegate Ogre/DepthShadowmap/CasterVP_GLSL
  230. delegate Ogre/DepthShadowmap/CasterVP_HLSL
  231. }
  232. fragment_program Ogre/DepthShadowmap/CasterFP unified
  233. {
  234. delegate Ogre/DepthShadowmap/CasterFP_GLSL
  235. delegate Ogre/DepthShadowmap/CasterFP_HLSL
  236. }
  237. vertex_program Ogre/DepthShadowmap/ReceiverVP unified
  238. {
  239. delegate Ogre/DepthShadowmap/ReceiverVP_GLSL
  240. delegate Ogre/DepthShadowmap/ReceiverVP_HLSL
  241. }
  242. fragment_program Ogre/DepthShadowmap/ReceiverFP unified
  243. {
  244. delegate Ogre/DepthShadowmap/ReceiverFP_GLSL
  245. delegate Ogre/DepthShadowmap/ReceiverFP_HLSL
  246. }
  247. fragment_program Ogre/DepthShadowmap/ReceiverFPPCF unified
  248. {
  249. delegate Ogre/DepthShadowmap/ReceiverFPPCF_GLSL
  250. delegate Ogre/DepthShadowmap/ReceiverFPPCF_HLSL
  251. }
  252. vertex_program Ogre/DepthShadowmap/NormalMapReceiverVP unified
  253. {
  254. delegate Ogre/DepthShadowmap/NormalMapReceiverVP_HLSL
  255. delegate Ogre/DepthShadowmap/NormalMapReceiverVP_GLSL
  256. }
  257. vertex_program Ogre/DepthShadowmap/NormalMapReceiverFP unified
  258. {
  259. delegate Ogre/DepthShadowmap/NormalMapReceiverFP_HLSL
  260. delegate Ogre/DepthShadowmap/NormalMapReceiverFP_GLSL
  261. }
  262. vertex_program Ogre/DepthShadowmap/NormalMapReceiverFPPCF unified
  263. {
  264. delegate Ogre/DepthShadowmap/NormalMapReceiverFPPCF_HLSL
  265. delegate Ogre/DepthShadowmap/NormalMapReceiverFPPCF_GLSL
  266. }
  267. // **-- End Unified Section --**
  268. // Generic Shadow caster material (floating point shadowmap)
  269. material Ogre/DepthShadowmap/Caster/Float
  270. {
  271. technique
  272.     {
  273.         pass 
  274.         {
  275.             vertex_program_ref Ogre/DepthShadowmap/CasterVP
  276.             {
  277.             }
  278.             fragment_program_ref Ogre/DepthShadowmap/CasterFP
  279.             {
  280.             }
  281.         }
  282.     }
  283. }
  284. // Generic Shadow receiver material (floating point shadowmap)
  285. material Ogre/DepthShadowmap/Receiver/Float
  286. {
  287. technique
  288.     {
  289.         pass 
  290.         {
  291.             vertex_program_ref Ogre/DepthShadowmap/ReceiverVP
  292.             {
  293.             }
  294.             fragment_program_ref Ogre/DepthShadowmap/ReceiverFP
  295.             {
  296.             }
  297.             texture_unit ShadowMap
  298.             {
  299.                 tex_address_mode clamp
  300.                 filtering none
  301.             }
  302.         }
  303.     }
  304. }
  305. // Specific receiver material for rockwall
  306. material Ogre/DepthShadowmap/Receiver/RockWall
  307. {
  308. // This is the preferred technique which uses both vertex and
  309. // fragment programs, supports coloured lights
  310. technique
  311. {
  312. // Base ambient pass
  313. pass
  314. {
  315. // base colours, not needed for rendering, but as information
  316. // to lighting pass categorisation routine
  317. ambient 1 1 1
  318. diffuse 0 0 0 
  319. specular 0 0 0 0 
  320. // Really basic vertex program
  321. vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureUnified
  322. {
  323. }
  324. }
  325. // Now do the lighting pass
  326. // NB we don't do decal texture here because this is repeated per light
  327. pass lighting
  328. {
  329. // base colours, not needed for rendering, but as information
  330. // to lighting pass categorisation routine
  331. ambient 0 0 0 
  332. // do this for each light
  333. iteration once_per_light
  334. scene_blend add
  335. // Vertex program reference
  336. vertex_program_ref Ogre/DepthShadowmap/ReceiverVP
  337. {
  338. }
  339. shadow_receiver_vertex_program_ref Ogre/DepthShadowmap/ReceiverVP
  340. {
  341. }
  342. // Fragment program
  343. fragment_program_ref Ogre/DepthShadowmap/ReceiverFP
  344. {
  345. }
  346. shadow_receiver_fragment_program_ref Ogre/DepthShadowmap/ReceiverFP
  347. {
  348. }
  349. // shadowmap texture will be bound by code
  350. }
  351. // Decal pass
  352. pass
  353. {
  354. // base colours, not needed for rendering, but as information
  355. // to lighting pass categorisation routine
  356. lighting off
  357. // Really basic vertex program
  358. vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureUnified
  359. {
  360. param_named ambient float4 1 1 1 1
  361. }
  362. scene_blend dest_colour zero
  363. texture_unit
  364. {
  365. texture rockwall.tga
  366. }
  367. }
  368. }
  369. }
  370. // Specific receiver material for Athene
  371. material Ogre/DepthShadowmap/Receiver/Athene
  372. {
  373. // This is the preferred technique which uses both vertex and
  374. // fragment programs, supports coloured lights
  375. technique
  376. {
  377. // Base ambient pass
  378. pass
  379. {
  380. // base colours, not needed for rendering, but as information
  381. // to lighting pass categorisation routine
  382. ambient 1 1 1
  383. diffuse 0 0 0 
  384. specular 0 0 0 0 
  385. // Really basic vertex program
  386. vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureUnified
  387. {
  388. }
  389. }
  390. // Now do the lighting pass
  391. // NB we don't do decal texture here because this is repeated per light
  392. pass lighting
  393. {
  394. // base colours, not needed for rendering, but as information
  395. // to lighting pass categorisation routine
  396. ambient 0 0 0 
  397. // do this for each light
  398. iteration once_per_light
  399. scene_blend add
  400. // Vertex program reference
  401. vertex_program_ref Ogre/DepthShadowmap/NormalMapReceiverVP
  402. {
  403. }
  404. shadow_receiver_vertex_program_ref Ogre/DepthShadowmap/NormalMapReceiverVP
  405. {
  406. }
  407. // Fragment program
  408. fragment_program_ref Ogre/DepthShadowmap/NormalMapReceiverFP
  409. {
  410. }
  411. shadow_receiver_fragment_program_ref Ogre/DepthShadowmap/NormalMapReceiverFP
  412. {
  413. }
  414. // shadowmap texture will be bound by code
  415. // Base bump map
  416. texture_unit
  417. {
  418. texture atheneNormalMap.png
  419. colour_op replace
  420. }
  421. // Normalisation cube map
  422. texture_unit
  423. {
  424. cubic_texture nm.png combinedUVW
  425. tex_coord_set 1
  426. tex_address_mode clamp
  427. }
  428. }
  429. // Decal pass
  430. pass
  431. {
  432. // base colours, not needed for rendering, but as information
  433. // to lighting pass categorisation routine
  434. lighting off
  435. // Really basic vertex program
  436. vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureUnified
  437. {
  438. param_named ambient float4 1 1 1 1
  439. }
  440. scene_blend dest_colour zero
  441. texture_unit
  442. {
  443. texture egyptrockyfull.jpg 
  444. }
  445. }
  446. }
  447. }
  448. // Specialisation to use PCF
  449. material Ogre/DepthShadowmap/Receiver/Float/PCF : Ogre/DepthShadowmap/Receiver/Float
  450. {
  451. technique
  452. {
  453. pass
  454. {
  455. // override just receiver program 
  456. fragment_program_ref Ogre/DepthShadowmap/ReceiverFPPCF
  457. {
  458. }
  459. }
  460. }
  461. }
  462. // Specialisation to use PCF
  463. material Ogre/DepthShadowmap/Receiver/RockWall/PCF : Ogre/DepthShadowmap/Receiver/RockWall
  464. {
  465. technique
  466. {
  467. pass lighting
  468. {
  469. // override just receiver program 
  470. shadow_receiver_fragment_program_ref Ogre/DepthShadowmap/ReceiverFPPCF
  471. {
  472. }
  473. }
  474. }
  475. }
  476. // Specialisation to use PCF
  477. material Ogre/DepthShadowmap/Receiver/Athene/PCF : Ogre/DepthShadowmap/Receiver/Athene
  478. {
  479. technique
  480. {
  481. pass lighting
  482. {
  483. // override just receiver program 
  484. shadow_receiver_fragment_program_ref Ogre/DepthShadowmap/NormalMapReceiverFPPCF
  485. {
  486. }
  487. }
  488. }
  489. }