Guest User

Domino

a guest
Jul 28th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 193.59 KB | None | 0 0
  1. ///////////////////////////////////////
  2. ///
  3. /// Defines
  4. ///
  5. ///////////////////////////////////////
  6.  
  7. #define BONE_MAXIMUM 80
  8.  
  9. #define FIDELITY_LOW 0x00
  10. #define FIDELITY_MEDIUM 0x01
  11. #define FIDELITY_HIGH 0x02
  12.  
  13. #define STAGE_DEPTH 0x01
  14. #define STAGE_REFLECTION 0x02
  15. #define STAGE_PREEFFECT 0x04
  16. #define STAGE_POSTEFFECT 0x08
  17. #define STAGE_PREWATER 0x10
  18. #define STAGE_POSTWATER 0x20
  19.  
  20. #define PARAM_UNUSED 0
  21. #define PARAM_FRACTIONCOMPLETE 1
  22. #define PARAM_FRACTIONHEALTH 2
  23. #define PARAM_LIFETIME 3
  24. #define PARAM_AUXILIARY 4
  25.  
  26. #define SELF_SHADOW
  27.  
  28. ///////////////////////////////////////
  29. ///
  30. /// Typedefs
  31. ///
  32. ///////////////////////////////////////
  33.  
  34. #ifdef DIRECT3D10
  35. typedef uint4 anim_t;
  36. #else
  37. typedef float4 anim_t;
  38. #endif
  39.  
  40. ///////////////////////////////////////
  41. ///
  42. /// Shader constants
  43. ///
  44. ///////////////////////////////////////
  45.  
  46. float glowMultiplier = 2.000;
  47. float glowMinimum = 0.010;
  48.  
  49. float4 terrainScale;
  50. texture hypsometricTexture;
  51. texture environmentTexture;
  52. texture anisotropicTexture;
  53. texture insectTexture;
  54. float time;
  55. float4 lodBasis;
  56. float4x4 viewMatrix;
  57. float4x4 projMatrix;
  58. float3 windDirection = float3(0.707, 0.0, 0.707);
  59. float lightMultiplier;
  60. float3 sunDirection;
  61. float3 sunDiffuse;
  62. float3 sunAmbient;
  63. float3 shadowFill;
  64. int shadowsEnabled;
  65. float4x4 shadowMatrix;
  66. texture shadowTexture;
  67. int shadowBlur;
  68. float shadowSize;
  69. float shadowBias;
  70. int mirrored;
  71. texture waterRamp;
  72. float1 minimumElevation;
  73. float1 maximumElevation;
  74. float surfaceElevation;
  75. float abyssElevation;
  76. texture dissolveTexture;
  77. texture albedoTexture;
  78. texture normalsTexture;
  79. texture specularTexture;
  80. texture lookupTexture;
  81. texture secondaryTexture;
  82. float4 transPalette[BONE_MAXIMUM];
  83. float4 rotPalette[BONE_MAXIMUM];
  84.  
  85. /// Qualitative constants to tweak phong amount in shaders...
  86. float3 AeonPhongCoeff = float3(0.8,0.85,1.10);
  87. float3 NormalMappedPhongCoeff = float3(0.6,0.80,0.90);
  88.  
  89.  
  90. ///////////////////////////////////////
  91. ///
  92. /// Samplers
  93. ///
  94. ///////////////////////////////////////
  95.  
  96. sampler1D hypsometricSampler = sampler_state
  97. {
  98. Texture = (hypsometricTexture);
  99. MipFilter = POINT;
  100. MinFilter = NONE;
  101. MagFilter = NONE;
  102. AddressU = CLAMP;
  103. AddressV = CLAMP;
  104. };
  105.  
  106. samplerCUBE environmentSampler = sampler_state
  107. {
  108. Texture = (environmentTexture);
  109. MipFilter = LINEAR;
  110. MinFilter = LINEAR;
  111. MagFilter = LINEAR;
  112. AddressU = WRAP;
  113. AddressV = WRAP;
  114. };
  115.  
  116. sampler2D dissolveSampler = sampler_state
  117. {
  118. Texture = (dissolveTexture);
  119. MipFilter = LINEAR;
  120. MinFilter = LINEAR;
  121. MagFilter = LINEAR;
  122. AddressU = WRAP;
  123. AddressV = WRAP;
  124. };
  125.  
  126. sampler2D shadowSampler = sampler_state
  127. {
  128. Texture = (shadowTexture);
  129. MipFilter = POINT;
  130. MinFilter = POINT;
  131. MagFilter = POINT;
  132. AddressU = CLAMP;
  133. AddressV = CLAMP;
  134. };
  135.  
  136. sampler2D shadowPCFSampler = sampler_state
  137. {
  138. Texture = (shadowTexture);
  139. MipFilter = LINEAR;
  140. MinFilter = LINEAR;
  141. MagFilter = LINEAR;
  142. AddressU = BORDER;
  143. AddressV = BORDER;
  144. #ifndef DIRECT3D10
  145. BorderColor = 0xFFFFFFFF;
  146. #else
  147. BorderColor = float4(1,1,1,1);
  148. #endif
  149.  
  150. };
  151.  
  152. sampler2D albedoSampler = sampler_state
  153. {
  154. Texture = (albedoTexture);
  155. MipFilter = LINEAR;
  156. MinFilter = LINEAR;
  157. MagFilter = LINEAR;
  158. AddressU = WRAP;
  159. AddressV = WRAP;
  160. };
  161.  
  162. sampler2D normalsSampler = sampler_state
  163. {
  164. Texture = (normalsTexture);
  165. MipFilter = LINEAR;
  166. MinFilter = LINEAR;
  167. MagFilter = LINEAR;
  168. AddressU = WRAP;
  169. AddressV = WRAP;
  170. };
  171.  
  172. sampler2D specularSampler = sampler_state
  173. {
  174. Texture = (specularTexture);
  175. MipFilter = LINEAR;
  176. MinFilter = LINEAR;
  177. MagFilter = LINEAR;
  178. AddressU = WRAP;
  179. AddressV = WRAP;
  180. };
  181.  
  182. sampler2D lookupSampler = sampler_state
  183. {
  184. Texture = (lookupTexture);
  185. MipFilter = LINEAR;
  186. MinFilter = LINEAR;
  187. MagFilter = LINEAR;
  188. AddressU = WRAP;
  189. AddressV = WRAP;
  190. };
  191.  
  192. sampler2D secondarySampler = sampler_state
  193. {
  194. Texture = (secondaryTexture);
  195. MipFilter = LINEAR;
  196. MinFilter = LINEAR;
  197. MagFilter = LINEAR;
  198. AddressU = WRAP;
  199. AddressV = WRAP;
  200. };
  201.  
  202. sampler2D anisotropicSampler = sampler_state
  203. {
  204. Texture = (anisotropicTexture);
  205. MipFilter = LINEAR;
  206. MinFilter = LINEAR;
  207. MagFilter = LINEAR;
  208. AddressU = CLAMP;
  209. AddressV = CLAMP;
  210. };
  211.  
  212. sampler2D insectSampler = sampler_state
  213. {
  214. Texture = (insectTexture);
  215. MipFilter = LINEAR;
  216. MinFilter = LINEAR;
  217. MagFilter = LINEAR;
  218. AddressU = CLAMP;
  219. AddressV = CLAMP;
  220. };
  221.  
  222. sampler2D falloffSampler = sampler_state
  223. {
  224. Texture = (lookupTexture);
  225. MipFilter = NONE;
  226. MinFilter = NONE;
  227. MagFilter = NONE;
  228. AddressU = CLAMP;
  229. AddressV = CLAMP;
  230. };
  231.  
  232. ///////////////////////////////////////
  233. ///
  234. /// Structures
  235. ///
  236. ///////////////////////////////////////
  237.  
  238. struct DEPTH_VERTEX
  239. {
  240. float4 position : POSITION0;
  241. float4 texcoord0 : TEXCOORD0;
  242. float depth : TEXCOORD2;
  243. };
  244.  
  245. struct SILHOUETTE_VERTEX
  246. {
  247. float4 position : POSITION0;
  248. };
  249.  
  250. struct CLUTTER_VERTEX
  251. {
  252. float4 position : POSITION0;
  253. float3 normal : TEXCOORD3;
  254. float3 tangent : TEXCOORD4;
  255. float3 binormal : TEXCOORD5;
  256. float4 texcoord0 : TEXCOORD0;
  257. float4 shadow : TEXCOORD2;
  258. float dissolve : TEXCOORD7;
  259. };
  260.  
  261. struct CARTOGRAPHIC_VERTEX
  262. {
  263. float4 position : POSITION0;
  264. float1 elevation : TEXCOORD0;
  265. float4 texcoord : TEXCOORD1;
  266. float4 color : COLOR0;
  267. float3 normal : TEXCOORD2;
  268. float3 binormal : TEXCOORD3;
  269. float3 tangent : TEXCOORD4;
  270. };
  271.  
  272. struct FLAT_VERTEX
  273. {
  274. float4 position : POSITION0;
  275. float4 texcoord0 : TEXCOORD0;
  276. float4 color : COLOR0;
  277. float4 material : TEXCOORD1;
  278. float2 depth : TEXCOORD2;
  279. };
  280.  
  281. struct VERTEXNORMAL_VERTEX
  282. {
  283. float4 position : POSITION0;
  284. float3 normal : TEXCOORD3;
  285. float4 texcoord0 : TEXCOORD0;
  286. float4 shadow : TEXCOORD2;
  287. float4 color : COLOR0;
  288. float4 material : TEXCOORD1;
  289. float depth : TEXCOORD4;
  290. };
  291.  
  292. struct NORMALMAPPED_VERTEX
  293. {
  294. float4 position : POSITION0;
  295. float3 normal : TEXCOORD3;
  296. float3 tangent : TEXCOORD4;
  297. float3 binormal : TEXCOORD5;
  298. float4 texcoord0 : TEXCOORD0;
  299. float3 viewDirection : TEXCOORD6;
  300. float4 shadow : TEXCOORD2;
  301. float4 color : COLOR0;
  302. float4 material : TEXCOORD1; /// various uses
  303. float2 depth : TEXCOORD7;
  304. };
  305.  
  306. struct EFFECT_VERTEX
  307. {
  308. float4 position : POSITION0;
  309. float3 normal : TEXCOORD3;
  310. float3 color : COLOR0;
  311. float4 texcoord0 : TEXCOORD0;
  312. float4 texcoord1 : TEXCOORD2;
  313. float4 material : TEXCOORD1;
  314. float depth : TEXCOORD4;
  315. };
  316.  
  317. struct EFFECT_NORMALMAPPED_VERTEX
  318. {
  319. float4 position : POSITION0;
  320. float3 normal : TEXCOORD3;
  321. float3 tangent : TEXCOORD4;
  322. float3 binormal : TEXCOORD5;
  323. float4 texcoord0 : TEXCOORD0;
  324. float4 texcoord1 : TEXCOORD2;
  325. float3 viewDirection : TEXCOORD6;
  326. float4 color : COLOR0;
  327. float4 material : TEXCOORD1;
  328. float2 depth : TEXCOORD7;
  329. };
  330.  
  331. struct LOFIEFFECT_VERTEX
  332. {
  333. float4 position : POSITION0;
  334. float3 normal : TEXCOORD3;
  335. float3 color : COLOR0;
  336. float2 texcoord0 : TEXCOORD0;
  337. float2 texcoord1 : TEXCOORD2;
  338. float2 texcoord2 : TEXCOORD5;
  339. float4 material : TEXCOORD1;
  340. float depth : TEXCOORD4;
  341. };
  342.  
  343. struct SHIELDIMPACT_VERTEX
  344. {
  345. float4 position : POSITION0;
  346. float2 texcoord0 : TEXCOORD0;
  347. float2 texcoord1 : TEXCOORD1;
  348. float2 texcoord2 : TEXCOORD2;
  349. float4 material : TEXCOORD3;
  350. float depth : TEXCOORD4;
  351. };
  352.  
  353. ///////////////////////////////////////
  354. ///
  355. /// Functions
  356. ///
  357. ///////////////////////////////////////
  358.  
  359. /// ComputeMatrix
  360. ///
  361. /// Compute matrix from scale, translation, and quaternion.
  362. float4x4 ComputeMatrix( float s, float3 T, float4 Q)
  363. {
  364. float4x4 M;
  365.  
  366. float x = Q.x, y = Q.y, z = Q.z, w = Q.w;
  367. float x2 = 2 * x, y2 = 2 * y, z2 = 2 * z, w2 = 2 * w;
  368. float xx2 = x * x2, yy2 = y * y2, zz2 = z * z2;
  369. float xy2 = x * y2, xz2 = x * z2, xw2 = x * w2, yz2 = y * z2, yw2 = y * w2, zw2 = z * w2;
  370.  
  371. M._m00 = s * ( 1 - ( yy2 + zz2 ));
  372. M._m01 = s * ( xy2 + zw2 );
  373. M._m02 = s * ( xz2 - yw2 );
  374. M._m03 = 0;
  375.  
  376. M._m10 = s * ( xy2 - zw2 );
  377. M._m11 = s * ( 1 - ( xx2 + zz2 ));
  378. M._m12 = s * ( yz2 + xw2 );
  379. M._m13 = 0;
  380.  
  381. M._m20 = s * ( xz2 + yw2 );
  382. M._m21 = s * ( yz2 - xw2 );
  383. M._m22 = s * ( 1 - ( xx2 + yy2 ));
  384. M._m23 = 0;
  385.  
  386. M._m30 = T.x;
  387. M._m31 = T.y;
  388. M._m32 = T.z;
  389. M._m33 = 1;
  390.  
  391. return M;
  392. }
  393.  
  394. /// ComputePaletteMatrix
  395. ///
  396. /// Compute matrix from an index into the bone palette.
  397. float4x4 ComputePaletteMatrix( int index)
  398. {
  399. float4 translation = transPalette[index];
  400. return ComputeMatrix( translation.w, translation.xyz, rotPalette[index]);
  401. }
  402.  
  403. /// ComputeWorldMatrix
  404. ///
  405. /// Computes the bone-to-world matrix given the bone index and
  406. /// rows of the model to world matrix.
  407. float4x4 ComputeWorldMatrix( int index, float3 row0, float3 row1, float3 row2, float3 row3)
  408. {
  409. return mul(ComputePaletteMatrix(index),float4x4(float4(row0,0),float4(row1,0),float4(row2,0),float4(row3,1)));
  410. }
  411.  
  412. /// ComputeShadowTexcoord
  413. ///
  414. /// Computes the shadow texture coordinate of a point given in world space.
  415. float4 ComputeShadowTexcoord( float4 worldPosition)
  416. {
  417. float4 texcoord = mul( worldPosition, shadowMatrix);
  418. texcoord.x = ( +texcoord.x + texcoord.w ) * 0.5;
  419. texcoord.y = ( -texcoord.y + texcoord.w ) * 0.5;
  420. texcoord.z /= texcoord.w;
  421.  
  422. return texcoord;
  423. }
  424.  
  425. /// ComputeScrolledTexcoord
  426. ///
  427. ///
  428. float4 ComputeScrolledTexcoord( float4 texcoord, float4 material)
  429. {
  430. float4 scrolled = texcoord;
  431. if ( texcoord.y > 0.95 )
  432. {
  433. scrolled.x += material.z;
  434. scrolled.z += material.z;
  435. }
  436. else if ( texcoord.y > 0.90 )
  437. {
  438. scrolled.x += material.w;
  439. scrolled.z += material.w;
  440. }
  441. return scrolled;
  442. }
  443.  
  444. /// ComputeShadow
  445. ///
  446. /// Computes the "light attenuation factor" for a pixel given its shadow
  447. /// texture coordinate and depth from light.
  448. // *** Standard Shadow Mapping ***
  449. float ComputeShadowStandard( float4 shadowCoords)
  450. {
  451. #ifdef SELF_SHADOW
  452. shadowCoords.xy /= shadowCoords.w;
  453.  
  454. // Standard shadow map comparison
  455. float shadow = 1.0f;
  456. if( shadowsEnabled && shadowCoords.z > tex2D( shadowSampler, shadowCoords.xy ).r + shadowBias )
  457. {
  458. shadow = 0.0f;
  459. }
  460. return shadow;
  461. #else
  462. return 1;
  463. #endif
  464. }
  465.  
  466.  
  467. // *** Percentage Closer Filtering Shadow Mapping ***
  468. float ComputeShadowPCF( float4 shadowCoords)
  469. {
  470. #ifdef SELF_SHADOW
  471. shadowCoords.xy /= shadowCoords.w;
  472.  
  473. // *** PCF Percentage Closer Filtering ***
  474. // If we only support 1024x1024 shadow maps we can take out the
  475. // 'shadowSize' var dependancy. and use a lookup table.
  476. // Would make this function faster.
  477. //
  478. // Altered PCF Kernal:
  479. //
  480. // 4
  481. //
  482. // .---1---.
  483. // | |
  484. // 2 0 X | 3
  485. // | |
  486. // '-------'
  487. //
  488. //
  489.  
  490. float shadow = 0.0f;
  491. float texel = 1.0f / shadowSize;
  492. float offset = texel; // make this larger if you want a bigger 'blur'.
  493.  
  494. float depthArray[5];
  495. depthArray[0] = tex2D( shadowPCFSampler, shadowCoords.xy + float2( -(texel * 0.5f), 0.0f ) ).r;
  496. depthArray[1] = tex2D( shadowPCFSampler, shadowCoords.xy + float2( 0.0f, -(texel * 0.5f)) ).r;
  497. depthArray[2] = tex2D( shadowPCFSampler, shadowCoords.xy + float2( -offset, 0.0f ) ).r;
  498. depthArray[3] = tex2D( shadowPCFSampler, shadowCoords.xy + float2( offset, 0.0f ) ).r;
  499. depthArray[4] = tex2D( shadowPCFSampler, shadowCoords.xy + float2( 0.0f, offset ) ).r;
  500.  
  501. // Sample each of them checking whether the pixel under test is shadowed or not
  502. for( int i = 0; i < 5; i++ )
  503. {
  504. float A = depthArray[i] + shadowBias;
  505. float B = (shadowCoords.z - 0.001f);
  506. if( A > B )
  507. {
  508. shadow += 1.0f;
  509. }
  510. }
  511.  
  512. // Get the average
  513. return shadow * (1.0f / 5.0f);
  514. #else
  515. return 1;
  516. #endif
  517. }
  518.  
  519. float ComputeShadow( float4 shadowCoords, uniform bool hiDefFiltering )
  520. {
  521. #ifdef SELF_SHADOW
  522. // If we are allowed to use hiDefFiltering then allow ShadowPCF
  523. if( hiDefFiltering )
  524. {
  525. return shadowBlur ? (shadowsEnabled ? ComputeShadowPCF( shadowCoords) : 1.0f) : ComputeShadowStandard( shadowCoords);
  526. }
  527. else
  528. {
  529. return ComputeShadowStandard( shadowCoords);
  530. }
  531. #else
  532. return 1;
  533. #endif
  534. }
  535.  
  536. /// ComputeLight
  537. ///
  538. /// Computes the sun's contribution to the pixel's color given the dot product
  539. /// of the light direction and surface normal. The dot product is precomputed
  540. /// since other portions of the pixel shader might need it (and we need to reuse
  541. /// as many calculations as possible.)
  542. float3 ComputeLight( float dotLightNormal, float attenuation)
  543. {
  544. /// Typical L.N calculation.
  545. float3 light = sunDiffuse * saturate( dotLightNormal ) * attenuation + sunAmbient;
  546. /// The following will "fill in" the shadow color proportional to the absence of light.
  547. /// This considers the absence of light due to shadows and surface normals pointing away from the light.
  548. /// This way all dark areas match (very cool.)
  549. return lightMultiplier * light + ( 1 - light ) * shadowFill;
  550. }
  551.  
  552. /// ComputeNormal
  553. ///
  554. ///
  555. float3 ComputeNormal( sampler2D source, float2 uv, float3x3 rotationMatrix)
  556. {
  557. float3 normal = 2 * tex2D( source, uv).gaa - 1;
  558. normal.z = sqrt( 1 - normal.x*normal.x - normal.y*normal.y );
  559. return normalize( mul( normal, rotationMatrix));
  560. }
  561.  
  562. ///////////////////////////////////////
  563. ///
  564. /// Vertex Shaders
  565. ///
  566. ///////////////////////////////////////
  567.  
  568. /// DepthVS
  569. ///
  570. /// Depth vertex shader
  571. DEPTH_VERTEX DepthVS(
  572. float3 position : POSITION0,
  573. float4 texcoord0 : TEXCOORD0,
  574. int boneIndex[4] : BLENDINDICES,
  575. float3 row0 : TEXCOORD1,
  576. float3 row1 : TEXCOORD2,
  577. float3 row2 : TEXCOORD3,
  578. float3 row3 : TEXCOORD4,
  579. anim_t anim : TEXCOORD5
  580. )
  581. {
  582. DEPTH_VERTEX vertex = (DEPTH_VERTEX)0;
  583.  
  584. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  585.  
  586. vertex.position = mul( float4(position,1), worldMatrix);
  587. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  588. vertex.depth = vertex.position.z;
  589.  
  590. vertex.texcoord0 = texcoord0;
  591.  
  592. return vertex;
  593. }
  594.  
  595. /// SeraphimBuildDepthVS
  596. ///
  597. ///
  598. DEPTH_VERTEX SeraphimBuildDepthVS(
  599. float3 position : POSITION0,
  600. float4 texcoord0 : TEXCOORD0,
  601. int boneIndex[4] : BLENDINDICES,
  602. float3 row0 : TEXCOORD1,
  603. float3 row1 : TEXCOORD2,
  604. float3 row2 : TEXCOORD3,
  605. float3 row3 : TEXCOORD4,
  606. anim_t anim : TEXCOORD5,
  607. float4 material : TEXCOORD6
  608. )
  609. {
  610. DEPTH_VERTEX vertex = (DEPTH_VERTEX)0;
  611.  
  612. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  613.  
  614. position *= 0.25 + (material.y * 0.75);
  615. vertex.position = mul( float4(position,1), worldMatrix);
  616. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  617. vertex.depth = vertex.position.z;
  618.  
  619. vertex.texcoord0 = texcoord0;
  620.  
  621. return vertex;
  622. }
  623.  
  624. /// UndulatingDepthVS
  625. ///
  626. /// Depth vertex shader
  627. DEPTH_VERTEX UndulatingDepthVS(
  628. float3 position : POSITION0,
  629. float3 UnusedNormal : NORMAL, // tighten up the linkages for D3D10
  630. float3 UnusedTangent : TANGENT,
  631. float3 UnusedBinormal : BINORMAL,
  632. float4 texcoord0 : TEXCOORD0,
  633. int boneIndex[4] : BLENDINDICES,
  634. float3 row0 : TEXCOORD1,
  635. float3 row1 : TEXCOORD2,
  636. float3 row2 : TEXCOORD3,
  637. float3 row3 : TEXCOORD4,
  638. anim_t anim : TEXCOORD5
  639. )
  640. {
  641. DEPTH_VERTEX vertex = (DEPTH_VERTEX)0;
  642.  
  643. float weight = 0.003 * position.y;
  644. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  645.  
  646. vertex.position = mul( float4(position,1), worldMatrix);
  647. float sinSq = sin( 0.05 * time - dot(windDirection,row3.xyz));
  648. sinSq *= sinSq;
  649.  
  650. vertex.position.xyz += weight * sinSq * windDirection;
  651. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  652. vertex.depth = vertex.position.z / vertex.position.w;
  653.  
  654. vertex.texcoord0 = texcoord0;
  655.  
  656. return vertex;
  657. }
  658.  
  659. /// SilhouetteVS
  660. ///
  661. ///
  662. SILHOUETTE_VERTEX SilhouetteVS(
  663. float3 position : POSITION0,
  664. float3 UnusedNormal : NORMAL, // tighten up the linkages for D3D10
  665. float3 UnusedTangent : TANGENT,
  666. float3 UnusedBinormal : BINORMAL,
  667. float4 UnusedTexcoord : TEXCOORD0,
  668. int boneIndex[4] : BLENDINDICES,
  669. float3 row0 : TEXCOORD1,
  670. float3 row1 : TEXCOORD2,
  671. float3 row2 : TEXCOORD3,
  672. float3 row3 : TEXCOORD4,
  673. anim_t anim : TEXCOORD5
  674. )
  675. {
  676. SILHOUETTE_VERTEX vertex = (SILHOUETTE_VERTEX)0;
  677.  
  678. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  679.  
  680. vertex.position = mul( float4(position,1), worldMatrix);
  681. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  682.  
  683. return vertex;
  684. }
  685.  
  686. /// ClutterVS
  687. ///
  688. ///
  689. CLUTTER_VERTEX ClutterVS(
  690. float3 position : POSITION0,
  691. float3 normal : NORMAL0,
  692. float3 tangent : TANGENT0,
  693. float3 binormal : BINORMAL0,
  694. float4 texcoord0 : TEXCOORD0,
  695. int boneIndex[4] : BLENDINDICES,
  696. float3 row0 : TEXCOORD1,
  697. float3 row1 : TEXCOORD2,
  698. float3 row2 : TEXCOORD3,
  699. float3 row3 : TEXCOORD4,
  700. anim_t anim : TEXCOORD5,
  701. float4 material : TEXCOORD6
  702. )
  703. {
  704. CLUTTER_VERTEX vertex = (CLUTTER_VERTEX)0;
  705.  
  706. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  707.  
  708. vertex.position = mul( float4(position,1), worldMatrix);
  709. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  710. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  711.  
  712. vertex.texcoord0 = texcoord0;
  713. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  714. vertex.dissolve = 0.003922 * anim.z;
  715.  
  716. float3x3 rotationMatrix = (float3x3)worldMatrix;
  717. vertex.normal = mul( normal, rotationMatrix);
  718. vertex.tangent = mul( tangent, rotationMatrix);
  719. vertex.binormal = mul( binormal, rotationMatrix);
  720.  
  721. return vertex;
  722. }
  723.  
  724. /// UndulatingClutterVS
  725. ///
  726. ///
  727. CLUTTER_VERTEX UndulatingClutterVS(
  728. float3 position : POSITION0,
  729. float3 normal : NORMAL0,
  730. float3 tangent : TANGENT0,
  731. float3 binormal : BINORMAL0,
  732. float4 texcoord0 : TEXCOORD0,
  733. int boneIndex[4] : BLENDINDICES,
  734. float3 row0 : TEXCOORD1,
  735. float3 row1 : TEXCOORD2,
  736. float3 row2 : TEXCOORD3,
  737. float3 row3 : TEXCOORD4,
  738. anim_t anim : TEXCOORD5,
  739. float4 material : TEXCOORD6
  740. )
  741. {
  742. CLUTTER_VERTEX vertex = (CLUTTER_VERTEX)0;
  743.  
  744. float weight = 0.1 * position.y;
  745. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  746.  
  747. vertex.position = mul( float4(position,1), worldMatrix);
  748.  
  749. float sinSq = sin( 0.0625 * time - dot( windDirection, row3.xyz));
  750. sinSq *= sinSq;
  751.  
  752. vertex.position.xyz += weight * sinSq * windDirection;
  753. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  754. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  755.  
  756. vertex.texcoord0 = texcoord0;
  757. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  758. vertex.dissolve = 0.003922 * anim.z;
  759.  
  760. float3x3 rotationMatrix = (float3x3)worldMatrix;
  761. vertex.normal = mul( normal, rotationMatrix);
  762. vertex.tangent = mul( tangent, rotationMatrix);
  763. vertex.binormal = mul( binormal, rotationMatrix);
  764.  
  765. return vertex;
  766. }
  767.  
  768. /// CartographicVS
  769. ///
  770. ///
  771. CARTOGRAPHIC_VERTEX CartographicVS(
  772. float3 position : POSITION0,
  773. float3 normal : NORMAL,
  774. float3 tangent : TANGENT,
  775. float3 binormal : BINORMAL,
  776. float4 texcoord0 : TEXCOORD0,
  777. int boneIndex[4] : BLENDINDICES,
  778. float3 row0 : TEXCOORD1,
  779. float3 row1 : TEXCOORD2,
  780. float3 row2 : TEXCOORD3,
  781. float3 row3 : TEXCOORD4,
  782. anim_t anim : TEXCOORD5,
  783. float4 color : COLOR0,
  784. float4 material : TEXCOORD6
  785. )
  786. {
  787. CARTOGRAPHIC_VERTEX vertex = (CARTOGRAPHIC_VERTEX)0;
  788. CompatSwizzle(color);
  789.  
  790. float4x4 worldMatrix = ComputeWorldMatrix(anim.y+boneIndex[0],row0,row1,row2,row3);
  791.  
  792. vertex.position = mul(float4(position,1),worldMatrix);
  793. vertex.elevation = vertex.position.y;
  794.  
  795. vertex.position = mul(vertex.position,mul(viewMatrix,projMatrix));
  796. vertex.texcoord = texcoord0;
  797. vertex.color = color;
  798.  
  799. float3x3 R = (float3x3)worldMatrix;
  800. vertex.normal = mul(normal,R);
  801. vertex.tangent = mul(tangent,R);
  802. vertex.binormal = mul(binormal,R);
  803.  
  804. return vertex;
  805. }
  806.  
  807. /// CartographicVS
  808. ///
  809. ///
  810. CARTOGRAPHIC_VERTEX CartographicFeedbackVS(
  811. float3 position : POSITION0,
  812. float3 normal : NORMAL,
  813. float3 tangent : TANGENT,
  814. float3 binormal : BINORMAL,
  815. float4 texcoord0 : TEXCOORD0,
  816. int boneIndex[4] : BLENDINDICES,
  817. float3 row0 : TEXCOORD1,
  818. float3 row1 : TEXCOORD2,
  819. float3 row2 : TEXCOORD3,
  820. float3 row3 : TEXCOORD4,
  821. anim_t anim : TEXCOORD5,
  822. float4 color : COLOR0,
  823. float4 material : TEXCOORD6
  824. )
  825. {
  826. CARTOGRAPHIC_VERTEX vertex = (CARTOGRAPHIC_VERTEX)0;
  827. CompatSwizzle(color);
  828.  
  829. float4x4 worldMatrix = ComputeWorldMatrix(anim.y+boneIndex[0],row0,row1,row2,row3);
  830.  
  831. vertex.position = mul(float4(position,1),worldMatrix);
  832. vertex.elevation = vertex.position.y;
  833.  
  834. vertex.position = mul(vertex.position,mul(viewMatrix,projMatrix));
  835. vertex.texcoord = texcoord0;
  836. vertex.color = color;
  837.  
  838. return vertex;
  839. }
  840.  
  841. /// FlatVS
  842. ///
  843. /// Flat vertex shader (no lighting)
  844. FLAT_VERTEX FlatVS(
  845. float3 position : POSITION0,
  846. float3 UnusedNormal : NORMAL, // tighten up the linkages for D3D10
  847. float3 UnusedTangent : TANGENT,
  848. float3 UnusedBinormal : BINORMAL,
  849. float4 texcoord0 : TEXCOORD0,
  850. int boneIndex[4] : BLENDINDICES,
  851. float3 row0 : TEXCOORD1,
  852. float3 row1 : TEXCOORD2,
  853. float3 row2 : TEXCOORD3,
  854. float3 row3 : TEXCOORD4,
  855. anim_t anim : TEXCOORD5,
  856. float4 color : COLOR0,
  857. float4 material : TEXCOORD6
  858. )
  859. {
  860. FLAT_VERTEX vertex = (FLAT_VERTEX)0;
  861. CompatSwizzle(color);
  862.  
  863. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  864.  
  865. vertex.position = mul( float4(position,1), worldMatrix);
  866. vertex.depth = vertex.position.y - surfaceElevation;
  867. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  868.  
  869. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  870. vertex.color = color;
  871. vertex.material = float4( time - material.x, material.yzw);
  872.  
  873. return vertex;
  874. }
  875.  
  876. /// VertexNormalVS
  877. ///
  878. /// Vertex normal lighting only
  879. VERTEXNORMAL_VERTEX VertexNormalVS(
  880. float3 position : POSITION0,
  881. float3 normal : NORMAL0,
  882. float3 UnusedTangent : TANGENT, // tighten up the linkages for D3D10
  883. float3 UnusedBinormal : BINORMAL,
  884. float4 texcoord0 : TEXCOORD0,
  885. int boneIndex[4] : BLENDINDICES,
  886. float3 row0 : TEXCOORD1,
  887. float3 row1 : TEXCOORD2,
  888. float3 row2 : TEXCOORD3,
  889. float3 row3 : TEXCOORD4,
  890. anim_t anim : TEXCOORD5,
  891. float4 material : TEXCOORD6,
  892. float4 color : COLOR0
  893. )
  894. {
  895. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  896. CompatSwizzle(color);
  897.  
  898. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  899.  
  900. vertex.position = mul( float4(position,1), worldMatrix);
  901. vertex.depth = vertex.position.y - surfaceElevation;
  902. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  903. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  904.  
  905. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  906. vertex.color = color;
  907. vertex.material = float4( time - material.x, material.yzw);
  908.  
  909. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  910.  
  911. return vertex;
  912. }
  913.  
  914. /// NormalMappedVS
  915. ///
  916. /// Normal mapped lighting
  917. NORMALMAPPED_VERTEX NormalMappedVS(
  918. float3 position : POSITION0,
  919. float3 normal : NORMAL0,
  920. float3 tangent : TANGENT0,
  921. float3 binormal : BINORMAL0,
  922. float4 texcoord0 : TEXCOORD0,
  923. int boneIndex[4] : BLENDINDICES,
  924. float3 row0 : TEXCOORD1,
  925. float3 row1 : TEXCOORD2,
  926. float3 row2 : TEXCOORD3,
  927. float3 row3 : TEXCOORD4,
  928. anim_t anim : TEXCOORD5,
  929. float4 material : TEXCOORD6,
  930. float4 color : COLOR0,
  931. float1 colorLookup : TEXCOORD7
  932. )
  933. {
  934. NORMALMAPPED_VERTEX vertex = (NORMALMAPPED_VERTEX)0;
  935. CompatSwizzle(color);
  936.  
  937. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  938.  
  939. vertex.position = mul( float4(position,1), worldMatrix);
  940. vertex.depth.xy = float2(vertex.position.y - surfaceElevation,material.x);
  941. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  942. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  943.  
  944. vertex.viewDirection = normalize( vertex.position.xyz / vertex.position.w);
  945. vertex.viewDirection = mul( viewMatrix, vertex.viewDirection);
  946.  
  947. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  948. vertex.color = color;
  949. vertex.material = float4( time - material.x, material.yzw);
  950.  
  951. float3x3 rotationMatrix = (float3x3)worldMatrix;
  952. vertex.normal = mul( normal, rotationMatrix);
  953. vertex.tangent = mul( tangent, rotationMatrix);
  954. vertex.binormal = mul( binormal, rotationMatrix);
  955.  
  956. return vertex;
  957. }
  958.  
  959. /// UnitFalloffVS
  960. ///
  961. /// Normal mapped lighting with color lookup instead of material parameters
  962. NORMALMAPPED_VERTEX UnitFalloffVS(
  963. float3 position : POSITION0,
  964. float3 normal : NORMAL0,
  965. float3 tangent : TANGENT0,
  966. float3 binormal : BINORMAL0,
  967. float4 texcoord0 : TEXCOORD0,
  968. int boneIndex[4] : BLENDINDICES,
  969. float3 row0 : TEXCOORD1,
  970. float3 row1 : TEXCOORD2,
  971. float3 row2 : TEXCOORD3,
  972. float3 row3 : TEXCOORD4,
  973. anim_t anim : TEXCOORD5,
  974. float4 material : TEXCOORD6,
  975. float4 color : COLOR0,
  976. float1 colorLookup : TEXCOORD7
  977. )
  978. {
  979. NORMALMAPPED_VERTEX vertex = (NORMALMAPPED_VERTEX)0;
  980. CompatSwizzle(color);
  981.  
  982. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  983.  
  984. vertex.position = mul( float4(position,1), worldMatrix);
  985. vertex.depth.xy = float2(vertex.position.y - surfaceElevation,material.x);
  986. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  987. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  988.  
  989. vertex.viewDirection = normalize( vertex.position.xyz / vertex.position.w);
  990. vertex.viewDirection = mul( viewMatrix, vertex.viewDirection);
  991.  
  992. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  993. vertex.color = color;
  994. vertex.material.x = colorLookup;
  995.  
  996. float3x3 rotationMatrix = (float3x3)worldMatrix;
  997. vertex.normal = mul( normal, rotationMatrix);
  998. vertex.tangent = mul( tangent, rotationMatrix);
  999. vertex.binormal = mul( binormal, rotationMatrix);
  1000.  
  1001. return vertex;
  1002. }
  1003.  
  1004. /// UndulatingNormalMappedVS
  1005. ///
  1006. /// Normal mapped lighting with
  1007. NORMALMAPPED_VERTEX UndulatingNormalMappedVS(
  1008. float3 position : POSITION0,
  1009. float3 normal : NORMAL0,
  1010. float3 tangent : TANGENT0,
  1011. float3 binormal : BINORMAL0,
  1012. float4 texcoord0 : TEXCOORD0,
  1013. int boneIndex[4] : BLENDINDICES,
  1014. float3 row0 : TEXCOORD1,
  1015. float3 row1 : TEXCOORD2,
  1016. float3 row2 : TEXCOORD3,
  1017. float3 row3 : TEXCOORD4,
  1018. anim_t anim : TEXCOORD5,
  1019. float4 material : TEXCOORD6,
  1020. float4 color : COLOR0
  1021. )
  1022. {
  1023. NORMALMAPPED_VERTEX vertex = (NORMALMAPPED_VERTEX)0;
  1024. CompatSwizzle(color);
  1025.  
  1026. float weight = 0.003 * position.y;
  1027. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1028.  
  1029. vertex.position = mul( float4(position,1), worldMatrix);
  1030. float sinSq = sin( 0.05 * time - dot(windDirection, row3.xyz));
  1031. sinSq *= sinSq;
  1032.  
  1033. vertex.position.xyz += weight * sinSq * windDirection;
  1034. vertex.depth.xy = float2(vertex.position.y - surfaceElevation,material.x);
  1035. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1036. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1037.  
  1038. vertex.viewDirection = normalize( vertex.position.xyz / vertex.position.w);
  1039. vertex.viewDirection = mul( viewMatrix, vertex.viewDirection);
  1040.  
  1041. vertex.texcoord0 = texcoord0;
  1042. vertex.color = color;
  1043. vertex.material = float4( time - material.x, material.yzw);
  1044.  
  1045. float3x3 rotationMatrix = (float3x3)worldMatrix;
  1046. vertex.normal = mul( normal, rotationMatrix);
  1047. vertex.tangent = mul( tangent, rotationMatrix);
  1048. vertex.binormal = mul( binormal, rotationMatrix);
  1049.  
  1050. return vertex;
  1051. }
  1052.  
  1053. /// BloatingNormalMappedVS
  1054. ///
  1055. ///
  1056. NORMALMAPPED_VERTEX BloatingNormalMappedVS(
  1057. float3 position : POSITION0,
  1058. float3 normal : NORMAL0,
  1059. float3 tangent : TANGENT0,
  1060. float3 binormal : BINORMAL0,
  1061. float4 texcoord0 : TEXCOORD0,
  1062. int boneIndex[4] : BLENDINDICES,
  1063. float3 row0 : TEXCOORD1,
  1064. float3 row1 : TEXCOORD2,
  1065. float3 row2 : TEXCOORD3,
  1066. float3 row3 : TEXCOORD4,
  1067. anim_t anim : TEXCOORD5,
  1068. float4 material : TEXCOORD6,
  1069. float4 color : COLOR0
  1070. )
  1071. {
  1072. NORMALMAPPED_VERTEX vertex = (NORMALMAPPED_VERTEX)0;
  1073. CompatSwizzle(color);
  1074.  
  1075. float weight = 0.003 * position.y;
  1076. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1077.  
  1078. float3 direction = normalize(position);
  1079. position += 2 * length(direction.xz) * sin( 0.1 * time + length(row3.xz)) * direction;
  1080.  
  1081. vertex.position = mul( float4(position,1), worldMatrix);
  1082. vertex.depth.xy = float2(vertex.position.y - surfaceElevation,material.x);
  1083. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1084. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1085.  
  1086. vertex.viewDirection = normalize( vertex.position.xyz / vertex.position.w);
  1087. vertex.viewDirection = mul( viewMatrix, vertex.viewDirection);
  1088.  
  1089. vertex.texcoord0 = texcoord0;
  1090. vertex.color = color;
  1091. vertex.material = float4( time - material.x, material.yzw);
  1092.  
  1093. float3x3 rotationMatrix = (float3x3)worldMatrix;
  1094. vertex.normal = mul( normal, rotationMatrix);
  1095. vertex.tangent = mul( tangent, rotationMatrix);
  1096. vertex.binormal = mul( binormal, rotationMatrix);
  1097.  
  1098. return vertex;
  1099. }
  1100.  
  1101. VERTEXNORMAL_VERTEX BloatingVertexNormalVS(
  1102. float3 position : POSITION0,
  1103. float3 normal : NORMAL0,
  1104. float3 UnusedTangent : TANGENT, // tighten up the linkages for D3D10
  1105. float3 UnusedBinormal : BINORMAL,
  1106. float4 texcoord0 : TEXCOORD0,
  1107. int boneIndex[4] : BLENDINDICES,
  1108. float3 row0 : TEXCOORD1,
  1109. float3 row1 : TEXCOORD2,
  1110. float3 row2 : TEXCOORD3,
  1111. float3 row3 : TEXCOORD4,
  1112. anim_t anim : TEXCOORD5,
  1113. float4 material : TEXCOORD6,
  1114. float4 color : COLOR0
  1115. )
  1116. {
  1117. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  1118. CompatSwizzle(color);
  1119.  
  1120. float weight = 0.003 * position.y;
  1121. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1122.  
  1123. float3 direction = normalize(position);
  1124. position += 2 * length(direction.xz) * sin( 0.1 * time + length(row3.xz)) * direction;
  1125.  
  1126. vertex.position = mul( float4(position,1), worldMatrix);
  1127. vertex.depth = vertex.position.y - surfaceElevation;
  1128. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1129. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1130.  
  1131. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  1132. vertex.color = color;
  1133. vertex.material = float4( time - material.x, material.yzw);
  1134.  
  1135. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1136.  
  1137. return vertex;
  1138. }
  1139.  
  1140. /// WreckageVS
  1141. ///
  1142. ///
  1143. NORMALMAPPED_VERTEX WreckageVS_HighFidelity(
  1144. float3 position : POSITION0,
  1145. float3 normal : NORMAL0,
  1146. float3 tangent : TANGENT0,
  1147. float3 binormal : BINORMAL0,
  1148. float4 texcoord0 : TEXCOORD0,
  1149. int boneIndex[4] : BLENDINDICES,
  1150. float3 row0 : TEXCOORD1,
  1151. float3 row1 : TEXCOORD2,
  1152. float3 row2 : TEXCOORD3,
  1153. float3 row3 : TEXCOORD4,
  1154. anim_t anim : TEXCOORD5,
  1155. float4 material : TEXCOORD6,
  1156. float4 color : COLOR0
  1157. )
  1158. {
  1159. NORMALMAPPED_VERTEX vertex = (NORMALMAPPED_VERTEX)0;
  1160. CompatSwizzle(color);
  1161.  
  1162. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1163. vertex.position = mul( float4(position,1), worldMatrix);
  1164.  
  1165. float3 nvert = normalize(vertex.position.xyz);
  1166. float s = nvert * 0.15;
  1167. float r = length(vertex.position.xyz); // Distance of vert from origin
  1168. float phi = frac( 0.01 * length(row3) );
  1169.  
  1170. vertex.position.x += sin( 14.5 * r * nvert.z + phi) * s;
  1171. vertex.position.y += cos( 10.8 * r * nvert.x + phi) * s;
  1172. vertex.position.z += sin( 20.5 * r * nvert.y + phi) * s;
  1173.  
  1174. // The rest is just the typical normal mapped vertex shader (sans scrolling)
  1175. vertex.depth.xy = float2(vertex.position.y - surfaceElevation,material.x);
  1176. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1177. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1178.  
  1179. vertex.viewDirection = normalize( vertex.position.xyz / vertex.position.w);
  1180. vertex.viewDirection = mul( viewMatrix, vertex.viewDirection);
  1181.  
  1182. vertex.texcoord0 = texcoord0;
  1183. vertex.color = color;
  1184. vertex.material = float4( time - material.x, material.yzw);
  1185.  
  1186. float3x3 rotationMatrix = (float3x3)worldMatrix;
  1187. vertex.normal = mul( normal, rotationMatrix);
  1188. vertex.tangent = mul( tangent, rotationMatrix);
  1189. vertex.binormal = mul( binormal, rotationMatrix);
  1190.  
  1191. return vertex;
  1192. }
  1193. /// WreckageVS_LowFidelity
  1194. ///
  1195. ///
  1196. VERTEXNORMAL_VERTEX WreckageVS_LowFidelity(
  1197. float3 position : POSITION0,
  1198. float3 normal : NORMAL0,
  1199. float3 tangent : TANGENT0,
  1200. float3 binormal : BINORMAL0,
  1201. float4 texcoord0 : TEXCOORD0,
  1202. int boneIndex[4] : BLENDINDICES,
  1203. float3 row0 : TEXCOORD1,
  1204. float3 row1 : TEXCOORD2,
  1205. float3 row2 : TEXCOORD3,
  1206. float3 row3 : TEXCOORD4,
  1207. anim_t anim : TEXCOORD5,
  1208. float4 material : TEXCOORD6,
  1209. float4 color : COLOR0
  1210. )
  1211. {
  1212. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  1213. CompatSwizzle(color);
  1214.  
  1215. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1216.  
  1217. /// Perturb the model space position for broken crunchiness.
  1218. /// The models are all different random sizes in model space, so we have to factor out a uniform scale
  1219. float s = length(row1.xyz);
  1220. float rdmOffset = frac( 0.01 * material.x );
  1221. position += (.05 / s) * ( cos( 15 * rdmOffset * position.x * s) + sin( 20 * rdmOffset * position.z * s));
  1222. position.y *= lerp(0.69, 1, rdmOffset);
  1223.  
  1224. /// the rest is just standard...
  1225. vertex.position = mul( float4(position,1), worldMatrix);
  1226. vertex.depth = vertex.position.y - surfaceElevation,material.x;
  1227. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1228. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1229.  
  1230. vertex.texcoord0 = texcoord0;
  1231. vertex.color = color;
  1232. vertex.material = float4( time - material.x, material.yzw);
  1233.  
  1234. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1235.  
  1236. return vertex;
  1237. }
  1238.  
  1239. /// EffectVS
  1240. ///
  1241. ///
  1242. EFFECT_VERTEX EffectVS(
  1243. float3 position : POSITION0,
  1244. float4 texcoord0 : TEXCOORD0,
  1245. float3 UnusedNormal : NORMAL, // tighten up the linkages for D3D10
  1246. float3 UnusedTangent : TANGENT,
  1247. float3 UnusedBinormal : BINORMAL,
  1248. int boneIndex[4] : BLENDINDICES,
  1249. float3 row0 : TEXCOORD1,
  1250. float3 row1 : TEXCOORD2,
  1251. float3 row2 : TEXCOORD3,
  1252. float3 row3 : TEXCOORD4,
  1253. anim_t anim : TEXCOORD5,
  1254. float4 material : TEXCOORD6,
  1255. float4 color : COLOR0
  1256. )
  1257. {
  1258. EFFECT_VERTEX vertex = (EFFECT_VERTEX)0;
  1259. CompatSwizzle(color);
  1260.  
  1261. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1262.  
  1263. vertex.position = mul( float4(position,1), worldMatrix);
  1264. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1265.  
  1266. vertex.texcoord0.xy = texcoord0.xy;
  1267. vertex.material = float4( time - material.x, material.yzw);
  1268. vertex.color = color;
  1269.  
  1270. return vertex;
  1271. }
  1272.  
  1273. /// AeonBuildVS
  1274. ///
  1275. /// Aeon build Vertex Shader
  1276. NORMALMAPPED_VERTEX AeonBuildVS(
  1277. float3 position : POSITION0,
  1278. float3 normal : NORMAL0,
  1279. float3 tangent : TANGENT0,
  1280. float3 binormal : BINORMAL0,
  1281. float4 texcoord0 : TEXCOORD0,
  1282. int boneIndex[4] : BLENDINDICES,
  1283. float3 row0 : TEXCOORD1,
  1284. float3 row1 : TEXCOORD2,
  1285. float3 row2 : TEXCOORD3,
  1286. float3 row3 : TEXCOORD4,
  1287. anim_t anim : TEXCOORD5,
  1288. float4 material : TEXCOORD6,
  1289. float4 color : COLOR0
  1290. )
  1291. {
  1292. NORMALMAPPED_VERTEX vertex = (NORMALMAPPED_VERTEX)0;
  1293. CompatSwizzle(color);
  1294.  
  1295. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1296.  
  1297. position *= max(material.y, 0.75);
  1298.  
  1299. vertex.position = mul( float4(position,1), worldMatrix);
  1300. vertex.depth.xy = float2(vertex.position.y - surfaceElevation,material.x);
  1301. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1302. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1303.  
  1304. vertex.viewDirection = normalize( vertex.position.xyz / vertex.position.w);
  1305. vertex.viewDirection = mul( viewMatrix, vertex.viewDirection);
  1306.  
  1307. vertex.texcoord0 = texcoord0;
  1308. vertex.color = color;
  1309. vertex.material = float4( time - material.x, material.yzw);
  1310.  
  1311. float3x3 rotationMatrix = (float3x3)worldMatrix;
  1312. vertex.normal = mul( normal, rotationMatrix);
  1313. vertex.tangent = mul( tangent, rotationMatrix);
  1314. vertex.binormal = mul( binormal, rotationMatrix);
  1315.  
  1316. return vertex;
  1317. }
  1318.  
  1319. VERTEXNORMAL_VERTEX AeonBuildLoFiVS(
  1320. float3 position : POSITION0,
  1321. float3 normal : NORMAL0,
  1322. float4 texcoord0 : TEXCOORD0,
  1323. float3 UnusedNormal : NORMAL, // tighten up the linkages for D3D10
  1324. float3 UnusedTangent : TANGENT,
  1325. float3 UnusedBinormal : BINORMAL,
  1326. int boneIndex[4] : BLENDINDICES,
  1327. float3 row0 : TEXCOORD1,
  1328. float3 row1 : TEXCOORD2,
  1329. float3 row2 : TEXCOORD3,
  1330. float3 row3 : TEXCOORD4,
  1331. anim_t anim : TEXCOORD5,
  1332. float4 material : TEXCOORD6,
  1333. float4 color : COLOR0,
  1334. uniform float texScale0,
  1335. uniform float texScale1,
  1336. uniform float texXshift0,
  1337. uniform float texYshift0,
  1338. uniform float texXshift1,
  1339. uniform float texYshift1
  1340. )
  1341. {
  1342. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  1343. CompatSwizzle(color);
  1344.  
  1345. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1346. position *= max(material.y, 0.75);
  1347.  
  1348. vertex.position = mul( float4(position,1), worldMatrix);
  1349. vertex.depth = vertex.position.y - surfaceElevation;
  1350. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1351. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1352. vertex.color = color;
  1353.  
  1354. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  1355. vertex.material = float4( time - material.x, material.yzw);
  1356.  
  1357. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1358.  
  1359. // Texture coordinate modification for PS
  1360. vertex.shadow.xy = vertex.texcoord0.xy;
  1361. vertex.texcoord0.xy *= texScale0;
  1362. vertex.shadow.xy *= texScale1;
  1363. vertex.texcoord0.x += (vertex.material.x * texXshift0);
  1364. vertex.texcoord0.y += (vertex.material.x * texYshift0);
  1365. vertex.shadow.x += (vertex.material.x * texXshift1);
  1366. vertex.shadow.y += (vertex.material.x * texYshift1);
  1367.  
  1368. return vertex;
  1369. }
  1370.  
  1371. // SeraphimBuildVS
  1372. ///
  1373. /// Seraphim build Vertex Shader
  1374. NORMALMAPPED_VERTEX SeraphimBuildVS(
  1375. float3 position : POSITION0,
  1376. float3 normal : NORMAL0,
  1377. float3 tangent : TANGENT0,
  1378. float3 binormal : BINORMAL0,
  1379. float4 texcoord0 : TEXCOORD0,
  1380. int boneIndex[4] : BLENDINDICES,
  1381. float3 row0 : TEXCOORD1,
  1382. float3 row1 : TEXCOORD2,
  1383. float3 row2 : TEXCOORD3,
  1384. float3 row3 : TEXCOORD4,
  1385. anim_t anim : TEXCOORD5,
  1386. float4 material : TEXCOORD6,
  1387. float4 color : COLOR0,
  1388. float1 colorLookup : TEXCOORD7
  1389. )
  1390. {
  1391. NORMALMAPPED_VERTEX vertex = (NORMALMAPPED_VERTEX)0;
  1392. CompatSwizzle(color);
  1393.  
  1394. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1395.  
  1396. position *= 0.25 + (material.y * 0.75);
  1397.  
  1398. vertex.position = mul( float4(position,1), worldMatrix);
  1399. vertex.depth.xy = float2(vertex.position.y - surfaceElevation,colorLookup);
  1400. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1401. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1402.  
  1403. vertex.viewDirection = normalize( vertex.position.xyz / vertex.position.w);
  1404. vertex.viewDirection = mul( viewMatrix, vertex.viewDirection);
  1405.  
  1406. vertex.texcoord0 = texcoord0;
  1407. vertex.color = color;
  1408. vertex.material = float4( time - material.x, material.yzw);
  1409.  
  1410. float3x3 rotationMatrix = (float3x3)worldMatrix;
  1411. vertex.normal = mul( normal, rotationMatrix);
  1412. vertex.tangent = mul( tangent, rotationMatrix);
  1413. vertex.binormal = mul( binormal, rotationMatrix);
  1414.  
  1415. return vertex;
  1416. }
  1417.  
  1418.  
  1419. // SeraphimBuildLofiVS
  1420. ///
  1421. /// Seraphim build Vertex Shader
  1422. VERTEXNORMAL_VERTEX SeraphimBuildLofiVS(
  1423. float3 position : POSITION0,
  1424. float3 normal : NORMAL0,
  1425. float3 UnusedTangent : TANGENT,
  1426. float3 UnusedBinormal : BINORMAL,
  1427. float4 texcoord0 : TEXCOORD0,
  1428. int boneIndex[4] : BLENDINDICES,
  1429. float3 row0 : TEXCOORD1,
  1430. float3 row1 : TEXCOORD2,
  1431. float3 row2 : TEXCOORD3,
  1432. float3 row3 : TEXCOORD4,
  1433. anim_t anim : TEXCOORD5,
  1434. float4 material : TEXCOORD6,
  1435. float4 color : COLOR0
  1436. )
  1437. {
  1438. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  1439. CompatSwizzle(color);
  1440.  
  1441. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1442.  
  1443. position *= 0.25 + (material.y * 0.75);
  1444. vertex.position = mul( float4(position,1), worldMatrix);
  1445. vertex.depth = vertex.position.y - surfaceElevation;
  1446. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1447. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1448.  
  1449. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  1450. vertex.color = color;
  1451. vertex.material = float4( time - material.x, material.yzw);
  1452.  
  1453. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1454.  
  1455. return vertex;
  1456. }
  1457.  
  1458.  
  1459.  
  1460. /// PositionNormalOffsetVS
  1461. ///
  1462. /// Position Normal Offset VS
  1463. VERTEXNORMAL_VERTEX PositionNormalOffsetVS(
  1464. float3 position : POSITION0,
  1465. float3 normal : NORMAL0,
  1466. float3 UnusedTangent : TANGENT, // tighten up the linkages for D3D10
  1467. float3 UnusedBinormal : BINORMAL,
  1468. float4 texcoord0 : TEXCOORD0,
  1469. int boneIndex[4] : BLENDINDICES,
  1470. float3 row0 : TEXCOORD1,
  1471. float3 row1 : TEXCOORD2,
  1472. float3 row2 : TEXCOORD3,
  1473. float3 row3 : TEXCOORD4,
  1474. anim_t anim : TEXCOORD5,
  1475. float4 material : TEXCOORD6,
  1476. float4 color : COLOR0,
  1477. uniform float normalOffset
  1478. )
  1479. {
  1480. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  1481. CompatSwizzle(color);
  1482.  
  1483. int bone = anim.y + boneIndex[0];
  1484.  
  1485. float4x4 worldMatrix = ComputeWorldMatrix( bone, row0, row1, row2, row3);
  1486. // Offset the vertex position slightly by its normal
  1487. position += normal * 1 / transPalette[bone].w * normalOffset;
  1488.  
  1489. vertex.position = mul( float4(position,1), worldMatrix);
  1490. vertex.depth = vertex.position.y - surfaceElevation,material.x;
  1491. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1492. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1493.  
  1494. vertex.texcoord0 = texcoord0;
  1495. vertex.color = color;
  1496. vertex.material = float4( time - material.x, material.yzw);
  1497.  
  1498. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1499.  
  1500. return vertex;
  1501. }
  1502.  
  1503. VERTEXNORMAL_VERTEX EffectVertexNormalHiFiVS(
  1504. float3 position : POSITION0,
  1505. float3 normal : NORMAL0,
  1506. float3 UnusedTangent : TANGENT, // tighten up the linkages for D3D10
  1507. float3 UnusedBinormal : BINORMAL,
  1508. float4 texcoord0 : TEXCOORD0,
  1509. int boneIndex[4] : BLENDINDICES,
  1510. float3 row0 : TEXCOORD1,
  1511. float3 row1 : TEXCOORD2,
  1512. float3 row2 : TEXCOORD3,
  1513. float3 row3 : TEXCOORD4,
  1514. anim_t anim : TEXCOORD5,
  1515. float4 material : TEXCOORD6,
  1516. float4 color : COLOR0,
  1517. uniform float texScale0,
  1518. uniform float texScale1,
  1519. uniform float texXshift0,
  1520. uniform float texYshift0,
  1521. uniform float texXshift1,
  1522. uniform float texYshift1
  1523. )
  1524. {
  1525. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  1526. CompatSwizzle(color);
  1527.  
  1528. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1529.  
  1530. vertex.position = mul( float4(position,1), worldMatrix);
  1531. vertex.depth = vertex.position.y - surfaceElevation;
  1532. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1533. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1534.  
  1535. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  1536. vertex.material = float4( time - material.x, material.yzw);
  1537.  
  1538. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1539.  
  1540. // Texture coordinate modification for PS
  1541. vertex.texcoord0.xy *= texScale0;
  1542. vertex.texcoord0.zw *= texScale1;
  1543. vertex.texcoord0.x += (vertex.material.x * texXshift0);
  1544. vertex.texcoord0.y += (vertex.material.x * texYshift0);
  1545. vertex.texcoord0.zw += (vertex.material.x * texXshift1);
  1546. vertex.texcoord0.zw += (vertex.material.x * texYshift1);
  1547.  
  1548. return vertex;
  1549. }
  1550.  
  1551.  
  1552. VERTEXNORMAL_VERTEX EffectVertexNormalLoFiVS(
  1553. float3 position : POSITION0,
  1554. float3 normal : NORMAL0,
  1555. float3 UnusedTangent : TANGENT, // tighten up the linkages for D3D10
  1556. float3 UnusedBinormal : BINORMAL,
  1557. float4 texcoord0 : TEXCOORD0,
  1558. int boneIndex[4] : BLENDINDICES,
  1559. float3 row0 : TEXCOORD1,
  1560. float3 row1 : TEXCOORD2,
  1561. float3 row2 : TEXCOORD3,
  1562. float3 row3 : TEXCOORD4,
  1563. anim_t anim : TEXCOORD5,
  1564. float4 material : TEXCOORD6,
  1565. float4 color : COLOR0,
  1566. uniform float texScale0,
  1567. uniform float texScale1,
  1568. uniform float texXshift0,
  1569. uniform float texYshift0,
  1570. uniform float texXshift1,
  1571. uniform float texYshift1
  1572. )
  1573. {
  1574. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  1575. CompatSwizzle(color);
  1576.  
  1577. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1578.  
  1579. vertex.position = mul( float4(position,1), worldMatrix);
  1580. vertex.depth = vertex.position.y - surfaceElevation;
  1581. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1582. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1583.  
  1584. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  1585. vertex.material = float4( time - material.x, material.yzw);
  1586.  
  1587. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1588.  
  1589. // Texture coordinate modification for PS
  1590. vertex.shadow.xy = vertex.texcoord0.xy;
  1591. vertex.texcoord0.xy *= texScale0;
  1592. vertex.shadow.xy *= texScale1;
  1593. vertex.texcoord0.x += (vertex.material.x * texXshift0);
  1594. vertex.texcoord0.y += (vertex.material.x * texYshift0);
  1595. vertex.shadow.x += (vertex.material.x * texXshift1);
  1596. vertex.shadow.y += (vertex.material.x * texYshift1);
  1597.  
  1598. return vertex;
  1599. }
  1600.  
  1601. /// FourUVTexShiftScaleVS
  1602. ///
  1603. /// Vertex normal lighting only
  1604. EFFECT_VERTEX FourUVTexShiftScaleVS(
  1605. float3 position : POSITION0,
  1606. float3 normal : NORMAL0,
  1607. float3 UnusedTangent : TANGENT, // tighten up the linkages for D3D10
  1608. float3 UnusedBinormal : BINORMAL,
  1609. float4 texcoord0 : TEXCOORD0,
  1610. int boneIndex[4] : BLENDINDICES,
  1611. float3 row0 : TEXCOORD1,
  1612. float3 row1 : TEXCOORD2,
  1613. float3 row2 : TEXCOORD3,
  1614. float3 row3 : TEXCOORD4,
  1615. anim_t anim : TEXCOORD5,
  1616. float4 material : TEXCOORD6,
  1617. float4 color : COLOR0,
  1618. uniform float texScale0,
  1619. uniform float texScale1,
  1620. uniform float texScale2,
  1621. uniform float texScale3,
  1622. uniform float texXshift0,
  1623. uniform float texYshift0,
  1624. uniform float texXshift1,
  1625. uniform float texYshift1,
  1626. uniform float texXshift2,
  1627. uniform float texYshift2,
  1628. uniform float texXshift3,
  1629. uniform float texYshift3
  1630. )
  1631. {
  1632. EFFECT_VERTEX vertex = (EFFECT_VERTEX)0;
  1633. CompatSwizzle(color);
  1634.  
  1635. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1636.  
  1637. vertex.position = mul( float4(position,1), worldMatrix);
  1638. vertex.depth = vertex.position.y - surfaceElevation;
  1639. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1640. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1641.  
  1642. vertex.texcoord0 = texcoord0;
  1643. vertex.texcoord1 = texcoord0;
  1644. vertex.color = color;
  1645. vertex.material = float4( time - material.x, material.yzw);
  1646.  
  1647. vertex.texcoord0.xy *= texScale0;
  1648. vertex.texcoord0.zw *= texScale1;
  1649. vertex.texcoord1.xy *= texScale2;
  1650. vertex.texcoord1.zw *= texScale3;
  1651. vertex.texcoord0.x += (vertex.material.x * texXshift0);
  1652. vertex.texcoord0.y += (vertex.material.x * texYshift0);
  1653. vertex.texcoord0.z += (vertex.material.x * texXshift1);
  1654. vertex.texcoord0.w += (vertex.material.x * texYshift1);
  1655. vertex.texcoord1.x += (vertex.material.x * texXshift2);
  1656. vertex.texcoord1.y += (vertex.material.x * texYshift2);
  1657. vertex.texcoord1.z += (vertex.material.x * texXshift3);
  1658. vertex.texcoord1.w += (vertex.material.x * texYshift3);
  1659.  
  1660. return vertex;
  1661. }
  1662.  
  1663. EFFECT_NORMALMAPPED_VERTEX ShieldNormalVS(
  1664. float3 position : POSITION0,
  1665. float3 normal : NORMAL0,
  1666. float3 tangent : TANGENT0,
  1667. float3 binormal : BINORMAL0,
  1668. float4 texcoord0 : TEXCOORD0,
  1669. int boneIndex[4] : BLENDINDICES,
  1670. float3 row0 : TEXCOORD1,
  1671. float3 row1 : TEXCOORD2,
  1672. float3 row2 : TEXCOORD3,
  1673. float3 row3 : TEXCOORD4,
  1674. anim_t anim : TEXCOORD5,
  1675. float4 material : TEXCOORD6,
  1676. float4 color : COLOR0,
  1677. uniform float texScale0,
  1678. uniform float texScale1,
  1679. uniform float texScale2,
  1680. uniform float texScale3,
  1681. uniform float texXshift0,
  1682. uniform float texYshift0,
  1683. uniform float texXshift1,
  1684. uniform float texYshift1,
  1685. uniform float texXshift2,
  1686. uniform float texYshift2,
  1687. uniform float texXshift3,
  1688. uniform float texYshift3
  1689. )
  1690. {
  1691. EFFECT_NORMALMAPPED_VERTEX vertex = (EFFECT_NORMALMAPPED_VERTEX)0;
  1692. CompatSwizzle(color);
  1693.  
  1694. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1695.  
  1696. vertex.position = mul( float4(position,1), worldMatrix);
  1697. vertex.depth = float2(vertex.position.y - surfaceElevation,material.x);
  1698. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1699.  
  1700. vertex.viewDirection = normalize( vertex.position.xyz / vertex.position.w);
  1701. vertex.viewDirection = mul( viewMatrix, vertex.viewDirection);
  1702.  
  1703. vertex.texcoord0 = texcoord0;
  1704. vertex.texcoord1 = texcoord0;
  1705. vertex.color = color;
  1706. vertex.material = float4( time - material.x, material.yzw);
  1707.  
  1708. float3x3 rotationMatrix = (float3x3)worldMatrix;
  1709. vertex.normal = mul( normal, rotationMatrix);
  1710. vertex.tangent = mul( tangent, rotationMatrix);
  1711. vertex.binormal = mul( binormal, rotationMatrix);
  1712.  
  1713. vertex.texcoord0.xy *= texScale0;
  1714. vertex.texcoord0.zw *= texScale1;
  1715. vertex.texcoord1.xy *= texScale2;
  1716. vertex.texcoord1.zw *= texScale3;
  1717. vertex.texcoord0.x += (vertex.material.x * texXshift0);
  1718. vertex.texcoord0.y += (vertex.material.x * texYshift0);
  1719. vertex.texcoord0.z += (vertex.material.x * texXshift1);
  1720. vertex.texcoord0.w += (vertex.material.x * texYshift1);
  1721. vertex.texcoord1.x += (vertex.material.x * texXshift2);
  1722. vertex.texcoord1.y += (vertex.material.x * texYshift2);
  1723. vertex.texcoord1.z += (vertex.material.x * texXshift3);
  1724. vertex.texcoord1.w += (vertex.material.x * texYshift3);
  1725.  
  1726. return vertex;
  1727. }
  1728.  
  1729. EFFECT_VERTEX ShieldPositionNormalOffsetVS(
  1730. float3 position : POSITION0,
  1731. float3 normal : NORMAL0,
  1732. float3 UnusedTangent : TANGENT, // tighten up linkages for D3D10
  1733. float3 UnusedBinormal : BINORMAL,
  1734. float4 texcoord0 : TEXCOORD0,
  1735. int boneIndex[4] : BLENDINDICES,
  1736. float3 row0 : TEXCOORD1,
  1737. float3 row1 : TEXCOORD2,
  1738. float3 row2 : TEXCOORD3,
  1739. float3 row3 : TEXCOORD4,
  1740. anim_t anim : TEXCOORD5,
  1741. float4 material : TEXCOORD6,
  1742. float4 color : COLOR0,
  1743. uniform float normalOffset,
  1744. uniform float texScale0,
  1745. uniform float texScale1,
  1746. uniform float texScale2,
  1747. uniform float texScale3,
  1748. uniform float texXshift0,
  1749. uniform float texYshift0,
  1750. uniform float texXshift1,
  1751. uniform float texYshift1,
  1752. uniform float texXshift2,
  1753. uniform float texYshift2,
  1754. uniform float texXshift3,
  1755. uniform float texYshift3
  1756. )
  1757. {
  1758. EFFECT_VERTEX vertex = (EFFECT_VERTEX)0;
  1759. CompatSwizzle(color);
  1760.  
  1761. int bone = anim.y + boneIndex[0];
  1762.  
  1763. float4x4 worldMatrix = ComputeWorldMatrix( bone, row0, row1, row2, row3);
  1764. // Offset the vertex position slightly by its normal
  1765. position += normal * 1 / transPalette[bone].w * normalOffset;
  1766.  
  1767. vertex.position = mul( float4(position,1), worldMatrix);
  1768. vertex.depth = vertex.position.y - surfaceElevation,material.x;
  1769. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1770. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1771.  
  1772. vertex.texcoord0 = texcoord0;
  1773. vertex.texcoord1 = texcoord0;
  1774. vertex.color = color;
  1775. vertex.material = float4( time - material.x, material.yzw);
  1776.  
  1777. vertex.texcoord0.xy *= texScale0;
  1778. vertex.texcoord0.zw *= texScale1;
  1779. vertex.texcoord1.xy *= texScale2;
  1780. vertex.texcoord1.zw *= texScale3;
  1781. vertex.texcoord0.x += (vertex.material.x * texXshift0);
  1782. vertex.texcoord0.y += (vertex.material.x * texYshift0);
  1783. vertex.texcoord0.z += (vertex.material.x * texXshift1);
  1784. vertex.texcoord0.w += (vertex.material.x * texYshift1);
  1785. vertex.texcoord1.x += (vertex.material.x * texXshift2);
  1786. vertex.texcoord1.y += (vertex.material.x * texYshift2);
  1787. vertex.texcoord1.z += (vertex.material.x * texXshift3);
  1788. vertex.texcoord1.w += (vertex.material.x * texYshift3);
  1789.  
  1790. return vertex;
  1791. }
  1792.  
  1793. LOFIEFFECT_VERTEX ThreeUVTexShiftScaleLoFiVS(
  1794. float3 position : POSITION0,
  1795. float3 normal : NORMAL0,
  1796. float3 UnusedTangent : TANGENT, // tighten up linkages for D3D10
  1797. float3 UnusedBinormal : BINORMAL,
  1798. float4 texcoord0 : TEXCOORD0,
  1799. int boneIndex[4] : BLENDINDICES,
  1800. float3 row0 : TEXCOORD1,
  1801. float3 row1 : TEXCOORD2,
  1802. float3 row2 : TEXCOORD3,
  1803. float3 row3 : TEXCOORD4,
  1804. anim_t anim : TEXCOORD5,
  1805. float4 material : TEXCOORD6,
  1806. float4 color : COLOR0,
  1807. uniform float texScale0,
  1808. uniform float texScale1,
  1809. uniform float texScale2,
  1810. uniform float texXshift0,
  1811. uniform float texYshift0,
  1812. uniform float texXshift1,
  1813. uniform float texYshift1,
  1814. uniform float texXshift2,
  1815. uniform float texYshift2
  1816. )
  1817. {
  1818. LOFIEFFECT_VERTEX vertex = (LOFIEFFECT_VERTEX)0;
  1819. CompatSwizzle(color);
  1820.  
  1821. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1822.  
  1823. vertex.position = mul( float4(position,1), worldMatrix);
  1824. vertex.depth = vertex.position.y - surfaceElevation;
  1825. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1826. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1827.  
  1828. vertex.texcoord0 = texcoord0;
  1829. vertex.texcoord1 = texcoord0;
  1830. vertex.texcoord2 = texcoord0;
  1831. vertex.color = color;
  1832. vertex.material = float4( time - material.x, material.yzw);
  1833.  
  1834. vertex.texcoord0.xy *= texScale0;
  1835. vertex.texcoord1.xy *= texScale1;
  1836. vertex.texcoord2.xy *= texScale2;
  1837. vertex.texcoord0.x += (vertex.material.x * texXshift0);
  1838. vertex.texcoord0.y += (vertex.material.x * texYshift0);
  1839. vertex.texcoord1.x += (vertex.material.x * texXshift1);
  1840. vertex.texcoord1.y += (vertex.material.x * texYshift1);
  1841. vertex.texcoord2.x += (vertex.material.x * texXshift2);
  1842. vertex.texcoord2.y += (vertex.material.x * texYshift2);
  1843.  
  1844. return vertex;
  1845. }
  1846.  
  1847. SHIELDIMPACT_VERTEX ShieldImpactVS(
  1848. float3 position : POSITION0,
  1849. float3 normal : NORMAL0,
  1850. float3 UnusedTangent : TANGENT, // tighten up linkages for D3D10
  1851. float3 UnusedBinormal : BINORMAL,
  1852. float4 texcoord0 : TEXCOORD0,
  1853. int boneIndex[4] : BLENDINDICES,
  1854. float3 row0 : TEXCOORD1,
  1855. float3 row1 : TEXCOORD2,
  1856. float3 row2 : TEXCOORD3,
  1857. float3 row3 : TEXCOORD4,
  1858. anim_t anim : TEXCOORD5,
  1859. float4 material : TEXCOORD6,
  1860. float4 color : COLOR0,
  1861. uniform float texcoord0Xshift,
  1862. uniform float texcoord0Ybshift,
  1863. uniform float texcoord0Yeshift,
  1864. uniform float texcoord0YOffset,
  1865. uniform float texcoord1Scale,
  1866. uniform float texcoord1Xshift,
  1867. uniform float texcoord1Yshift,
  1868. uniform float texcoord2XOffset,
  1869. uniform float fadeTime
  1870.  
  1871. )
  1872. {
  1873. SHIELDIMPACT_VERTEX vertex = (SHIELDIMPACT_VERTEX)0;
  1874. CompatSwizzle(color);
  1875.  
  1876. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1877. vertex.position = mul( float4(position,1), worldMatrix);
  1878. vertex.depth = vertex.position.y - surfaceElevation;
  1879. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1880.  
  1881. vertex.material = float4( time - material.x, material.yzw);
  1882.  
  1883. vertex.texcoord0 = texcoord0;
  1884. vertex.texcoord1 = texcoord0;
  1885. vertex.texcoord2 = texcoord0;
  1886.  
  1887. // Texcoord 1, Interpolated uv shifting
  1888. vertex.texcoord0.x += texcoord0Xshift * vertex.material.x;
  1889. vertex.texcoord0.y += texcoord0YOffset + (lerp(texcoord0Ybshift, texcoord0Yeshift, vertex.material.x/fadeTime ) * vertex.material.x);
  1890.  
  1891. // Texcoord 1, shift and scale
  1892. vertex.texcoord1.xy *= texcoord1Scale;
  1893. vertex.texcoord1.x += texcoord1Xshift * vertex.material.x;
  1894. vertex.texcoord1.y += texcoord1Yshift * vertex.material.x;
  1895.  
  1896. // Texcoord 2, Initial x-offset
  1897. vertex.texcoord2.x += frac( texcoord2XOffset * material.x );
  1898.  
  1899. return vertex;
  1900. }
  1901.  
  1902. /// CommandFeedbackVS
  1903. ///
  1904. /// Vertex normal lighting only
  1905. VERTEXNORMAL_VERTEX CommandFeedbackVS(
  1906. float3 position : POSITION0,
  1907. float3 normal : NORMAL0,
  1908. float3 UnusedTangent : TANGENT, // tighten up the linkages for D3D10
  1909. float3 UnusedBinormal : BINORMAL,
  1910. float4 texcoord0 : TEXCOORD0,
  1911. int boneIndex[4] : BLENDINDICES,
  1912. float3 row0 : TEXCOORD1,
  1913. float3 row1 : TEXCOORD2,
  1914. float3 row2 : TEXCOORD3,
  1915. float3 row3 : TEXCOORD4,
  1916. anim_t anim : TEXCOORD5,
  1917. float4 material : TEXCOORD6,
  1918. float4 color : COLOR0,
  1919. uniform float scaleTo
  1920. )
  1921. {
  1922. VERTEXNORMAL_VERTEX vertex = (VERTEXNORMAL_VERTEX)0;
  1923. CompatSwizzle(color);
  1924.  
  1925. float4x4 worldMatrix = ComputeWorldMatrix( anim.y + boneIndex[0], row0, row1, row2, row3);
  1926. float lodScale = mul(lodBasis,float4(worldMatrix[3].xyz,1));
  1927. position *= lerp( 1, 15, (lodScale - 10.5 ) * 0.001 );
  1928. float age = time - material.x;
  1929. float t = saturate( age / material.y );
  1930. position *= lerp( 1.0, scaleTo, t );
  1931.  
  1932. vertex.position = mul( float4(position,1), worldMatrix);
  1933. vertex.depth = vertex.position.y - surfaceElevation;
  1934. vertex.shadow = ComputeShadowTexcoord( vertex.position);
  1935. vertex.position = mul( vertex.position, mul( viewMatrix, projMatrix));
  1936.  
  1937. vertex.texcoord0 = ( anim.w > 0.5 ) ? ComputeScrolledTexcoord( texcoord0, material) : texcoord0;
  1938. vertex.color = color;
  1939. vertex.material = float4( 1 - t, material.yzw);
  1940.  
  1941. vertex.normal = normalize( mul( normal, (float3x3)worldMatrix));
  1942.  
  1943. return vertex;
  1944. }
  1945.  
  1946.  
  1947.  
  1948.  
  1949. ///////////////////////////////////////
  1950. ///
  1951. /// Pixel Shaders
  1952. ///
  1953. ///////////////////////////////////////
  1954.  
  1955. /// DepthPS
  1956. ///
  1957. /// Depth pixel shader.
  1958. float4 DepthPS( DEPTH_VERTEX vertex, uniform bool clipTest) : COLOR0
  1959. {
  1960. if ( clipTest )
  1961. clip( tex2D( albedoSampler, vertex.texcoord0.xy).a - 0.5);
  1962. return float4( vertex.depth, 0, 0, 1);
  1963. }
  1964.  
  1965. /// CartographicPS
  1966. ///
  1967. ///
  1968. float4 CartographicPS( CARTOGRAPHIC_VERTEX vertex, uniform bool hypsometric) : COLOR0
  1969. {
  1970. clip(vertex.elevation-surfaceElevation);
  1971.  
  1972. float3 normal = normalize(vertex.normal);
  1973.  
  1974. float3 color = vertex.color.rgb;
  1975. if ( hypsometric )
  1976. {
  1977. float elevation = ( vertex.elevation - minimumElevation ) / ( maximumElevation - minimumElevation );
  1978.  
  1979. clip(tex2D(albedoSampler,vertex.texcoord.xy).a-0.5);
  1980. color = tex1D(hypsometricSampler,elevation).rgb;
  1981.  
  1982. float tone = dot(normal,normalize(float3(-1,3,-1)));
  1983. float ca = 0.25;
  1984. float cd0 = ( tone > 0.21 ) ? 0.25 : 0.0;
  1985. float cd1 = ( tone > 0.66 ) ? 0.50 : 0.0;
  1986. float cs = ( tone > 0.95 ) ? 0.10 : 0.0;
  1987. color = ca * color + cd0 * color + cd1 * color + cs;
  1988.  
  1989. return float4(color,1);
  1990. }
  1991.  
  1992. float edge = clamp(1-saturate(dot(normal,float3(0,1,0))),0.5,1.0);
  1993.  
  1994. return float4(color,edge);
  1995. }
  1996.  
  1997. /// CartographicFeedbackPS
  1998. ///
  1999. ///
  2000. float4 CartographicFeedbackPS( CARTOGRAPHIC_VERTEX vertex, uniform bool hypsometric) : COLOR0
  2001. {
  2002. clip(vertex.elevation-surfaceElevation);
  2003. float4 color = tex2D(albedoSampler,vertex.texcoord.xy);
  2004. return float4(color.rgb,1);
  2005. }
  2006.  
  2007. /// CartographicGlowPS
  2008. ///
  2009. ///
  2010. float4 CartographicGlowPS( CARTOGRAPHIC_VERTEX vertex) : COLOR0
  2011. {
  2012. clip(vertex.elevation-surfaceElevation);
  2013.  
  2014. float3 normal = normalize(vertex.normal);
  2015. float edge = 1-saturate(dot(normal,float3(0,1,0)));
  2016.  
  2017. return float4(0,0,0,0.2*edge*edge);
  2018. }
  2019.  
  2020. /// CartographicPlacePS
  2021. ///
  2022. ///
  2023. float4 CartographicPlacePS( CARTOGRAPHIC_VERTEX vertex) : COLOR0
  2024. {
  2025. clip(vertex.elevation-surfaceElevation);
  2026. float3 color = vertex.color.rgb;
  2027. return float4(color,0.125);
  2028. }
  2029.  
  2030. /// CartographicBuildPS
  2031. ///
  2032. ///
  2033. float4 CartographicBuildPS( CARTOGRAPHIC_VERTEX vertex) : COLOR0
  2034. {
  2035. clip(vertex.elevation-surfaceElevation);
  2036. float3 color = saturate(vertex.color.rgb + float3(0.1,0.1,0.1));
  2037. return float4(color,0.4);
  2038. }
  2039.  
  2040. /// CartographicShieldPS
  2041. ///
  2042. ///
  2043. float4 CartographicShieldPS( CARTOGRAPHIC_VERTEX vertex) : COLOR0
  2044. {
  2045. float tone = saturate(dot(normalize(vertex.normal),normalize(float3(-1,3,-1))));
  2046.  
  2047. tone = pow(tone,80);
  2048. float3 color = lerp(float3(0,0,0),float3(1,1,1),tone);
  2049.  
  2050. return float4(color,0.4*tone);
  2051. }
  2052.  
  2053. /// FlatPS
  2054. ///
  2055. /// Flat pixel shader (no lighting)
  2056. float4 FlatPS( FLAT_VERTEX vertex,
  2057. uniform bool alphaTestEnable,
  2058. uniform int alphaFunc,
  2059. uniform int alphaRef ) : COLOR0
  2060. {
  2061. if ( 1 == mirrored ) clip(vertex.depth.x);
  2062.  
  2063. float4 color = vertex.color * tex2D( albedoSampler, vertex.texcoord0.xy);
  2064. float alpha = mirrored ? 0.5 : vertex.material.g * color.a;
  2065.  
  2066. #ifdef DIRECT3D10
  2067. if( alphaTestEnable )
  2068. AlphaTestD3D10( alpha, alphaFunc, alphaRef );
  2069. #endif
  2070. return float4( color.rgb, alpha);
  2071. }
  2072.  
  2073. /// VertexNormalPS_HighFidelity
  2074. ///
  2075. /// Lighting using vertex normals only.
  2076. float4 VertexNormalPS_HighFidelity( VERTEXNORMAL_VERTEX vertex,
  2077. uniform bool hiDefShadows,
  2078. uniform bool alphaTestEnable,
  2079. uniform int alphaFunc,
  2080. uniform int alphaRef ) : COLOR0
  2081. {
  2082. if ( 1 == mirrored ) clip(vertex.depth);
  2083.  
  2084. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2085.  
  2086. float dotLightNormal = dot(sunDirection,vertex.normal);
  2087. float3 light = ComputeLight( dotLightNormal, ComputeShadow( vertex.shadow, hiDefShadows));
  2088.  
  2089. float alpha = mirrored ? 0.5 : vertex.material.g * albedo.a;
  2090. float3 color = vertex.color.rgb * albedo.rgb * light;
  2091.  
  2092. #ifdef DIRECT3D10
  2093. if( alphaTestEnable )
  2094. AlphaTestD3D10( alpha, alphaFunc, alphaRef );
  2095. #endif
  2096. return float4(color.rgb,alpha);
  2097. }
  2098.  
  2099. /// VertexNormalPS_LowFidelity
  2100. ///
  2101. /// Lighting using vertex normals only.
  2102. float4 VertexNormalPS_LowFidelity(VERTEXNORMAL_VERTEX vertex,
  2103. uniform bool alphaTestEnable,
  2104. uniform int alphaFunc,
  2105. uniform int alphaRef ) : COLOR0
  2106. {
  2107. float4 albedo = tex2D(albedoSampler,vertex.texcoord0.xy);
  2108. float3 light = ComputeLight(dot(sunDirection,vertex.normal),1);
  2109. float3 color = 2 * light.rgb * light.rgb * albedo.rgb;
  2110.  
  2111. float alpha = albedo.a*vertex.material.g;
  2112. #ifdef DIRECT3D10
  2113. if( alphaTestEnable )
  2114. AlphaTestD3D10( alpha, alphaFunc, alphaRef );
  2115. #endif
  2116. return float4(color,alpha);
  2117. }
  2118.  
  2119. ///
  2120. ///
  2121. ///
  2122. float4 ColorMaskPS_LowFidelity(VERTEXNORMAL_VERTEX vertex) : COLOR0
  2123. {
  2124. float4 albedo = tex2D(albedoSampler,vertex.texcoord0.xy);
  2125. float4 specular = tex2D(specularSampler,vertex.texcoord0.xy);
  2126. albedo.rgb = lerp(vertex.color.rgb,albedo.rgb,1 - saturate(specular.a));
  2127. float3 light = ComputeLight(dot(sunDirection,vertex.normal),1);
  2128. float3 color = 2 * light.rgb * light.rgb * albedo.rgb;
  2129. return float4(color.rgb,vertex.material.g);
  2130. }
  2131.  
  2132. /// ClutterPS
  2133. ///
  2134. /// Lighting using vertex normals only with dissolve.
  2135. float4 ClutterPS( CLUTTER_VERTEX vertex,
  2136. uniform bool alphaTestEnable,
  2137. uniform int alphaFunc,
  2138. uniform int alphaRef ) : COLOR0
  2139. {
  2140. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2141.  
  2142. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2143. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2144. float dissolve = saturate( vertex.dissolve * ( 0.5 * tex2D( dissolveSampler, vertex.texcoord0).a + 0.5));
  2145.  
  2146. float dotLightNormal = dot(sunDirection,normal);
  2147. float3 light = ComputeLight( dotLightNormal, 1.0);
  2148.  
  2149. float alpha = dissolve * albedo.a;
  2150. #ifdef DIRECT3D10
  2151. if( alphaTestEnable )
  2152. AlphaTestD3D10( alpha, alphaFunc, alphaRef );
  2153. #endif
  2154. return float4( albedo.rgb * light, alpha);
  2155. }
  2156.  
  2157. /// NormalMappedPS
  2158. ///
  2159. /// Lighting using normal maps.
  2160. float4 NormalMappedPS( NORMALMAPPED_VERTEX vertex,
  2161. uniform bool maskAlbedo,
  2162. uniform bool glow,
  2163. uniform bool hiDefShadows,
  2164. uniform bool alphaTestEnable,
  2165. uniform int alphaFunc,
  2166. uniform int alphaRef ) : COLOR0
  2167. {
  2168. if ( 1 == mirrored ) clip(vertex.depth.x);
  2169.  
  2170. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2171. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2172. float dotLightNormal = dot(sunDirection,normal);
  2173.  
  2174. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2175. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  2176. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2177.  
  2178. if ( maskAlbedo )
  2179. albedo.rgb = lerp( vertex.color.rgb, albedo.rgb, 1 - specular.a );
  2180. else
  2181. albedo.rgb = albedo.rgb * vertex.color.rgb;
  2182.  
  2183. float phongAmount = saturate( dot( reflect( sunDirection, normal), -vertex.viewDirection));
  2184. float3 phongAdditive = NormalMappedPhongCoeff * pow( phongAmount, 2) * specular.g;
  2185. float3 phongMultiplicative = float3( 2 * environment * specular.r);
  2186.  
  2187. float3 light = ComputeLight( dotLightNormal, ComputeShadow( vertex.shadow, hiDefShadows));
  2188.  
  2189. float emissive = glowMultiplier * specular.b;
  2190. float3 color = albedo.rgb * ( emissive.r + light + phongMultiplicative) + phongAdditive;
  2191.  
  2192. float alpha = mirrored ? 0.5 : ( glow ? ( specular.b + glowMinimum ) : ( vertex.material.g * albedo.a ));
  2193.  
  2194. #ifdef DIRECT3D10
  2195. if( alphaTestEnable )
  2196. AlphaTestD3D10( alpha, alphaFunc, alphaRef );
  2197. #endif
  2198. return float4( color.rgb, alpha );
  2199. }
  2200.  
  2201. /// MapImagerPS0
  2202. ///
  2203. ///
  2204. float4 MapImagerPS0( NORMALMAPPED_VERTEX vertex) : COLOR0
  2205. {
  2206. float3x3 rotationMatrix = float3x3(vertex.binormal,vertex.tangent,vertex.normal);
  2207. float3 normal = ComputeNormal(normalsSampler,vertex.texcoord0.zw,rotationMatrix);
  2208.  
  2209. float4 albedo = tex2D(albedoSampler,vertex.texcoord0.xy);
  2210. float mask = tex2D(specularSampler,vertex.texcoord0.xy).b;
  2211. float shade = lerp(saturate(dot(sunDirection,normal)),1,mask);
  2212. albedo.rgb = float3(1,1,1) * shade * (albedo.rgb + albedo.aaa) + float3(0.02,0.02,0.02);
  2213.  
  2214. return float4(albedo.rgb,0);
  2215. }
  2216.  
  2217. /// MapImagerPS1
  2218. ///
  2219. ///
  2220. float4 MapImagerPS1( NORMALMAPPED_VERTEX vertex) : COLOR0
  2221. {
  2222. float4 specular = tex2D(specularSampler,vertex.texcoord0.xy);
  2223. return float4(0,0,0,specular.b+glowMinimum);
  2224. }
  2225.  
  2226. /// AlbedoPreviewPS
  2227. ///
  2228. /// Used by the unit viewer to preview the albedo map.
  2229. float4 AlbedoPreviewPS( NORMALMAPPED_VERTEX vertex) : COLOR0
  2230. {
  2231. return tex2D( albedoSampler, vertex.texcoord0.xy);
  2232. }
  2233.  
  2234. /// NormalsPreviewPS
  2235. ///
  2236. /// Used by the unit viewer to preview the normal map.
  2237. float4 NormalsPreviewPS( NORMALMAPPED_VERTEX vertex) : COLOR0
  2238. {
  2239. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2240. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2241. return float4( normal, 1);
  2242. }
  2243.  
  2244. /// LightingPreviewPS
  2245. ///
  2246. /// Used by the unit viewer to preview a unit's lighting.
  2247. float4 LightingPreviewPS( NORMALMAPPED_VERTEX vertex) : COLOR0
  2248. {
  2249. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2250. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2251. float dotLightNormal = dot(sunDirection,normal);
  2252. return float4( dotLightNormal.xxx, 1);
  2253. }
  2254.  
  2255. /// BlackenedNormalMappedPS
  2256. ///
  2257. float4 BlackenedNormalMappedPS( NORMALMAPPED_VERTEX vertex,
  2258. uniform bool maskAlbedo,
  2259. uniform bool glow,
  2260. uniform bool hiDefShadows,
  2261. uniform bool alphaTestEnable,
  2262. uniform int alphaFunc,
  2263. uniform int alphaRef ) : COLOR0
  2264. {
  2265. if ( 1 == mirrored ) clip(vertex.depth.x);
  2266.  
  2267. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2268. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2269. float dotLightNormal = dot(sunDirection,normal);
  2270.  
  2271. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2272.  
  2273. // blacken the albedo
  2274. albedo.rgb = dot(albedo.rgb, float3(.1,.1,.1));
  2275.  
  2276. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  2277. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2278.  
  2279. if ( maskAlbedo )
  2280. albedo.rgb = lerp( vertex.color.rgb, albedo.rgb, 1 - specular.a );
  2281. else
  2282. albedo.rgb = albedo.rgb * vertex.color.rgb;
  2283.  
  2284. float phongAmount = saturate( dot( reflect( sunDirection, normal), -vertex.viewDirection));
  2285. float3 phongAdditive = pow( phongAmount, 8) * specular.g;
  2286. float3 phongMultiplicative = float3( 2 * environment * specular.r);
  2287.  
  2288. float3 light = ComputeLight( dotLightNormal, ComputeShadow( vertex.shadow, hiDefShadows));
  2289.  
  2290. float emissive = glowMultiplier * specular.b;
  2291. float3 color = albedo.rgb * ( emissive.r + light + phongMultiplicative) + phongAdditive;
  2292.  
  2293. float alpha = mirrored ? 0.5 : ( glow ? ( specular.b + glowMinimum ) : ( vertex.material.g * albedo.a ));
  2294.  
  2295. #ifdef DIRECT3D10
  2296. if( alphaTestEnable )
  2297. AlphaTestD3D10( alpha, alphaFunc, alphaRef );
  2298. #endif
  2299. return float4( color, alpha);
  2300. }
  2301.  
  2302. float4 BlackenedLoFiPS( VERTEXNORMAL_VERTEX vertex,
  2303. uniform bool alphaTestEnable,
  2304. uniform int alphaFunc,
  2305. uniform int alphaRef ) : COLOR0
  2306. {
  2307. float4 color = tex2D( albedoSampler, vertex.texcoord0.xy);
  2308. color.rgb = dot(color.rgb, float3(.1,.1,.1));
  2309. float3 light = ComputeLight( dot(sunDirection,vertex.normal), 1);
  2310.  
  2311. color.rgb *= light;
  2312. color.a = vertex.material.g * color.a;
  2313.  
  2314. #ifdef DIRECT3D10
  2315. if( alphaTestEnable )
  2316. AlphaTestD3D10( color.a, alphaFunc, alphaRef );
  2317. #endif
  2318. return color;
  2319. }
  2320.  
  2321. /// WreckagePS
  2322. ///
  2323. /// Wreckage that applies noise over the albedo and normal maps
  2324. float4 WreckagePS( NORMALMAPPED_VERTEX vertex) : COLOR0
  2325. {
  2326. if ( 1 == mirrored ) clip(vertex.depth.x);
  2327.  
  2328. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2329. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2330. float dotLightNormal = dot(sunDirection,normal);
  2331.  
  2332. float2 texcoord = vertex.texcoord0.xy;
  2333. float4 albedo = tex2D( albedoSampler, texcoord);
  2334. texcoord.y -= frac( 0.01 * vertex.depth.y );
  2335. texcoord.x += frac( 0.01 * vertex.depth.y );
  2336. float4 specular = tex2D( specularSampler, texcoord * 5.15);
  2337.  
  2338. /// Wreckage should not receive shadows (the "random" crunchiness makes for bad artifacts.)
  2339. float3 color = albedo * ComputeLight( dotLightNormal, 1);
  2340.  
  2341. if( specular.g < 0.22 )
  2342. color *= (albedo + specular.r + specular.a) * specular.b * 2.5;
  2343. else
  2344. color *= specular.b * 2;
  2345.  
  2346. return float4( color, glowMinimum );
  2347. }
  2348.  
  2349. float4 WreckagePS_LowFidelity(VERTEXNORMAL_VERTEX vertex) : COLOR0
  2350. {
  2351. float4 albedo = tex2D(albedoSampler,vertex.texcoord0.xy);
  2352. float4 specular = tex2D(specularSampler,vertex.texcoord0.xy * 10 );
  2353. float3 color = albedo.rgb * ComputeLight(dot(sunDirection,vertex.normal),1);
  2354. color *= (albedo + specular.r + specular.a) * specular.b * 5.5;
  2355. return float4(color.rgb,vertex.material.g);
  2356. }
  2357.  
  2358. /// NormalMappedTerrainPS
  2359. ///
  2360. ///
  2361. float4 NormalMappedTerrainPS( NORMALMAPPED_VERTEX vertex ) : COLOR
  2362. {
  2363. if ( 1 == mirrored ) clip( vertex.depth.x);
  2364.  
  2365. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2366. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2367. float dotLightNormal = dot(sunDirection,normal);
  2368.  
  2369. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2370. albedo.rgb = albedo.rgb * vertex.color.rgb;
  2371. float3 light = ComputeLight( dotLightNormal, 1);
  2372. float alpha = mirrored ? 0.5 : glowMinimum;
  2373.  
  2374. float3 color = light * albedo.rgb;
  2375.  
  2376. return float4(color,alpha);
  2377. }
  2378.  
  2379. /// AlphaFadePS
  2380. ///
  2381. ///
  2382. float4 AlphaFadePS( VERTEXNORMAL_VERTEX vertex,
  2383. uniform float timeFade,
  2384. uniform float fadeMultiplier,
  2385. uniform bool hiDefShadows,
  2386. uniform bool alphaTestEnable,
  2387. uniform int alphaFunc,
  2388. uniform int alphaRef ) : COLOR0
  2389. {
  2390. float4 color = tex2D( albedoSampler, vertex.texcoord0.xy);
  2391.  
  2392. float dotLightNormal = dot(sunDirection,vertex.normal);
  2393. float3 light = ComputeLight( dotLightNormal, ComputeShadow( vertex.shadow, hiDefShadows));
  2394.  
  2395. color = float4( color.rgb * light, color.a * vertex.material.y );
  2396. color.a *= saturate( 1.0f - ( vertex.material.x - timeFade) * fadeMultiplier);
  2397.  
  2398. #ifdef DIRECT3D10
  2399. if( alphaTestEnable )
  2400. AlphaTestD3D10( color.a, alphaFunc, alphaRef );
  2401. #endif
  2402. return color;
  2403. }
  2404.  
  2405. float4 AlphaFadeLoFiPS( VERTEXNORMAL_VERTEX vertex,
  2406. uniform float timeFade,
  2407. uniform float fadeMultiplier,
  2408. uniform bool alphaTestEnable,
  2409. uniform int alphaFunc,
  2410. uniform int alphaRef ) : COLOR0
  2411. {
  2412. float4 color = tex2D( albedoSampler, vertex.texcoord0.xy);
  2413. float3 light = ComputeLight( dot(sunDirection,vertex.normal), 1);
  2414.  
  2415. color = float4( color.rgb * light, color.a * vertex.material.y );
  2416. color.a *= saturate( 1.0f - ( vertex.material.x - timeFade) * fadeMultiplier);
  2417.  
  2418. #ifdef DIRECT3D10
  2419. if( alphaTestEnable )
  2420. AlphaTestD3D10( color.a, alphaFunc, alphaRef );
  2421. #endif
  2422. return color;
  2423. }
  2424.  
  2425. float4 CommandFeedbackPS0( VERTEXNORMAL_VERTEX vertex, uniform bool fade ) : COLOR0
  2426. {
  2427. float4 color = tex2D( albedoSampler, vertex.texcoord0.xy);
  2428. return float4(color.rgb, fade ? saturate(color.a * vertex.material.x) : color.a );
  2429. }
  2430.  
  2431. float4 CommandFeedbackPS1( VERTEXNORMAL_VERTEX vertex, uniform float glow) : COLOR0
  2432. {
  2433. return float4(0,0,0,glow);
  2434. }
  2435.  
  2436. /// AlphaFadeTexShiftScalePS
  2437. ///
  2438. ///
  2439. float4 AlphaFadeTexShiftScalePS( EFFECT_VERTEX vertex, uniform float texScale, uniform float timeCoeff, uniform float timeFade, uniform float fadeMultiplier ) : COLOR
  2440. {
  2441. float2 texcoord = texScale * vertex.texcoord0;
  2442. texcoord.y += vertex.material.x * timeCoeff;
  2443.  
  2444. float4 color = tex2D( albedoSampler, texcoord);
  2445. color.a *= tex2D( normalsSampler, vertex.texcoord0).g;//specularSampler
  2446. color.a *= saturate( 1.0f - ( vertex.material.x - timeFade) * fadeMultiplier);
  2447.  
  2448. return color;
  2449. }
  2450.  
  2451. /// NukeHeadPS
  2452. ///
  2453. ///
  2454. float4 NukeHeadPS( EFFECT_VERTEX vertex,
  2455. uniform float texScale,
  2456. uniform float timeCoeff,
  2457. uniform float timeFade,
  2458. uniform float fadeMultiplier,
  2459. uniform bool alphaTestEnable,
  2460. uniform int alphaFunc,
  2461. uniform int alphaRef ) : COLOR
  2462. {
  2463. float2 texcoord = vertex.texcoord0;
  2464. float cTime = vertex.material.x;
  2465. //texcoord.y += vertex.material.x * timeCoeff * 0.25;
  2466.  
  2467. float2 texcoord2 = 6 * vertex.texcoord0;
  2468. texcoord2.y += cTime * timeCoeff * 1.25;
  2469.  
  2470. float2 texcoord3 = 4 * vertex.texcoord0;
  2471. texcoord3.y += cTime * timeCoeff * 1.25;
  2472.  
  2473. float2 texcoord4 = 0.25 * vertex.texcoord0;
  2474. texcoord4.y += cTime * timeCoeff * 0.1;
  2475.  
  2476. float4 color = tex2D( albedoSampler, texcoord);
  2477. float4 color2 = tex2D( normalsSampler, texcoord2);
  2478. float4 color3 = tex2D( normalsSampler, texcoord3);
  2479. float4 color4 = tex2D( normalsSampler, texcoord4);
  2480. float4 outColor = color;
  2481. outColor.rgb = (color3.g + color2.b) * 0.5;
  2482. outColor.rgb = (outColor.r + color4.b) * 0.5;
  2483. outColor.rgb += (color4.r * 0.5);
  2484. outColor.rgb = lerp( outColor, color, 0.5);
  2485. outColor.rgb += (color2.b * 0.3);
  2486. outColor.rgb *= color3.g;
  2487. outColor.rgb += color2.b;
  2488. //color.rgb += lerp( color.rgb, color3.r, 0.5 );
  2489. //color.rgb += color2.b;// - color3.r) * color3.a) + (color2.a * 0.2);
  2490. outColor.a *= saturate( 1.0f - ( cTime - timeFade) * fadeMultiplier);
  2491.  
  2492. float fade = cTime - 20;
  2493. // Dissolve textue based on current alpha value and the noise in NormalSampler texture
  2494. if( fade >= 0 )
  2495. {
  2496. if( (color2.a * color3.b * color2.g) >= color.a )
  2497. outColor.a = 0;
  2498. }
  2499.  
  2500. outColor.a *= color2.g;
  2501.  
  2502. #ifdef DIRECT3D10
  2503. if( alphaTestEnable )
  2504. AlphaTestD3D10( outColor.a, alphaFunc, alphaRef );
  2505. #endif
  2506. return outColor;
  2507. }
  2508.  
  2509. /// UnitPlacePS
  2510. ///
  2511. ///
  2512. float4 UnitPlacePS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  2513. {
  2514. float4 color = vertex.color ;
  2515. float dotLightNormal = dot(sunDirection,vertex.normal);
  2516. float3 light = ComputeLight( dotLightNormal, 1);
  2517. color = float4( color.rgb * light, 0.2 );
  2518. return color;
  2519. }
  2520.  
  2521. /// NormalMappedMetalPS
  2522. ///
  2523. ///
  2524. float4 NormalMappedMetalPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2525. {
  2526. if ( 1 == mirrored ) clip(vertex.depth.x);
  2527.  
  2528. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2529. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2530. float dotLightNormal = dot(sunDirection,normal);
  2531.  
  2532. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2533. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  2534. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2535.  
  2536. float2 anisoLookup = float2( dot( reflect( sunDirection, normal), -vertex.viewDirection), dotLightNormal);
  2537. float4 anisoAmount = tex2D( anisotropicSampler, anisoLookup);
  2538.  
  2539. albedo.rgb = lerp( vertex.color.rgb, albedo.rgb, 1 - specular.a );
  2540.  
  2541. float4 phongAdditive = anisoAmount * specular.g + float4( 0.5 * specular.r * environment, 0);
  2542.  
  2543. float shadow = ComputeShadow( vertex.shadow, hiDefShadows);
  2544. float3 light = ComputeLight( dotLightNormal, shadow);
  2545.  
  2546. float emissive = glowMultiplier * specular.b;
  2547. float3 color = albedo.rgb * ( emissive.r + light ) + phongAdditive.rgb;
  2548.  
  2549. float alpha = mirrored ? 0.5 : specular.b + glowMinimum;
  2550.  
  2551. return float4( color, alpha );
  2552. }
  2553.  
  2554. /// AeonPS
  2555. ///
  2556. ///
  2557. float4 AeonPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2558. {
  2559. if ( 1 == mirrored ) clip(vertex.depth.x);
  2560.  
  2561. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2562. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2563. float dotLightNormal = dot(sunDirection,normal);
  2564.  
  2565. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2566. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  2567. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2568.  
  2569. albedo.rgb = lerp( vertex.color.rgb, albedo.rgb, 1 - specular.a );
  2570.  
  2571. float3 reflection = reflect( sunDirection, normal);
  2572. float phongAmount = saturate( dot( reflection, -vertex.viewDirection));
  2573.  
  2574. float3 phongAdditive = AeonPhongCoeff * pow( phongAmount, 3) * specular.g;
  2575. float3 phongMultiplicative = specular.r * environment;
  2576.  
  2577. float shadow = ComputeShadow( vertex.shadow, hiDefShadows);
  2578. float3 light = sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
  2579. light = 0.6 * lightMultiplier * light + ( 1 - light ) * shadowFill;
  2580.  
  2581. float emissive = glowMultiplier * specular.b;
  2582. float3 color = albedo.rgb * ( emissive.r + light + phongMultiplicative ) + phongAdditive.rgb;
  2583.  
  2584. float alpha = mirrored ? 0.5 : specular.b + glowMinimum;
  2585.  
  2586. return float4( color, alpha );
  2587. }
  2588.  
  2589. /// AeonCZARPS
  2590. ///
  2591. ///
  2592. float4 AeonCZARPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2593. {
  2594. if ( 1 == mirrored ) clip(vertex.depth.x);
  2595.  
  2596. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2597. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2598. float dotLightNormal = dot(sunDirection,normal);
  2599.  
  2600. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2601. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  2602. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2603.  
  2604. albedo.rgb = lerp( vertex.color.rgb, albedo.rgb, 1 - specular.a );
  2605.  
  2606. float3 reflection = reflect( sunDirection, normal);
  2607. float phongAmount = saturate( dot( reflection, -vertex.viewDirection));
  2608.  
  2609. float3 phongAdditive = pow( phongAmount, 8) * specular.g;
  2610. float3 phongMultiplicative = specular.r * environment;
  2611.  
  2612. float shadow = ComputeShadow( vertex.shadow, hiDefShadows);
  2613. float3 light = sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
  2614. light = 0.6 * lightMultiplier * light + ( 1 - light ) * shadowFill;
  2615.  
  2616. float emissive = glowMultiplier * specular.b;
  2617. float3 color = albedo.rgb * ( emissive.r + light + phongMultiplicative ) + phongAdditive.rgb;
  2618.  
  2619. float2 texcoord = vertex.texcoord0.xy * 60;
  2620. texcoord.x -= vertex.material.x * 0.16;
  2621. texcoord.y -= vertex.material.x * 0.01;
  2622. float2 texcoord2 = vertex.texcoord0.xy * 30;
  2623. texcoord2.x += vertex.material.x * 0.08;
  2624. texcoord2.y -= vertex.material.x * 0.005;
  2625. float3 secondary = tex2D( secondarySampler, texcoord );
  2626. float3 secondary2 = tex2D( secondarySampler, texcoord2 );
  2627. color += float3(0.2,0.7,1) * (secondary.b + secondary2.g )* (1-albedo.a);
  2628.  
  2629. float alpha = mirrored ? 0.5 : specular.b + ((secondary.b + secondary2.g )* (1-albedo.a))+ glowMinimum;
  2630. return float4( color, alpha );
  2631. }
  2632.  
  2633. /// UnitFalloffPS
  2634. ///
  2635. /// - Similar to unit shader, with the exception that it uses the diffuse texture alpha
  2636. /// channel to mask area's in which the view dependant lookup texture is sampled.
  2637. /// Only works in Medium and High fidelity.
  2638. ///
  2639. float4 UnitFalloffPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2640. {
  2641. if ( 1 == mirrored ) clip(vertex.depth.x);
  2642.  
  2643. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2644. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2645. float dotLightNormal = dot(sunDirection,normal);
  2646.  
  2647. float4 diffuse = tex2D( albedoSampler, vertex.texcoord0.xy);
  2648. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  2649. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2650.  
  2651. // Calculate lookup into falloff ramp
  2652. float NdotV = pow(1 - saturate(dot( normalize(vertex.viewDirection), normal )), 0.6);
  2653. float4 fallOff = tex2D( falloffSampler, float2(NdotV,vertex.material.x));
  2654.  
  2655. // Calculate specular highlights based on current sun direction
  2656. float3 reflection = reflect( sunDirection, normal);
  2657. float specularAmount = saturate( dot( reflection, -vertex.viewDirection));
  2658. float3 phongAdditive = float3 (0.5,0.6,0.7) * pow( specularAmount, 9) * specular.g;
  2659.  
  2660. // Calculate environment map reflection
  2661. environment *= specular.r * fallOff.a;
  2662.  
  2663. // Calculate lighting and shadows
  2664. float shadow = 0; // ComputeShadow( vertex.shadow, hiDefShadows);
  2665.  
  2666. float3 light = sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
  2667. light = light + ( 1 - light ) * shadowFill;
  2668.  
  2669. // Determine our final output color
  2670. float3 color = diffuse.rgb * light;
  2671. color += environment + phongAdditive;
  2672. color += (fallOff.rgb * diffuse.a);
  2673.  
  2674. float alpha = mirrored ? 0.5 : specular.b + glowMinimum;
  2675. return float4( color, alpha );
  2676. }
  2677.  
  2678. float4 LowFiUnitFalloffPS( NORMALMAPPED_VERTEX vertex) : COLOR0
  2679. {
  2680. if ( 1 == mirrored ) clip(vertex.depth.x);
  2681.  
  2682. float4 diffuse = tex2D(albedoSampler,vertex.texcoord0.xy);
  2683. float4 specular = tex2D(specularSampler,vertex.texcoord0.xy);
  2684.  
  2685. diffuse.rgb = specular.ggg * specular.rrr * ( 1 - diffuse.rgb );
  2686. diffuse.rgb = lerp(vertex.color,diffuse.rgb,specular.g);
  2687.  
  2688. float3 normal = normalize(vertex.normal);
  2689.  
  2690. float3 reflected = reflect(-normalize(vertex.viewDirection),normal);
  2691. float highlight = pow(saturate(dot(reflected,sunDirection)),5);
  2692.  
  2693. float dotLightNormal = dot(sunDirection,normal);
  2694. float3 light = ComputeLight(dotLightNormal,sunDirection);
  2695. float3 color = diffuse.rgb * light + highlight.rrr;
  2696.  
  2697. return float4(color.rgb,0);
  2698. }
  2699.  
  2700. /// AeonBuildPS
  2701. ///
  2702. ///
  2703. float4 AeonBuildPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2704. {
  2705. if ( 1 == mirrored ) clip(vertex.depth.x);
  2706. float percentComplete = vertex.material.y;
  2707.  
  2708. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2709. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2710. float dotLightNormal = dot(sunDirection,normal);
  2711.  
  2712. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2713. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  2714. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2715.  
  2716. // Fade in team color at 90% complete
  2717. float3 teamColor = vertex.color.rgb;
  2718. teamColor *= (percentComplete >= 0.90) ? (percentComplete - 0.9) * 10 : 0.0;
  2719. albedo.rgb = lerp( teamColor, albedo.rgb, 1 - specular.a );
  2720.  
  2721. float3 reflection = reflect( sunDirection, normal);
  2722. float phongAmount = saturate( dot( reflection, -vertex.viewDirection));
  2723. float3 phongAdditive = pow( phongAmount, 8) * specular.g;
  2724. float3 phongMultiplicative = specular.r * environment;
  2725.  
  2726. float shadow = ComputeShadow( vertex.shadow, hiDefShadows);
  2727. float3 light = sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
  2728. light = 0.6 * lightMultiplier * light + ( 1 - light ) * shadowFill;
  2729. float emissive = glowMultiplier * specular.b;
  2730.  
  2731. float3 color = albedo.rgb * ( emissive.r + light + phongMultiplicative ) + phongAdditive.rgb;
  2732.  
  2733. float alpha = mirrored ? 0.5 : specular.b + glowMinimum;
  2734.  
  2735. return float4( color, alpha);
  2736. }
  2737.  
  2738. float4 AeonBuildOverlayPS( NORMALMAPPED_VERTEX vertex) : COLOR0
  2739. {
  2740. // Diffuse texture
  2741. float4 texcoord = vertex.texcoord0;
  2742. texcoord.y += vertex.material.x * 0.00162;
  2743. texcoord.x -= vertex.material.x * 0.001;
  2744. float4 mask1 = tex2D( secondarySampler, texcoord * 2);
  2745.  
  2746. float4 texcoord2 = vertex.texcoord0;
  2747. texcoord2.y -= vertex.material.x * 0.00162;
  2748. float4 mask2 = tex2D( secondarySampler, texcoord2 * 2);
  2749.  
  2750. float3 diffuse = mask1.rrr - mask2.ggg + mask1.ggg * mask2.rrr;
  2751. diffuse = lerp( diffuse, float3(0.5,0.5,0.5), 0.75);
  2752.  
  2753. // Custom normal mapping
  2754. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal );
  2755. float3 normal = tex2D( normalsSampler, vertex.texcoord0.zw ).gaa;
  2756. normal = lerp( normal, tex2D( secondarySampler, vertex.texcoord0 * 7 ).baa, 0.5);
  2757. normal = lerp( normal, diffuse, 0.5);
  2758. normal = 2 * normal - 1;
  2759. normal.z = sqrt( 1 - normal.x*normal.x - normal.y*normal.y );
  2760. normal = normalize( mul( normal, rotationMatrix));
  2761.  
  2762. // Specular highlights
  2763. float4 dotLightNormal = saturate(dot(sunDirection,normal));
  2764. float3 reflection = normalize( 2 * dotLightNormal * normal - normalize(sunDirection));
  2765. float4 specular = pow( saturate( dot(reflection, vertex.viewDirection )), 8);
  2766.  
  2767. float3 color = diffuse * dotLightNormal + specular;
  2768.  
  2769. // Fade out 95% complete
  2770. float percentComplete = vertex.material.y;
  2771. float alpha = (percentComplete >= 0.95) ? (1.0 - ((percentComplete - 0.95) * 20)) * (color.r * 2) : color.r * 2;
  2772.  
  2773. return float4( color, alpha );
  2774. }
  2775.  
  2776. /// AeonBuildPuddlePS
  2777. ///
  2778. ///
  2779. float4 AeonBuildPuddlePS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2780. {
  2781. if ( 1 == mirrored ) clip(vertex.depth.x);
  2782.  
  2783. float2 texcoord = vertex.texcoord0.xy;
  2784. texcoord.x -= vertex.material.x * 0.002;
  2785. texcoord.y += vertex.material.x * 0.0042;
  2786.  
  2787. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2788. float3 normal = ComputeNormal( normalsSampler, texcoord, rotationMatrix);
  2789. float dotLightNormal = dot(sunDirection,normal);
  2790.  
  2791. float4 albedo = tex2D( albedoSampler, texcoord );
  2792.  
  2793. float4 specular = tex2D( specularSampler, texcoord );
  2794. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2795.  
  2796. float3 reflection = reflect( sunDirection, normal);
  2797. float phongAmount = saturate( dot( reflection, -vertex.viewDirection));
  2798.  
  2799. float3 phongAdditive = pow( phongAmount, 8) * specular.g;
  2800. float3 phongMultiplicative = specular.r * environment;
  2801.  
  2802. float shadow = ComputeShadow( vertex.shadow, hiDefShadows);
  2803. float3 light = sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
  2804. light = 0.6 * lightMultiplier * light + ( 1 - light ) * shadowFill;
  2805.  
  2806. float emissive = glowMultiplier * specular.b;
  2807. float3 color = albedo.rgb * ( emissive.r + light + phongMultiplicative ) + phongAdditive.rgb;
  2808.  
  2809. float alpha = mirrored ? 0.5 : specular.b + glowMinimum;
  2810.  
  2811. return float4( color, alpha );
  2812. }
  2813.  
  2814. float4 AeonBuildPuddleLoFiPS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  2815. {
  2816. if ( 1 == mirrored ) clip(vertex.depth.x);
  2817.  
  2818. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy );
  2819. //return albedo;
  2820. float3 environment = texCUBE( environmentSampler, reflect( -sunDirection, vertex.normal) );
  2821. return float4( albedo.rgb + (environment * 0.15), 1);
  2822. }
  2823.  
  2824. /// CybranBuildPS
  2825. ///
  2826. ///
  2827. float4 CybranBuildPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2828. {
  2829. if ( 1 == mirrored ) clip(vertex.depth);
  2830. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2831.  
  2832. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  2833. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2834. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  2835. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2836.  
  2837. float dotLightNormal = dot(sunDirection,normal);
  2838. float2 anisoLookup = float2( dot( reflect( sunDirection, normal), -vertex.viewDirection), dotLightNormal);
  2839. float4 anisoAmount = tex2D( insectSampler, anisoLookup);
  2840. float4 phongAdditive = anisoAmount * specular.g + float4( 0.5 * specular.r * environment, 0);
  2841. phongAdditive *= ( 1 - specular.a);
  2842.  
  2843. float shadow = ComputeShadow( vertex.shadow, hiDefShadows);
  2844. float3 light = 2 * sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
  2845. light = lightMultiplier * light + ( 1 - light ) * shadowFill;
  2846.  
  2847. float emissive = glowMultiplier * specular.b;
  2848. float3 teamColor = vertex.color.rgb;
  2849. teamColor *= (vertex.material.y >= 0.90) ? (vertex.material.y - 0.9) * 10 : 0.0;
  2850. albedo.rgb = lerp( teamColor, albedo.rgb, 1 - specular.a );
  2851.  
  2852. float3 color = albedo.rgb * ( emissive.r + light ) + phongAdditive.rgb;
  2853.  
  2854. // Adjust the transparency of the unit so that it is 40% visible, until the unit is 70% complete
  2855. float alpha = (vertex.material.y >= 0.7) ? 0.4 + (0.6 * ((vertex.material.y - 0.7) * 3.33)) : 0.4;
  2856.  
  2857. return float4( color, alpha );
  2858. }
  2859.  
  2860. float4 CybranBuildLoFiPS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  2861. {
  2862. float4 albedo = tex2D(albedoSampler,vertex.texcoord0.xy);
  2863. float4 specular = tex2D(specularSampler,vertex.texcoord0.xy);
  2864. albedo.rgb = lerp( vertex.color.rgb * vertex.material.y * 0.5,albedo.rgb,1 - saturate(specular.a));
  2865. float3 light = ComputeLight(dot(sunDirection,vertex.normal),1);
  2866. float alpha = (vertex.material.y >= 0.7) ? 0.4 + (0.6 * ((vertex.material.y - 0.7) * 3.33)) : 0.4;
  2867. return float4( 2 * light.rgb * light.rgb * albedo.rgb, alpha);
  2868. }
  2869.  
  2870. /// CybranBuildOverlayPS
  2871. ///
  2872. ///
  2873. float4 CybranBuildOverlayPS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  2874. {
  2875. float4 secondary = tex2D(secondarySampler, vertex.texcoord0.xy );
  2876. float4 alphamask1 = tex2D(secondarySampler, vertex.shadow.xy );
  2877. float4 color = float4( secondary.a * 0.75, 0, 0, alphamask1.r * secondary.a );
  2878. color.a *= (vertex.material.y >= 0.95) ? 1.0 - ((vertex.material.y - 0.95) * 20) : 1.0;
  2879. return color;
  2880. }
  2881.  
  2882. /// SeraphimBuildPS
  2883. ///
  2884. ///
  2885. float4 SeraphimBuildPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2886. {
  2887. if ( 1 == mirrored ) clip(vertex.depth.x);
  2888.  
  2889. float4 texcoord = vertex.texcoord0;
  2890. texcoord.y += vertex.material.x * 0.005;
  2891. float buildFractionMul = (vertex.material.y - 0.9) * 10;
  2892.  
  2893. float4 uvaddress = tex2D( secondarySampler, texcoord * 0.5 ) * 0.03;
  2894. float2 texcoord2 = vertex.texcoord0.xy + lerp( uvaddress.rb, 0, buildFractionMul );
  2895.  
  2896. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2897. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw + lerp( uvaddress.rb, 0, buildFractionMul ), rotationMatrix);
  2898. float dotLightNormal = dot(sunDirection,normal);
  2899.  
  2900. // Calculate lookup into falloff ramp
  2901. float NdotV = pow(1 - saturate(dot( normalize(vertex.viewDirection), normal )), 0.6);
  2902. float4 fallOff = tex2D( falloffSampler, float2(NdotV,vertex.depth.y));
  2903.  
  2904. float4 diffuse = tex2D( albedoSampler, texcoord2);
  2905. float4 specular = tex2D( specularSampler, texcoord2);
  2906. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal)) * specular.r * fallOff.a;
  2907.  
  2908. // Determine our final output color
  2909. float3 color = diffuse.rgb * ( sunAmbient + ( 1 - sunAmbient ) * shadowFill) ;
  2910. color += environment + (fallOff.rgb * diffuse.a);
  2911.  
  2912. return float4( color, max(vertex.material.y, 0.25) );
  2913. }
  2914.  
  2915. /// UEFBuildPS
  2916. ///
  2917. ///
  2918. float4 UEFBuildHiFiPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  2919. {
  2920. if ( 1 == mirrored ) clip(vertex.depth);
  2921.  
  2922. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  2923.  
  2924. float4 texcoord = vertex.texcoord0;
  2925. float4 texcoord2 = texcoord * 5;
  2926. texcoord2.y += vertex.material.x * 0.062;
  2927.  
  2928. float4 albedo = tex2D( albedoSampler, texcoord.xy);
  2929. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  2930. float4 specular = tex2D( specularSampler, texcoord.xy);
  2931. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  2932. float4 secondary = tex2D( secondarySampler, texcoord2.xy * 10);
  2933.  
  2934. float3 teamColor = vertex.color.rgb;
  2935. teamColor *= (vertex.material.y >= 0.90) ? (vertex.material.y - 0.9) * 10 : 0.0;
  2936. albedo.rgb = lerp( teamColor, albedo.rgb, 1 - specular.a );
  2937. float phongAmount = saturate( dot( reflect( sunDirection, normal), -vertex.viewDirection));
  2938. float3 phongAdditive = pow( phongAmount, 8) * specular.g;
  2939. float3 phongMultiplicative = float3( 2 * environment * specular.r);
  2940.  
  2941. float3 light = ComputeLight( dot(sunDirection,normal), ComputeShadow( vertex.shadow, hiDefShadows));
  2942.  
  2943. float emissive = glowMultiplier * specular.b;
  2944. float3 color = albedo.rgb * ( emissive.r + light + phongMultiplicative) + phongAdditive;
  2945.  
  2946. float1 t = min(max(frac( 0.02 * time), 0.35), 0.7);
  2947. float3 current = lerp(color+secondary.rgb,float3(0,0,1),t);
  2948. float3 outColor = lerp( current, color, vertex.material.y);
  2949.  
  2950. return float4( outColor, max(vertex.material.y, 0.5));
  2951. }
  2952.  
  2953. float4 UEFBuildLoFiPS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  2954. {
  2955. float4 albedo = tex2D( albedoSampler, vertex.texcoord0);
  2956. float4 specular = tex2D( specularSampler, vertex.texcoord0);
  2957. albedo.rgb = lerp( vertex.color.rgb * vertex.material.y * 0.25, albedo.rgb, saturate(1 - specular.a) );
  2958. float3 light = ComputeLight( dot(sunDirection,vertex.normal), 1);
  2959. float4 color = ( saturate( 2 * light.rgb * light.rgb * albedo.rgb ) + ((1 - vertex.material.y) * float3( 0, 0, 1 )), max(vertex.material.y, 0.5));
  2960. return color;
  2961. }
  2962.  
  2963. /// UEFBuildOverlayPS
  2964. ///
  2965. ///
  2966. float4 UEFBuildOverlayHiFiPS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  2967. {
  2968. float4 xshift = tex2D( secondarySampler, vertex.texcoord0.xy );
  2969. float4 yshift = tex2D( secondarySampler, vertex.texcoord0.zw );
  2970.  
  2971. // Fade the overlay mask alpha to 0 in the last 5% of building
  2972. float alpha = max((xshift.a + yshift.a) * (1.0 - vertex.material.y), 0.25);
  2973. alpha *= (vertex.material.y >= 0.95) ? 1.0 - ((vertex.material.y - 0.95) * 20) : 1.0;
  2974.  
  2975. return float4(xshift.rgb + yshift.rgb, alpha);
  2976. }
  2977.  
  2978. float4 UEFBuildOverlayLoFiPS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  2979. {
  2980. float4 xshift = tex2D( secondarySampler, vertex.texcoord0.xy );
  2981. float4 yshift = tex2D( secondarySampler, vertex.shadow.xy );
  2982.  
  2983. // Fade the overlay mask alpha to 0 in the last 5% of building
  2984. float alpha = (xshift.a + yshift.a) * saturate(1.0 - vertex.material.y);
  2985. alpha = max(alpha, 0.25);
  2986.  
  2987. return float4(xshift.rgb + yshift.rgb, alpha);
  2988. }
  2989.  
  2990. /// UEFBuildCubePS
  2991. ///
  2992. ///
  2993. float4 UEFBuildCubePS( NORMALMAPPED_VERTEX vertex) : COLOR0
  2994. {
  2995. if ( 1 == mirrored ) clip(vertex.depth);
  2996.  
  2997. float4 texcoord = vertex.texcoord0;
  2998. texcoord.x += vertex.material.x * 0.012;
  2999. texcoord.y += vertex.material.x * 0.062;
  3000. float4 texcoord2 = texcoord;
  3001. texcoord2.y += vertex.material.x * 0.062;
  3002.  
  3003. float4 albedo = tex2D( albedoSampler, texcoord.xy * 0.025);
  3004. float4 secondary = tex2D( secondarySampler, texcoord2.xy * 50);
  3005.  
  3006. float3 color = albedo.rgb;
  3007. float percentComplete = vertex.material.y;
  3008. float3 outColor = color;
  3009.  
  3010. float3 colorMod1 = float3( 0, 0, 1.0 );
  3011. float3 current = lerp( color + secondary, colorMod1, max(frac( 0.05 * time), 0.35));
  3012. outColor = lerp( current, color, percentComplete);
  3013.  
  3014. return float4( outColor, max(percentComplete, 0.5) * albedo.a);
  3015. }
  3016.  
  3017. float4 UEFBuildCubeLoFiPS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  3018. {
  3019. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy );
  3020. float4 secondary = tex2D( secondarySampler, vertex.shadow.xy );
  3021.  
  3022. float3 current = lerp( albedo.rgb + secondary, float3( 0, 0, 1.0 ), 0.65 );
  3023. float3 outColor = lerp( current, albedo.rgb, saturate(vertex.material.y));
  3024.  
  3025. return float4( outColor, max(vertex.material.y, 0.5) * albedo.a);
  3026. }
  3027.  
  3028. /// NormalMappedInsectPS
  3029. ///
  3030. ///
  3031. float4 NormalMappedInsectPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
  3032. {
  3033. if ( 1 == mirrored ) clip(vertex.depth);
  3034.  
  3035. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  3036. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  3037. float dotLightNormal = dot(sunDirection,normal);
  3038.  
  3039. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  3040. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  3041. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  3042.  
  3043. float2 anisoLookup = float2( dot( reflect( sunDirection, normal), -vertex.viewDirection), dotLightNormal);
  3044. float4 anisoAmount = tex2D( insectSampler, anisoLookup);
  3045.  
  3046. albedo.rgb = lerp( vertex.color.rgb, albedo.rgb, 1 - specular.a );
  3047.  
  3048. float4 phongAdditive = anisoAmount * specular.g + float4( 0.5 * specular.r * environment, 0);
  3049. phongAdditive *= ( 1 - specular.a);
  3050.  
  3051. float shadow = ComputeShadow( vertex.shadow, hiDefShadows);
  3052. float3 light = 2 * sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
  3053. light = lightMultiplier * light + ( 1 - light ) * shadowFill;
  3054.  
  3055. float emissive = glowMultiplier * specular.b;
  3056. float3 color = albedo.rgb * ( emissive.r + light ) + phongAdditive.rgb;
  3057.  
  3058. float alpha = mirrored ? 0.5 : specular.b + glowMinimum;
  3059.  
  3060. return float4( color, alpha);
  3061. }
  3062.  
  3063. /// ShieldPS
  3064. ///
  3065. ///
  3066. float4 ShieldPS( EFFECT_VERTEX vertex ) : COLOR
  3067. {
  3068. if ( 1 == mirrored ) clip(vertex.depth);
  3069.  
  3070. float4 colorMask = tex2D( albedoSampler, vertex.texcoord0.xy);
  3071. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.zw);
  3072. float3 normal = tex2D( secondarySampler, vertex.texcoord1.xy ).gaa * 2 - 1;
  3073. normal.z = sqrt( 1 - normal.x*normal.x - normal.y*normal.y );
  3074. float3 specular = tex2D( specularSampler, vertex.texcoord1.zw );
  3075.  
  3076. // Combine albedo and normal sampler for a final color
  3077. float4 color = float4( mul( albedo.rgr, normal.rgb ) + float3( 0, 0, 0.25), 1.0);
  3078.  
  3079. // Using the specular sampler, with 3 layers of noise in color chanels modulate the
  3080. // alpha channel for the current pixel
  3081. if( specular.g <= albedo.r )
  3082. {
  3083. if( specular.b >= albedo.g )
  3084. color.a = ( color.b >= normal.b ) ? 0.12 : lerp( 0.05, 0, sin(frac( 0.01 * time) * 3.14) );
  3085. else
  3086. color.a = ( normal.b >= albedo.r ) ? 0.2 : lerp( 0.01, 0.1, sin(frac( 0.01 * time) * 3.14) );
  3087. }
  3088. else
  3089. {
  3090. if( specular.r >= albedo.r )
  3091. color.a = ( specular.b >= albedo.r ) ? 0.025 : 0.1;
  3092. else
  3093. color.a = ( specular.g >= albedo.g ) ? 0.02 : lerp( 0.37, 0.46, sin(frac( 0.01 * time) * 3.14) );
  3094. }
  3095.  
  3096. color.rgb += float3( 0, 0, 0.15 );
  3097.  
  3098. // Adjust color of shield based on its health percentage
  3099. float4 colorMod1 = lerp(float4( 0.5, 0.0, 0.0, 0.05 ), color, 0.5);
  3100. colorMod1 = lerp( color, colorMod1 + color, sin(frac( 0.06 * time) * 3.14) );
  3101. color = lerp( colorMod1, color, vertex.material.y );
  3102. color += (colorMask.b * 0.95);
  3103.  
  3104. // Add in our alpha channel to mask UV pinching at the top of the sphere
  3105. color.a *= colorMask.a;// * 0.75;
  3106.  
  3107. return color;
  3108. }
  3109.  
  3110. float4 ShieldLoFiPS( LOFIEFFECT_VERTEX vertex ) : COLOR
  3111. {
  3112. float3 color = float3( 0.0, 0.0, 0.3);
  3113. float4 colormask = tex2D( albedoSampler, vertex.texcoord0.xy);
  3114. float4 albedo = tex2D( albedoSampler, vertex.texcoord1.xy );
  3115. float4 secondary = tex2D( secondarySampler, vertex.texcoord2.xy);
  3116. float4 specular = tex2D( specularSampler, vertex.texcoord2.xy);
  3117.  
  3118. color.rgb += albedo.r + secondary.b;
  3119. float alpha = colormask.b * 0.7;
  3120.  
  3121. if( specular.g <= albedo.g )
  3122. alpha += 0.2;
  3123. else
  3124. alpha += 0.1;
  3125.  
  3126. color.rgb += float3( 0, 0, 0.15 ) + colormask.bbb;
  3127.  
  3128. alpha *= colormask.a;
  3129. return float4(color,alpha);
  3130. }
  3131.  
  3132. /// ShieldCybranPS
  3133. ///
  3134. ///
  3135. float4 ShieldCybranPS( EFFECT_VERTEX vertex, uniform float alpha ) : COLOR
  3136. {
  3137. if ( 1 == mirrored ) clip(vertex.depth);
  3138.  
  3139. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy );
  3140. float4 albedo2 = tex2D( albedoSampler, vertex.texcoord0.zw );
  3141. float3 specular = tex2D( specularSampler, vertex.texcoord1.xy );
  3142. float3 specular2 = tex2D( specularSampler, vertex.texcoord1.zw );
  3143.  
  3144. // Color wackiness
  3145. float3 color2 = (albedo2.b * specular2.g * 3 );
  3146. float3 color3 = specular2.g * albedo.a;
  3147. float3 color4 = ((albedo2.g - specular2.b ) * specular.b) * albedo.a;
  3148. float3 finalColor = float3( 0.05, 0.0, 0.3 ) + color4 - color2 * color3;
  3149.  
  3150. // Adjust color of shield based on its health percentage
  3151. float3 colorMod1 = lerp(float3( 0.2, 0, 0.0 ), finalColor, 0.5);
  3152. colorMod1 = lerp( finalColor, (colorMod1 - finalColor) + (color4 + colorMod1), sin(frac( 0.06 * vertex.material.x) * 3.14) );
  3153. finalColor = lerp( colorMod1, finalColor, vertex.material.y);
  3154.  
  3155. finalColor += (albedo.r + albedo2.r) * 0.1;
  3156. finalColor -= (1 - albedo.a);
  3157.  
  3158. float clradd = (finalColor.r + finalColor.g + finalColor.b);
  3159.  
  3160. if (clradd < 0.1)
  3161. {
  3162. finalColor = float3( 0.15, 0.15, 0.3 );
  3163. }
  3164. else
  3165. {
  3166. if (clradd > 0.1)
  3167. {
  3168. if (clradd < 0.2)
  3169. finalColor = specular.b;
  3170. }
  3171. }
  3172.  
  3173. finalColor += ((albedo.r + albedo2.r) * float3( 0.0, 0.0, 0.3 ));
  3174.  
  3175. // Alpha
  3176. alpha += (albedo.r + albedo2.r) * 0.2;
  3177.  
  3178. return float4(finalColor, alpha);
  3179. }
  3180.  
  3181. float4 ShieldCybranLoFiPS( LOFIEFFECT_VERTEX vertex, uniform float alpha ) : COLOR
  3182. {
  3183. if ( 1 == mirrored ) clip(vertex.depth);
  3184.  
  3185. // Texture samplers
  3186. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy );
  3187. float4 albedo2 = tex2D( albedoSampler, vertex.texcoord1.xy );
  3188. float3 specular = tex2D( specularSampler, vertex.texcoord2.xy );
  3189.  
  3190. // Color wackiness
  3191. float3 color = float3( 0.2, 0.0, 0.5 ) * specular.b;
  3192. alpha += (albedo.r + albedo2.r) * 0.8;
  3193. return float4(color, alpha );
  3194. }
  3195.  
  3196.  
  3197. /// ShieldAeonPS
  3198. ///
  3199. ///
  3200. float4 ShieldAeonPS( EFFECT_NORMALMAPPED_VERTEX vertex ) : COLOR
  3201. {
  3202. if ( 1 == mirrored ) clip(vertex.depth);
  3203.  
  3204. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  3205.  
  3206. // Texture samplers
  3207. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy );
  3208. float3 specular = tex2D( specularSampler, vertex.texcoord0.zw );
  3209. float3 specular2 = tex2D( specularSampler, vertex.texcoord1.xy );
  3210. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord1.zw * 4, rotationMatrix);
  3211.  
  3212. float dotLightNormal = dot(sunDirection,normal);
  3213. float phongAmount = saturate( dot( reflect( -vertex.viewDirection, normal), vertex.viewDirection)) * 0.6;
  3214. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  3215.  
  3216. // Magic
  3217. float3 terrainBand = albedo.b * 0.5;
  3218. float3 color1 = phongAmount + environment - albedo.ggg;
  3219. float3 color2 = (specular.rrr) * lerp( 0.6, 1.3, sin(frac( 0.015 * time) * 3.14));
  3220. float3 color3 = (specular2.rrr) * lerp( 2.0, 2.2, sin(frac( 0.0045 * time) * 3.14));
  3221.  
  3222. float3 finalColor = (color1 * color2) * color3;
  3223. float3 color4 = (finalColor * normal.rgb) * 0.65 + finalColor;
  3224. finalColor = color4 * environment * albedo.a;
  3225.  
  3226. // Adjust color of shield based on its health percentage
  3227. float3 colorMod1 = lerp(float3( 0.7, 0.3, 0.3 ), finalColor, 0.9 );
  3228. float3 colorMod2 = lerp( finalColor, colorMod1, sin(frac( 0.05 * vertex.material.x) * 3.14) );
  3229. finalColor = lerp( colorMod1, finalColor, vertex.material.y);
  3230.  
  3231. float alpha = 0.707 * ((environment.r + environment.g + environment.b) * 0.25) + terrainBand.r;
  3232. return float4( lerp( colorMod1, finalColor, vertex.material.y), alpha);
  3233. }
  3234.  
  3235. float4 ShieldAeonLoFiPS( LOFIEFFECT_VERTEX vertex, uniform float alpha ) : COLOR
  3236. {
  3237. // Texture samplers
  3238. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy );
  3239. float4 specular = tex2D( specularSampler, vertex.texcoord1.xy );
  3240. float3 specular2 = tex2D( specularSampler, vertex.texcoord2.xy );
  3241.  
  3242. float3 finalColor = (dot(albedo.rgb * alpha, float3(.6,.6,.6)) + (albedo.rgb * alpha)) * ((specular.rrr * 1.45) + (specular2.rrr * 2.2));
  3243.  
  3244. return float4( finalColor, 0.33 * alpha * albedo.a );
  3245. }
  3246.  
  3247. /// ShieldSeraphimPS
  3248. ///
  3249. ///
  3250. float4 ShieldSeraphimPS( EFFECT_NORMALMAPPED_VERTEX vertex ) : COLOR
  3251. {
  3252. if ( 1 == mirrored )
  3253. clip(vertex.depth);
  3254.  
  3255. float4 normal_pixel = tex2D( normalsSampler, vertex.texcoord1.zw );
  3256. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal );
  3257. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord1.zw, rotationMatrix );
  3258. float4 uvaddress = tex2D( normalsSampler, vertex.texcoord1.xy );
  3259. float2 texcoord = vertex.texcoord0.xy + (uvaddress.rb * 0.1);
  3260. float4 specular = tex2D( specularSampler, texcoord );
  3261.  
  3262. float m = abs( normal_pixel.g - 0.5 );
  3263. const float max_brightness = 0.453;
  3264. float dp = abs( cos(dot( float4(0,1,0,0), normal )) );
  3265. float channel_color = max_brightness - clamp((1.0 - dp), 0, max_brightness );
  3266. float t = abs(dot(float4(0,1,0,0), normalize(vertex.normal)));
  3267. float time_cutoff = 0.753;
  3268. float dp2 = abs(dot(vertex.viewDirection,normal));
  3269.  
  3270. ///If we are not close enough to the top of the shield dome...
  3271. if( t < time_cutoff )
  3272. {
  3273. m = 1.0; /// This alpha multiple won't change alpha (So we are not fading to near transparency yet).
  3274. }
  3275. else
  3276. {
  3277. // NOTE: From right to left in the equation.
  3278. // Get a percentage multiple of how close we are to the top of the dome from the
  3279. // point where we want to start an alpha gradient to (close to) transparency. Using that
  3280. // we mutliply by 0.7 in order to get a percentage of a percentage multiple that is less than one.
  3281. // Then that is all subtracted from one, the closer we are to the top of the dome, the more we
  3282. // are subtracting 0.7 from 1.0 and the closer our final percentage multiple is to 0.4, where the
  3283. // final percentage multiple ('m') starts out at one. 0.7 is used to ensure that we do not go to complete
  3284. // transparency and retain some feeling of a sphere around the top area of the dome.
  3285. m = 1.0 - 0.7 * (t - time_cutoff) / (1.0 - time_cutoff);
  3286. }
  3287.  
  3288. ///Compute the final translucency value.
  3289. float alpha = m *( dp2 * 0.3 + channel_color )*1.75;
  3290.  
  3291. // Multiples(0.425,0.76274,1.0) are to give a blue tint. The dot product of the normal and the world up vector is squared
  3292. // so that the blue and whitish color fade off in an exponential gradient.
  3293. return float4( 0.425 * dp * dp * specular.r, 0.76274 * dp * dp * specular.g, 1.0 * dp * dp * specular.b, alpha );
  3294. }
  3295.  
  3296. /// ShieldFillPS()
  3297. ///
  3298. ///
  3299. float4 ShieldFillPS( FLAT_VERTEX vertex ) : COLOR0
  3300. {
  3301. if ( 1 == mirrored ) clip(vertex.depth.x);
  3302. return float4(0,0,0,0);
  3303. }
  3304.  
  3305. float4 ShieldImpactPS( SHIELDIMPACT_VERTEX vertex, uniform float fadeTime, uniform float fadeMul ) : COLOR
  3306. {
  3307. if ( 1 == mirrored ) clip(vertex.depth);
  3308.  
  3309. float alphaFade = saturate( 1.0f - ( vertex.material.x - fadeTime) * fadeMul);
  3310.  
  3311. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy );
  3312. float4 normal = tex2D( specularSampler, vertex.texcoord1.xy );
  3313. float alphaMask = tex2D( specularSampler, vertex.texcoord2.xy ).a;
  3314.  
  3315. float3 color = float3( 0, 0, 0.5) + normal.r;
  3316. float alpha = alphaMask * albedo.g * (normal.r + normal.g) * alphaFade;
  3317.  
  3318. return float4( color, alpha );
  3319. }
  3320.  
  3321. float4 CybranShieldImpactPS( SHIELDIMPACT_VERTEX vertex, uniform float fadeTime, uniform float fadeMul, uniform float alphaIntensity ) : COLOR
  3322. {
  3323. if ( 1 == mirrored ) clip(vertex.depth.x);
  3324.  
  3325. float alphaFade = saturate( 1.0f - ( vertex.material.x - fadeTime) * fadeMul);
  3326.  
  3327. // Read textures and modify texture coords, so that they slow down as it fades
  3328. float4 color0 = tex2D( specularSampler, vertex.texcoord0.xy );
  3329. float4 color1 = tex2D( specularSampler, vertex.texcoord1.xy );
  3330. float4 color2 = tex2D( specularSampler, vertex.texcoord2.xy );
  3331.  
  3332. float3 finalcolor = color1.rrr + color0.g;
  3333. float alpha = color1.b * color2.r * alphaIntensity * alphaFade * color0.a;
  3334.  
  3335. return float4( finalcolor, alpha );
  3336. }
  3337.  
  3338. float4 PhaseShieldPS( VERTEXNORMAL_VERTEX vertex ) : COLOR
  3339. {
  3340. float2 tc1 = vertex.texcoord0.xy * 0.5;
  3341. tc1.x += 0.005 * vertex.material.x;
  3342. tc1.y += 0.02 * vertex.material.x;
  3343. float4 lookup = tex2D( lookupSampler, tc1);
  3344.  
  3345. float2 tc2 = vertex.texcoord0.xy * 4;
  3346. tc2.y += 0.008 * vertex.material.x;
  3347. tc2.x -= 0.008 * vertex.material.x;
  3348. float4 lookup2 = tex2D( lookupSampler, tc2);
  3349.  
  3350. float2 tc3 = vertex.texcoord0.xy * 0.01;
  3351. tc3.x -= 0.0018 * vertex.material.x;
  3352. float4 lookup3 = tex2D( lookupSampler, tc3);
  3353.  
  3354. float electricity = lookup.r * lookup2.b;
  3355. float4 baseshellcolor = float4( 0.5, 0.5, 1, 1);
  3356. float4 glowpulse = float4(lookup3.ggg, min(lookup3.g, 0.65) + electricity );
  3357.  
  3358. return (baseshellcolor + electricity) * glowpulse;
  3359. }
  3360.  
  3361. float4 SeraphimPhaseShieldPS( VERTEXNORMAL_VERTEX vertex ) : COLOR
  3362. {
  3363. float2 tc1 = vertex.texcoord0.xy * 0.5;
  3364. tc1.x += 0.005 * vertex.material.x;
  3365. tc1.y += 0.02 * vertex.material.x;
  3366. float4 lookup = tex2D( secondarySampler, tc1);
  3367.  
  3368. float2 tc2 = vertex.texcoord0.xy * 4;
  3369. tc2.y += 0.008 * vertex.material.x;
  3370. tc2.x -= 0.008 * vertex.material.x;
  3371. float4 lookup2 = tex2D( secondarySampler, tc2);
  3372.  
  3373. float2 tc3 = vertex.texcoord0.xy * 0.01;
  3374. tc3.x -= 0.0018 * vertex.material.x;
  3375. float4 lookup3 = tex2D( secondarySampler, tc3);
  3376.  
  3377. float electricity = lookup.r * lookup2.b;
  3378. float4 baseshellcolor = float4( 0.5, 0.5, 1, 1);
  3379. float4 glowpulse = float4(lookup3.ggg, min(lookup3.g, 0.65) + electricity );
  3380.  
  3381. return (baseshellcolor + electricity) * glowpulse;
  3382. }
  3383.  
  3384. /// EffectPS
  3385. ///
  3386. ///
  3387. float4 EffectPS( EFFECT_VERTEX vertex ) : COLOR
  3388. {
  3389. float2 texcoord = vertex.texcoord0;
  3390. texcoord.y += vertex.material.x * 0.0008;
  3391. texcoord.y *= 3;
  3392.  
  3393. float4 color = tex2D( albedoSampler, texcoord);
  3394. float alpha = 1.0 - tex2D( albedoSampler, vertex.texcoord0 ).a;
  3395.  
  3396. alpha *= saturate( 1.0f - ( vertex.material.x - 180) * 0.025);
  3397.  
  3398. return float4( color.xyz, alpha);
  3399. }
  3400.  
  3401. /// EffectFadePS
  3402. ///
  3403. ///
  3404. float4 EffectFadePS( EFFECT_VERTEX vertex, uniform float timeFade, uniform float fadeMultiplier, uniform bool hiDefShadows ) : COLOR0
  3405. {
  3406. float4 color = tex2D( albedoSampler, vertex.texcoord0.xy);
  3407.  
  3408. float dotLightNormal = dot(sunDirection,vertex.normal);
  3409. float3 light = ComputeLight( dotLightNormal, 1);
  3410.  
  3411. color = float4( color.rgb * light, color.a * vertex.material.y );
  3412. color.a *= saturate( 1.0f - ( vertex.material.x - timeFade) * fadeMultiplier);
  3413.  
  3414. return color;
  3415. }
  3416.  
  3417. /// ExplosionPS()
  3418. ///
  3419. ///
  3420. float expinitialfadeoutTime = 0.375;
  3421. float expfadeinTime = 8.500;
  3422. float expalphafadeoutTime = 10.000;
  3423. float expfadeMul = 0.035;
  3424. float expfadeMul2 = 0.120;
  3425.  
  3426. float4 ExplosionPS( EFFECT_VERTEX vertex,
  3427. uniform bool alphaTestEnable,
  3428. uniform int alphaFunc,
  3429. uniform int alphaRef ) : COLOR0
  3430. {
  3431. // Get our texture cood, precalc fadetime
  3432. float2 t = vertex.texcoord0;
  3433. float fade = vertex.material.x - expalphafadeoutTime;
  3434.  
  3435. // Sample the AlbedoSampler texture and shift in different directions
  3436. t.y += vertex.material.x * 0.0036; // Modify our texture cood by scalar
  3437. float4 c = tex2D( albedoSampler, t ); // Sample our current pixel at texture cood
  3438.  
  3439. t.y += vertex.material.x * 0.018;
  3440. float4 d = tex2D( specularSampler, t );
  3441.  
  3442. // Add our sampled colors together and save off
  3443. c = lerp(c, d, d.a);
  3444.  
  3445. // Fade out these initial textures
  3446. c.xyz *= saturate( 1.0f - (vertex.material.x - expinitialfadeoutTime) * expfadeMul);
  3447.  
  3448. // Fade in 2nd Texture
  3449. float4 e = tex2D( normalsSampler, t );
  3450. e.xyz *= saturate( fade * expfadeMul);
  3451.  
  3452. // Combine initial and 2nd texture, re-use d
  3453. d = c + e;
  3454.  
  3455. // Alpha out our texture overtime
  3456. float alpha = saturate( 1.0f - fade * expfadeMul2);
  3457.  
  3458. // Dissolve textue based on current alpha value and the noise in NormalSampler texture
  3459. if( fade >= 0 )
  3460. {
  3461. if( e.a <= alpha )
  3462. alpha += e.a;
  3463. else
  3464. alpha = 0;
  3465. }
  3466.  
  3467. #ifdef DIRECT3D10
  3468. if( alphaTestEnable )
  3469. AlphaTestD3D10( alpha, alphaFunc, alphaRef );
  3470. #endif
  3471. return float4( d.xyz, alpha );
  3472. }
  3473.  
  3474. float4 TwoTexShiftScalePS( VERTEXNORMAL_VERTEX vertex, uniform float colorMul, uniform float alpha ) : COLOR
  3475. {
  3476. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  3477. float4 normal = tex2D( normalsSampler, vertex.shadow.xy);
  3478.  
  3479. return float4( (albedo.rgb + normal.rgb) * colorMul * albedo.a, alpha);
  3480. }
  3481.  
  3482. float4 TexSubAlphaMaskStaticLoFiPS( LOFIEFFECT_VERTEX vertex, uniform float colorMul, uniform float alphaMul ) : COLOR
  3483. {
  3484. float4 albedo = tex2D( albedoSampler, vertex.texcoord0);
  3485. float4 normal = tex2D( normalsSampler, vertex.texcoord1);
  3486. float alphaMask = tex2D( albedoSampler, vertex.texcoord2).a;
  3487.  
  3488. return float4( (albedo.rgb - normal.rgb) * colorMul, alphaMul * alphaMask);
  3489. }
  3490.  
  3491.  
  3492.  
  3493. /// EditorMarkerPS
  3494. ///
  3495. float4 EditorMarkerPS( VERTEXNORMAL_VERTEX vertex) : COLOR0
  3496. {
  3497. float dotLightNormal = dot(sunDirection,vertex.normal);
  3498. float3 light = ComputeLight( dotLightNormal, 1);
  3499.  
  3500. return float4( vertex.color.rgb * light, 1);
  3501. }
  3502.  
  3503. float4 GlassAlphaPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows ) : COLOR
  3504. {
  3505. if ( 1 == mirrored ) clip(vertex.depth);
  3506.  
  3507. float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
  3508. float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
  3509. float dotLightNormal = dot(sunDirection,normal);
  3510.  
  3511. float4 albedo = tex2D( albedoSampler, vertex.texcoord0.xy);
  3512. float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
  3513. float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
  3514. //return float4( environment, 0.5);
  3515.  
  3516. float2 anisoLookup = float2( dot( reflect( sunDirection, normal), -vertex.viewDirection), dotLightNormal);
  3517.  
  3518. albedo.rgb = lerp( vertex.color.rgb, albedo.rgb, 1 - specular.a );
  3519.  
  3520. float4 phongAdditive = specular.g + float4( 0.5 * specular.r * environment, 0);
  3521. phongAdditive *= ( 1 - specular.a);
  3522.  
  3523. float shadow = ComputeShadow( vertex.shadow, hiDefShadows);
  3524. float3 light = 2 * sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
  3525. light = lightMultiplier * light + ( 1 - light ) * shadowFill;
  3526. //return float4( light, 0.2);
  3527.  
  3528. float emissive = glowMultiplier * specular.b;
  3529. float3 color = albedo.rgb * ( emissive.r + light ) + phongAdditive.rgb;
  3530.  
  3531. float alpha = mirrored ? albedo.a: albedo.a + specular.b + phongAdditive.a;
  3532.  
  3533. return float4(color, alpha);
  3534. }
  3535.  
  3536. float4 GlassAlphaLoFiPS( VERTEXNORMAL_VERTEX vertex ) : COLOR
  3537. {
  3538. float4 albedo = tex2D(albedoSampler,vertex.texcoord0.xy);
  3539. float4 specular = tex2D(specularSampler,vertex.texcoord0.xy);
  3540. albedo.rgb = lerp(vertex.color.rgb,albedo.rgb,1 - saturate(specular.a));
  3541. float3 light = ComputeLight(dot(sunDirection,vertex.normal),1);
  3542. float3 color = 2 * light.rgb * light.rgb * albedo.rgb;
  3543. float alpha = mirrored ? albedo.a: albedo.a + specular.b;
  3544. return float4(color.rgb,alpha);
  3545. }
  3546.  
  3547. ///////////////////////////////////////
  3548. ///
  3549. /// Techniques
  3550. ///
  3551. ///////////////////////////////////////
  3552.  
  3553.  
  3554.  
  3555. /// AlbedoPreview
  3556. ///
  3557. ///
  3558. technique AlbedoPreview
  3559. {
  3560. pass P0
  3561. {
  3562. AlphaState( AlphaBlend_Disable_Write_RGB )
  3563. RasterizerState( Rasterizer_Cull_CW )
  3564.  
  3565. VertexShader = compile vs_1_1 NormalMappedVS();
  3566. PixelShader = compile ps_2_0 AlbedoPreviewPS();
  3567. }
  3568. }
  3569.  
  3570.  
  3571. /// NormalsPreview
  3572. ///
  3573. ///
  3574. technique NormalsPreview
  3575. {
  3576. pass P0
  3577. {
  3578. AlphaState( AlphaBlend_Disable_Write_RGB )
  3579. RasterizerState( Rasterizer_Cull_CW )
  3580.  
  3581. VertexShader = compile vs_1_1 NormalMappedVS();
  3582. PixelShader = compile ps_2_0 NormalsPreviewPS();
  3583. }
  3584. }
  3585.  
  3586. /// LightingPreview
  3587. ///
  3588. ///
  3589. technique LightingPreview
  3590. {
  3591. pass P0
  3592. {
  3593. AlphaState( AlphaBlend_Disable_Write_RGB )
  3594. RasterizerState( Rasterizer_Cull_CW )
  3595.  
  3596. VertexShader = compile vs_1_1 NormalMappedVS();
  3597. PixelShader = compile ps_2_0 LightingPreviewPS();
  3598. }
  3599. }
  3600.  
  3601. /// Depth
  3602. ///
  3603. ///
  3604. technique Depth
  3605. {
  3606. pass P0
  3607. {
  3608. AlphaState( AlphaBlend_Disable )
  3609. RasterizerState( Rasterizer_Cull_CW )
  3610. DepthState( Depth_Enable )
  3611.  
  3612. #ifndef DIRECT3D10
  3613. AlphaTestEnable = false;
  3614. #endif
  3615.  
  3616. VertexShader = compile vs_1_1 DepthVS();
  3617. PixelShader = compile ps_2_0 DepthPS(false);
  3618. }
  3619. }
  3620.  
  3621. /// SeraphimBuildDepth
  3622. ///
  3623. ///
  3624. technique SeraphimBuildDepth
  3625. {
  3626. pass P0
  3627. {
  3628. AlphaState( AlphaBlend_Disable )
  3629. RasterizerState( Rasterizer_Cull_CW )
  3630. DepthState( Depth_Enable )
  3631.  
  3632. #ifndef DIRECT3D10
  3633. AlphaTestEnable = false;
  3634. #endif
  3635.  
  3636. VertexShader = compile vs_1_1 SeraphimBuildDepthVS();
  3637. PixelShader = compile ps_2_0 DepthPS(false);
  3638. }
  3639. }
  3640.  
  3641. /// DepthClip
  3642. ///
  3643. ///
  3644. technique DepthClip
  3645. {
  3646. pass P0
  3647. {
  3648. AlphaState( AlphaBlend_Disable )
  3649. RasterizerState( Rasterizer_Cull_CW )
  3650. DepthState( Depth_Enable )
  3651.  
  3652. #ifndef DIRECT3D10
  3653. AlphaTestEnable = false;
  3654. #endif
  3655.  
  3656. VertexShader = compile vs_1_1 DepthVS();
  3657. PixelShader = compile ps_2_0 DepthPS(true);
  3658. }
  3659. }
  3660.  
  3661. /// UndulatingDepthClip
  3662. ///
  3663. ///
  3664. technique UndulatingDepthClip
  3665. {
  3666. pass P0
  3667. {
  3668. AlphaState( AlphaBlend_Disable )
  3669. RasterizerState( Rasterizer_Cull_CW )
  3670. DepthState( Depth_Enable )
  3671.  
  3672. #ifndef DIRECT3D10
  3673. AlphaTestEnable = false;
  3674. #endif
  3675.  
  3676. VertexShader = compile vs_1_1 UndulatingDepthVS();
  3677. PixelShader = compile ps_2_0 DepthPS(true);
  3678. }
  3679. }
  3680.  
  3681. /// Occlude
  3682. ///
  3683. /// Technique for updating the stencil buffer with occluding data. In other words,
  3684. /// set bit 0 for all pixels which can act as an occluder.
  3685. /// See: Silhouette below and TSilhouette in frame.fx
  3686. technique Occlude
  3687. {
  3688. /// Set bit 0 everywhere in the stencil buffer there is
  3689. /// an "occluding" pixel.
  3690. pass P0
  3691. {
  3692. AlphaState( AlphaBlend_Disable_Write_None )
  3693. RasterizerState( Rasterizer_Cull_CW )
  3694. DepthState( Depth_Occlude )
  3695.  
  3696. VertexShader = compile vs_1_1 SilhouetteVS();
  3697. PixelShader = null;
  3698. }
  3699. }
  3700.  
  3701. /// Silhouette
  3702. ///
  3703. /// Technique for updating the stencil buffer with occluded data.
  3704. /// See: Occlude above and TSilhouette in frame.fx
  3705. technique Silhouette
  3706. {
  3707. /// First pass
  3708. ///
  3709. /// Set bit 1 everywhere there is an "occluded" pixel. Bit 0 is set for all occluders. Therefore,
  3710. /// the value 0x03 will exist in the stencil buffer for all occluder and occluded
  3711. /// overlaps.
  3712. pass P0
  3713. {
  3714. AlphaState( AlphaBlend_Disable_Write_None )
  3715. RasterizerState( Rasterizer_Cull_CW )
  3716. DepthState( Depth_SilhouetteP0 )
  3717.  
  3718. VertexShader = compile vs_1_1 SilhouetteVS();
  3719. PixelShader = null;
  3720. }
  3721.  
  3722. /// Second pass
  3723. ///
  3724. /// Clear the stencil buffer everywhere bits 0 and 1 are set (0x03) and
  3725. /// the depth test passes. If the stencil test passes but the depth test fails,
  3726. /// keep the value 0x03 which will serve as the acutal silhouette in the stencil buffer.
  3727. pass P1
  3728. {
  3729. DepthState( Depth_SilhouetteP1 )
  3730.  
  3731. VertexShader = compile vs_1_1 SilhouetteVS();
  3732. PixelShader = null;
  3733. }
  3734. }
  3735.  
  3736. /// CartographicFeedback
  3737. ///
  3738. ///
  3739. technique CartographicFeedback
  3740. <
  3741. int renderStage = 0;
  3742. int parameter = PARAM_FRACTIONCOMPLETE;
  3743. >
  3744. {
  3745. pass P0
  3746. {
  3747. AlphaState( AlphaBlend_Disable_Write_RGB )
  3748. RasterizerState( Rasterizer_Cull_CW )
  3749. DepthState( Depth_Enable )
  3750.  
  3751. #ifndef DIRECT3D10
  3752. AlphaTestEnable = true;
  3753. AlphaRef = 0x7F;
  3754. AlphaFunc = Greater;
  3755. #endif
  3756.  
  3757. VertexShader = compile vs_1_1 CartographicFeedbackVS();
  3758. PixelShader = compile ps_2_0 CartographicFeedbackPS(true);
  3759. }
  3760. }
  3761.  
  3762. /// CartographicFeature
  3763. ///
  3764. ///
  3765. technique CartographicFeature
  3766. <
  3767. int renderStage = 0;
  3768. int parameter = PARAM_FRACTIONCOMPLETE;
  3769. >
  3770. {
  3771. pass P0
  3772. {
  3773. AlphaState( AlphaBlend_Disable_Write_RGB )
  3774. RasterizerState( Rasterizer_Cull_CW )
  3775. DepthState( Depth_Enable )
  3776.  
  3777. #ifndef DIRECT3D10
  3778. AlphaTestEnable = true;
  3779. AlphaRef = 0x7F;
  3780. AlphaFunc = Greater;
  3781. #endif
  3782.  
  3783. VertexShader = compile vs_1_1 CartographicVS();
  3784. PixelShader = compile ps_2_0 CartographicPS(true);
  3785. }
  3786. }
  3787.  
  3788. /// CartographicUnit
  3789. ///
  3790. ///
  3791. technique CartographicUnit
  3792. <
  3793. int renderStage = 0;
  3794. int parameter = PARAM_FRACTIONCOMPLETE;
  3795. >
  3796. {
  3797. pass P0
  3798. {
  3799. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  3800. RasterizerState( Rasterizer_Cull_CW )
  3801. DepthState( Depth_Enable )
  3802.  
  3803. VertexShader = compile vs_1_1 CartographicVS();
  3804. PixelShader = compile ps_2_0 CartographicPS(false);
  3805. }
  3806. pass P1
  3807. {
  3808. AlphaState( AlphaBlend_Disable_Write_A )
  3809. RasterizerState( Rasterizer_Cull_CW )
  3810. DepthState( Depth_Disable )
  3811.  
  3812. VertexShader = compile vs_1_1 CartographicVS();
  3813. PixelShader = compile ps_2_0 CartographicGlowPS();
  3814. }
  3815. }
  3816.  
  3817. /// CartographicPlace
  3818. ///
  3819. ///
  3820. technique CartographicPlace
  3821. <
  3822. int renderStage = 0;
  3823. int parameter = PARAM_FRACTIONCOMPLETE;
  3824. >
  3825. {
  3826. pass P0
  3827. {
  3828. AlphaState( AlphaBlend_Disable_Write_RGBA )
  3829. RasterizerState( Rasterizer_Cull_CW )
  3830. DepthState( Depth_Enable )
  3831.  
  3832. VertexShader = compile vs_1_1 CartographicVS();
  3833. PixelShader = compile ps_2_0 CartographicPlacePS();
  3834. }
  3835. }
  3836.  
  3837. /// CartographicBuild
  3838. ///
  3839. ///
  3840. technique CartographicBuild
  3841. <
  3842. int renderStage = 0;
  3843. int parameter = PARAM_FRACTIONCOMPLETE;
  3844. >
  3845. {
  3846. pass P0
  3847. {
  3848. AlphaState( AlphaBlend_Disable_Write_RGBA )
  3849. RasterizerState( Rasterizer_Cull_CW )
  3850. DepthState( Depth_Enable )
  3851.  
  3852. VertexShader = compile vs_1_1 CartographicVS();
  3853. PixelShader = compile ps_2_0 CartographicBuildPS();
  3854. }
  3855. }
  3856.  
  3857. /// CartographicShield
  3858. ///
  3859. ///
  3860. technique CartographicShield
  3861. <
  3862. int renderStage = 0;
  3863. int parameter = PARAM_FRACTIONCOMPLETE;
  3864. >
  3865. {
  3866. pass P0
  3867. {
  3868. ColorWriteEnable = 0x07;
  3869.  
  3870. AlphaBlendEnable = true;
  3871. SrcBlend = SrcAlpha;
  3872. DestBlend = InvSrcAlpha;
  3873.  
  3874. ZEnable = true;
  3875. ZWriteEnable = false;
  3876.  
  3877. VertexShader = compile vs_1_1 CartographicVS();
  3878. PixelShader = compile ps_2_0 CartographicShieldPS();
  3879. }
  3880. }
  3881.  
  3882. /// Flat
  3883. ///
  3884. ///
  3885. technique Flat
  3886. <
  3887. string depthTechnique = "DepthClip";
  3888. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  3889. int parameter = PARAM_FRACTIONCOMPLETE;
  3890. >
  3891. {
  3892. pass P0
  3893. {
  3894. AlphaState( AlphaBlend_Disable_Write_RGB )
  3895. RasterizerState( Rasterizer_Cull_CW )
  3896. DepthState( Depth_Enable )
  3897.  
  3898. #ifndef DIRECT3D10
  3899. AlphaTestEnable = true;
  3900. AlphaRef = 0x7F;
  3901. AlphaFunc = Greater;
  3902. #endif
  3903.  
  3904. VertexShader = compile vs_1_1 FlatVS();
  3905. PixelShader = compile ps_2_0 FlatPS( true, d3d_Greater, 0x7F );
  3906. }
  3907. }
  3908.  
  3909. /// VertexNormal
  3910. ///
  3911. ///
  3912. technique VertexNormal_HighFidelity
  3913. <
  3914. int fidelity = FIDELITY_HIGH;
  3915.  
  3916. string abstractTechnique = "VertexNormal";
  3917. string cartographicTechnique = "CartographicFeature";
  3918. string depthTechnique = "DepthClip";
  3919.  
  3920. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  3921. int parameter = PARAM_FRACTIONCOMPLETE;
  3922. >
  3923. {
  3924. pass P0
  3925. {
  3926. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  3927. RasterizerState( Rasterizer_Cull_CW )
  3928. DepthState( Depth_Enable )
  3929.  
  3930. #ifndef DIRECT3D10
  3931. AlphaTestEnable = true;
  3932. AlphaFunc = Greater;
  3933. AlphaRef = 0x23;
  3934. #endif
  3935.  
  3936. VertexShader = compile vs_1_1 VertexNormalVS();
  3937. PixelShader = compile ps_2_a VertexNormalPS_HighFidelity(true, true, d3d_Greater, 0x23 );
  3938. }
  3939. }
  3940.  
  3941. technique VertexNormal_MedFidelity
  3942. <
  3943. int fidelity = FIDELITY_MEDIUM;
  3944.  
  3945. string abstractTechnique = "VertexNormal";
  3946. string cartographicTechnique = "CartographicFeature";
  3947. string depthTechnique = "DepthClip";
  3948.  
  3949. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  3950. int parameter = PARAM_FRACTIONCOMPLETE;
  3951. >
  3952. {
  3953. pass P0
  3954. {
  3955. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  3956. RasterizerState( Rasterizer_Cull_CW )
  3957. DepthState( Depth_Enable )
  3958.  
  3959. #ifndef DIRECT3D10
  3960. AlphaTestEnable = true;
  3961. AlphaFunc = Greater;
  3962. AlphaRef = 0x23;
  3963. #endif
  3964.  
  3965. VertexShader = compile vs_1_1 VertexNormalVS();
  3966. PixelShader = compile ps_2_0 VertexNormalPS_HighFidelity(false, true, d3d_Greater, 0x23 );
  3967. }
  3968. }
  3969.  
  3970. technique VertexNormal_LowFidelity
  3971. <
  3972. int fidelity = FIDELITY_LOW;
  3973.  
  3974. string abstractTechnique = "VertexNormal";
  3975. string cartographicTechnique = "CartographicFeature";
  3976. string depthTechnique = "DepthClip";
  3977.  
  3978. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  3979. int parameter = PARAM_FRACTIONCOMPLETE;
  3980. >
  3981. {
  3982. pass P0
  3983. {
  3984. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  3985. RasterizerState( Rasterizer_Cull_CW )
  3986. DepthState( Depth_Enable )
  3987.  
  3988. #ifndef DIRECT3D10
  3989. AlphaTestEnable = true;
  3990. AlphaRef = 0x23;
  3991. AlphaFunc = Greater;
  3992. #endif
  3993.  
  3994. VertexShader = compile vs_1_1 VertexNormalVS();
  3995. PixelShader = compile ps_2_0 VertexNormalPS_LowFidelity( true, d3d_Greater, 0x23 );
  3996. }
  3997. }
  3998.  
  3999. /// NormalMappedAlpha
  4000. ///
  4001. ///
  4002. technique NormalMappedAlpha_HighFidelity
  4003. <
  4004. int fidelity = FIDELITY_HIGH;
  4005.  
  4006. string abstractTechnique = "NormalMappedAlpha";
  4007. string cartographicTechnique = "CartographicFeature";
  4008. string depthTechnique = "DepthClip";
  4009.  
  4010. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  4011. int parameter = PARAM_FRACTIONCOMPLETE;
  4012. >
  4013. {
  4014. pass P0
  4015. {
  4016. AlphaState( AlphaBlend_Disable_Write_RGB )
  4017. RasterizerState( Rasterizer_Cull_CW )
  4018. DepthState( Depth_Enable )
  4019.  
  4020. #ifndef DIRECT3D10
  4021. AlphaTestEnable = true;
  4022. AlphaRef = 0x80;
  4023. AlphaFunc = Greater;
  4024. #endif
  4025.  
  4026. VertexShader = compile vs_1_1 NormalMappedVS();
  4027. PixelShader = compile ps_2_a NormalMappedPS(false,false,true, true, d3d_Greater, 0x80 );
  4028. }
  4029. }
  4030.  
  4031. technique NormalMappedAlpha_MedFidelity
  4032. <
  4033. int fidelity = FIDELITY_MEDIUM;
  4034.  
  4035. string abstractTechnique = "NormalMappedAlpha";
  4036. string cartographicTechnique = "CartographicFeature";
  4037. string depthTechnique = "DepthClip";
  4038.  
  4039. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  4040. int parameter = PARAM_FRACTIONCOMPLETE;
  4041. >
  4042. {
  4043. pass P0
  4044. {
  4045. AlphaState( AlphaBlend_Disable_Write_RGB )
  4046. RasterizerState( Rasterizer_Cull_CW )
  4047. DepthState( Depth_Enable )
  4048.  
  4049. #ifndef DIRECT3D10
  4050. AlphaTestEnable = true;
  4051. AlphaRef = 0x80;
  4052. AlphaFunc = Greater;
  4053. #endif
  4054.  
  4055. VertexShader = compile vs_1_1 NormalMappedVS();
  4056. PixelShader = compile ps_2_0 NormalMappedPS(false,false,false, true, d3d_Greater, 0x80 );
  4057. }
  4058. }
  4059.  
  4060. technique NormalMappedAlpha_LowFidelity
  4061. <
  4062. int fidelity = FIDELITY_LOW;
  4063.  
  4064. string abstractTechnique = "NormalMappedAlpha";
  4065. string cartographicTechnique = "CartographicFeature";
  4066. string depthTechnique = "DepthClip";
  4067.  
  4068. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  4069. int parameter = PARAM_FRACTIONCOMPLETE;
  4070. >
  4071. {
  4072. pass P0
  4073. {
  4074. AlphaState( AlphaBlend_Disable_Write_RGB )
  4075. RasterizerState( Rasterizer_Cull_CW )
  4076. DepthState( Depth_Enable )
  4077.  
  4078. #ifndef DIRECT3D10
  4079. AlphaTestEnable = true;
  4080. AlphaRef = 0x80;
  4081. AlphaFunc = Greater;
  4082. #endif
  4083.  
  4084. VertexShader = compile vs_1_1 VertexNormalVS();
  4085. PixelShader = compile ps_2_0 VertexNormalPS_LowFidelity( true, d3d_Greater, 0x80 );
  4086. }
  4087. }
  4088.  
  4089. /// NormalMappedAlphaNoShadow
  4090. ///
  4091. ///
  4092. technique NormalMappedAlphaNoShadow_HighFidelity
  4093. <
  4094. int fidelity = FIDELITY_HIGH;
  4095.  
  4096. string abstractTechnique = "NormalMappedAlphaNoShadow";
  4097. string cartographicTechnique = "CartographicFeature";
  4098. string depthTechnique = "DepthClip";
  4099.  
  4100. int renderStage = STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4101. int parameter = PARAM_FRACTIONCOMPLETE;
  4102. >
  4103. {
  4104. pass P0
  4105. {
  4106. AlphaState( AlphaBlend_Disable_Write_RGB )
  4107. RasterizerState( Rasterizer_Cull_CW )
  4108. DepthState( Depth_Enable )
  4109.  
  4110. #ifndef DIRECT3D10
  4111. AlphaTestEnable = true;
  4112. AlphaRef = 0x80;
  4113. AlphaFunc = Greater;
  4114. #endif
  4115.  
  4116. VertexShader = compile vs_1_1 NormalMappedVS();
  4117. PixelShader = compile ps_2_a NormalMappedPS(false,false,true, true, d3d_Greater, 0x80 );
  4118. }
  4119. }
  4120.  
  4121. technique NormalMappedAlphaNoShadow_MedFidelity
  4122. <
  4123. int fidelity = FIDELITY_MEDIUM;
  4124.  
  4125. string abstractTechnique = "NormalMappedAlphaNoShadow";
  4126. string cartographicTechnique = "CartographicFeature";
  4127. string depthTechnique = "DepthClip";
  4128.  
  4129. int renderStage = STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4130. int parameter = PARAM_FRACTIONCOMPLETE;
  4131. >
  4132. {
  4133. pass P0
  4134. {
  4135. AlphaState( AlphaBlend_Disable_Write_RGB )
  4136. RasterizerState( Rasterizer_Cull_CW )
  4137. DepthState( Depth_Enable )
  4138.  
  4139. #ifndef DIRECT3D10
  4140. AlphaTestEnable = true;
  4141. AlphaRef = 0x80;
  4142. AlphaFunc = Greater;
  4143. #endif
  4144.  
  4145. VertexShader = compile vs_1_1 NormalMappedVS();
  4146. PixelShader = compile ps_2_0 NormalMappedPS(false,false,false, true, d3d_Greater, 0x80 );
  4147. }
  4148. }
  4149.  
  4150. technique NormalMappedAlphaNoShadow_LowFidelity
  4151. <
  4152. int fidelity = FIDELITY_LOW;
  4153.  
  4154. string abstractTechnique = "NormalMappedAlphaNoShadow";
  4155. string cartographicTechnique = "CartographicUnit";
  4156. string depthTechnique = "DepthClip";
  4157.  
  4158. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4159. int parameter = PARAM_FRACTIONCOMPLETE;
  4160. >
  4161. {
  4162. pass P0
  4163. {
  4164. AlphaState( AlphaBlend_Disable_Write_RGB )
  4165. RasterizerState( Rasterizer_Cull_CW )
  4166. DepthState( Depth_Enable )
  4167.  
  4168. #ifndef DIRECT3D10
  4169. AlphaTestEnable = true;
  4170. AlphaRef = 0x80;
  4171. AlphaFunc = Greater;
  4172. #endif
  4173.  
  4174. VertexShader = compile vs_1_1 VertexNormalVS();
  4175. PixelShader = compile ps_2_0 VertexNormalPS_LowFidelity( true, d3d_Greater, 0x80 );
  4176. }
  4177. }
  4178.  
  4179.  
  4180. /// UndulatingNormalMappedAlpha
  4181. ///
  4182. /// Normal mapped with alpha test. No color mask or glow.
  4183. technique UndulatingNormalMappedAlpha_HighFidelity
  4184. <
  4185. int fidelity = FIDELITY_HIGH;
  4186.  
  4187. string abstractTechnique = "UndulatingNormalMappedAlpha";
  4188. string cartographicTechnique = "CartographicFeature";
  4189. string depthTechnique = "UndulatingDepthClip";
  4190.  
  4191. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4192. int parameter = PARAM_FRACTIONCOMPLETE;
  4193. >
  4194. {
  4195. pass P0
  4196. {
  4197. AlphaState( AlphaBlend_Disable_Write_RGB )
  4198. RasterizerState( Rasterizer_Cull_CW )
  4199. DepthState( Depth_Enable )
  4200.  
  4201. #ifndef DIRECT3D10
  4202. AlphaTestEnable = true;
  4203. AlphaRef = 0x80;
  4204. AlphaFunc = Greater;
  4205. #endif
  4206.  
  4207. VertexShader = compile vs_1_1 UndulatingNormalMappedVS();
  4208. PixelShader = compile ps_2_a NormalMappedPS(false,false,true, true, d3d_Greater, 0x80 );
  4209. }
  4210. }
  4211.  
  4212. technique UndulatingNormalMappedAlpha_MedFidelity
  4213. <
  4214. int fidelity = FIDELITY_MEDIUM;
  4215.  
  4216. string abstractTechnique = "UndulatingNormalMappedAlpha";
  4217. string cartographicTechnique = "CartographicFeature";
  4218. string depthTechnique = "UndulatingDepthClip";
  4219.  
  4220. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4221. int parameter = PARAM_FRACTIONCOMPLETE;
  4222. >
  4223. {
  4224. pass P0
  4225. {
  4226. AlphaState( AlphaBlend_Disable_Write_RGB )
  4227. RasterizerState( Rasterizer_Cull_CW )
  4228. DepthState( Depth_Enable )
  4229.  
  4230. #ifndef DIRECT3D10
  4231. AlphaTestEnable = true;
  4232. AlphaRef = 0x80;
  4233. AlphaFunc = Greater;
  4234. #endif
  4235.  
  4236. VertexShader = compile vs_1_1 UndulatingNormalMappedVS();
  4237. PixelShader = compile ps_2_0 NormalMappedPS(false,false,false, true, d3d_Greater, 0x80 );
  4238. }
  4239. }
  4240.  
  4241. technique UndulatingNormalMappedAlpha_LowFidelity
  4242. <
  4243. int fidelity = FIDELITY_LOW;
  4244.  
  4245. string abstractTechnique = "UndulatingNormalMappedAlpha";
  4246. string cartographicTechnique = "CartographicFeature";
  4247. string depthTechnique = "UndulatingDepthClip";
  4248.  
  4249. int renderStage = STAGE_DEPTH + STAGE_POSTWATER + STAGE_PREEFFECT;
  4250. int parameter = PARAM_FRACTIONCOMPLETE;
  4251. >
  4252. {
  4253. pass P0
  4254. {
  4255. AlphaState( AlphaBlend_Disable_Write_RGB )
  4256. RasterizerState( Rasterizer_Cull_CW )
  4257. DepthState( Depth_Enable )
  4258.  
  4259. #ifndef DIRECT3D10
  4260. AlphaTestEnable = true;
  4261. AlphaRef = 0x80;
  4262. AlphaFunc = Greater;
  4263. #endif
  4264.  
  4265. VertexShader = compile vs_1_1 VertexNormalVS();
  4266. PixelShader = compile ps_2_0 VertexNormalPS_LowFidelity( true, d3d_Greater, 0x80 );
  4267. }
  4268. }
  4269.  
  4270. /// BloatingNormalMappedAlpha
  4271. ///
  4272. ///
  4273. technique BloatingNormalMappedAlpha_HighFidelity
  4274. <
  4275. int fidelity = FIDELITY_HIGH;
  4276.  
  4277. string abstractTechnique = "BloatingNormalMappedAlpha";
  4278. string cartographicTechnique = "CartographicFeature";
  4279. string depthTechnique = "UndulatingDepthClip";
  4280.  
  4281. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4282. int parameter = PARAM_FRACTIONCOMPLETE;
  4283. >
  4284. {
  4285. pass P0
  4286. {
  4287. AlphaState( AlphaBlend_Disable_Write_RGB )
  4288. RasterizerState( Rasterizer_Cull_CW )
  4289. DepthState( Depth_Enable )
  4290.  
  4291. #ifndef DIRECT3D10
  4292. AlphaTestEnable = true;
  4293. AlphaRef = 0x80;
  4294. AlphaFunc = Greater;
  4295. #endif
  4296.  
  4297. VertexShader = compile vs_1_1 BloatingNormalMappedVS();
  4298. PixelShader = compile ps_2_a NormalMappedPS(false,false,true, true, d3d_Greater, 0x80 );
  4299. }
  4300. }
  4301.  
  4302. technique BloatingNormalMappedAlpha_MedFidelity
  4303. <
  4304. int fidelity = FIDELITY_MEDIUM;
  4305.  
  4306. string abstractTechnique = "BloatingNormalMappedAlpha";
  4307. string cartographicTechnique = "CartographicFeature";
  4308. string depthTechnique = "UndulatingDepthClip";
  4309.  
  4310. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4311. int parameter = PARAM_FRACTIONCOMPLETE;
  4312. >
  4313. {
  4314. pass P0
  4315. {
  4316. AlphaState( AlphaBlend_Disable_Write_RGB )
  4317. RasterizerState( Rasterizer_Cull_CW )
  4318. DepthState( Depth_Enable )
  4319.  
  4320. #ifndef DIRECT3D10
  4321. AlphaTestEnable = true;
  4322. AlphaRef = 0x80;
  4323. AlphaFunc = Greater;
  4324. #endif
  4325.  
  4326. VertexShader = compile vs_1_1 BloatingNormalMappedVS();
  4327. PixelShader = compile ps_2_0 NormalMappedPS(false,false,false, true, d3d_Greater, 0x80 );
  4328. }
  4329. }
  4330.  
  4331. technique BloatingNormalMappedAlpha_LowFidelity
  4332. <
  4333. int fidelity = FIDELITY_LOW;
  4334.  
  4335. string abstractTechnique = "BloatingNormalMappedAlpha";
  4336. string cartographicTechnique = "CartographicUnit";
  4337. string depthTechnique = "UndulatingDepthClip";
  4338.  
  4339. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4340. int parameter = PARAM_FRACTIONCOMPLETE;
  4341. >
  4342. {
  4343. pass P0
  4344. {
  4345. AlphaState( AlphaBlend_Disable_Write_RGB )
  4346. RasterizerState( Rasterizer_Cull_CW )
  4347. DepthState( Depth_Enable )
  4348.  
  4349. #ifndef DIRECT3D10
  4350. AlphaTestEnable = true;
  4351. AlphaRef = 0x80;
  4352. AlphaFunc = Greater;
  4353. #endif
  4354.  
  4355. VertexShader = compile vs_1_1 BloatingVertexNormalVS();
  4356. PixelShader = compile ps_2_0 VertexNormalPS_LowFidelity( true, d3d_Greater, 0x80 );
  4357. }
  4358. }
  4359.  
  4360. /// BlackenedNormalMappedAlpha
  4361. ///
  4362. /// Blackened normal mapped with alpha test. No color mask or glow.
  4363. technique BlackenedNormalMappedAlpha_HighFidelity
  4364. <
  4365. int fidelity = FIDELITY_HIGH;
  4366.  
  4367. string abstractTechnique = "BlackenedNormalMappedAlpha";
  4368. string cartographicTechnique = "CartographicFeature";
  4369. string depthTechnique = "DepthClip";
  4370.  
  4371. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4372. int parameter = PARAM_FRACTIONCOMPLETE;
  4373. >
  4374. {
  4375. pass P0
  4376. {
  4377. AlphaState( AlphaBlend_Disable_Write_RGB )
  4378. RasterizerState( Rasterizer_Cull_CW )
  4379. DepthState( Depth_Enable )
  4380.  
  4381. #ifndef DIRECT3D10
  4382. AlphaTestEnable = true;
  4383. AlphaRef = 0x80;
  4384. AlphaFunc = Greater;
  4385. #endif
  4386.  
  4387. VertexShader = compile vs_1_1 NormalMappedVS();
  4388. PixelShader = compile ps_2_a BlackenedNormalMappedPS(false,false,true, true, d3d_Greater, 0x80 );
  4389. }
  4390. }
  4391.  
  4392. technique BlackenedNormalMappedAlpha_MedFidelity
  4393. <
  4394. int fidelity = FIDELITY_MEDIUM;
  4395.  
  4396. string abstractTechnique = "BlackenedNormalMappedAlpha";
  4397. string cartographicTechnique = "CartographicFeature";
  4398. string depthTechnique = "DepthClip";
  4399.  
  4400. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4401. int parameter = PARAM_FRACTIONCOMPLETE;
  4402. >
  4403. {
  4404. pass P0
  4405. {
  4406. AlphaState( AlphaBlend_Disable_Write_RGB )
  4407. RasterizerState( Rasterizer_Cull_CW )
  4408. DepthState( Depth_Enable )
  4409.  
  4410. #ifndef DIRECT3D10
  4411. AlphaTestEnable = true;
  4412. AlphaRef = 0x80;
  4413. AlphaFunc = Greater;
  4414. #endif
  4415.  
  4416. VertexShader = compile vs_1_1 NormalMappedVS();
  4417. PixelShader = compile ps_2_0 BlackenedNormalMappedPS(false,false,false, true, d3d_Greater, 0x80 );
  4418. }
  4419. }
  4420.  
  4421. technique BlackenedNormalMappedAlpha_LowFidelity
  4422. <
  4423. int fidelity = FIDELITY_LOW;
  4424.  
  4425. string abstractTechnique = "BlackenedNormalMappedAlpha";
  4426. string cartographicTechnique = "CartographicFeature";
  4427. string depthTechnique = "DepthClip";
  4428.  
  4429. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_POSTWATER + STAGE_PREEFFECT;
  4430. int parameter = PARAM_FRACTIONCOMPLETE;
  4431. >
  4432. {
  4433. pass P0
  4434. {
  4435. AlphaState( AlphaBlend_Disable_Write_RGB )
  4436. RasterizerState( Rasterizer_Cull_CW )
  4437. DepthState( Depth_Enable )
  4438.  
  4439. #ifndef DIRECT3D10
  4440. AlphaTestEnable = true;
  4441. AlphaRef = 0x80;
  4442. AlphaFunc = Greater;
  4443. #endif
  4444.  
  4445. VertexShader = compile vs_1_1 VertexNormalVS();
  4446. PixelShader = compile ps_2_0 BlackenedLoFiPS( true, d3d_Greater, 0x80 );
  4447. }
  4448. }
  4449.  
  4450. /// NormalMappedGlow
  4451. ///
  4452. /// Normal mapped with glow. No color mask or alpha.
  4453. technique NormalMappedGlow_HighFidelity
  4454. <
  4455. int fidelity = FIDELITY_HIGH;
  4456.  
  4457. string abstractTechnique = "NormalMappedGlow";
  4458. string cartographicTechnique = "CartographicFeature";
  4459. string depthTechnique = "Depth";
  4460.  
  4461. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  4462. int parameter = PARAM_FRACTIONCOMPLETE;
  4463. >
  4464. {
  4465. pass P0
  4466. {
  4467. AlphaState( AlphaBlend_Disable_Write_RGBA )
  4468. RasterizerState( Rasterizer_Cull_CW )
  4469. DepthState( Depth_Enable )
  4470.  
  4471. #ifndef DIRECT3D10
  4472. AlphaTestEnable = false;
  4473. #endif
  4474.  
  4475. VertexShader = compile vs_1_1 NormalMappedVS();
  4476. PixelShader = compile ps_2_a NormalMappedPS(false,true,true, false,0,0 );
  4477. }
  4478. }
  4479.  
  4480. /// MapImager
  4481. ///
  4482. ///
  4483. technique MapImager_LowFi
  4484. <
  4485. string abstractTechnique = "MapImager";
  4486. int fidelity = FIDELITY_LOW;
  4487.  
  4488. int renderStage = STAGE_PREWATER + STAGE_PREEFFECT;
  4489. int parameter = PARAM_FRACTIONCOMPLETE;
  4490. >
  4491. {
  4492. pass P0
  4493. {
  4494. RasterizerState( Rasterizer_Cull_CW )
  4495. DepthState( Depth_Enable )
  4496.  
  4497. VertexShader = compile vs_1_1 NormalMappedVS();
  4498. PixelShader = compile ps_2_0 MapImagerPS0();
  4499. }
  4500. pass P1
  4501. {
  4502. AlphaState( AlphaBlend_Disable_Write_A )
  4503. RasterizerState( Rasterizer_Cull_CW )
  4504. DepthState( Depth_Enable )
  4505.  
  4506. VertexShader = compile vs_1_1 NormalMappedVS();
  4507. PixelShader = compile ps_2_0 MapImagerPS1();
  4508. }
  4509. }
  4510.  
  4511. technique NormalMappedGlow_MedFidelity
  4512. <
  4513. string abstractTechnique = "NormalMappedGlow";
  4514. int fidelity = FIDELITY_MEDIUM;
  4515.  
  4516. string cartographicTechnique = "CartographicFeature";
  4517. string depthTechnique = "Depth";
  4518. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  4519. int parameter = PARAM_FRACTIONCOMPLETE;
  4520. >
  4521. {
  4522. pass P0
  4523. {
  4524. AlphaState( AlphaBlend_Disable_Write_RGBA )
  4525. RasterizerState( Rasterizer_Cull_CW )
  4526. DepthState( Depth_Enable )
  4527.  
  4528. #ifndef DIRECT3D10
  4529. AlphaTestEnable = false;
  4530. #endif
  4531.  
  4532. VertexShader = compile vs_1_1 NormalMappedVS();
  4533. PixelShader = compile ps_2_0 NormalMappedPS(false,true,false, false,0,0 );
  4534. }
  4535. }
  4536.  
  4537. technique NormalMappedGlow_LowFidelity
  4538. <
  4539. string abstractTechnique = "NormalMappedGlow";
  4540. int fidelity = FIDELITY_LOW;
  4541.  
  4542. string cartographicTechnique = "CartographicFeature";
  4543. string depthTechnique = "Depth";
  4544. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  4545. int parameter = PARAM_FRACTIONCOMPLETE;
  4546. >
  4547. {
  4548. pass P0
  4549. {
  4550. AlphaState( AlphaBlend_Disable_Write_RGBA )
  4551. RasterizerState( Rasterizer_Cull_CW )
  4552. DepthState( Depth_Enable )
  4553.  
  4554. #ifndef DIRECT3D10
  4555. AlphaTestEnable = false;
  4556. #endif
  4557.  
  4558. VertexShader = compile vs_1_1 VertexNormalVS();
  4559. PixelShader = compile ps_2_0 VertexNormalPS_LowFidelity(false,0,0);
  4560. }
  4561. }
  4562.  
  4563. /// Clutter
  4564. ///
  4565. ///
  4566. technique Clutter
  4567. <
  4568. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  4569. int parameter = PARAM_UNUSED;
  4570. >
  4571. {
  4572. pass P0
  4573. {
  4574. AlphaState( AlphaBlend_Disable_Write_RGB )
  4575. RasterizerState( Rasterizer_Cull_CW )
  4576. DepthState( Depth_Enable_Less )
  4577.  
  4578. #ifndef DIRECT3D10
  4579. AlphaTestEnable = true;
  4580. AlphaRef = 0x70;
  4581. AlphaFunc = Greater;
  4582. #endif
  4583.  
  4584. VertexShader = compile vs_1_1 ClutterVS();
  4585. PixelShader = compile ps_2_0 ClutterPS( true, d3d_Greater, 0x03 );
  4586. }
  4587. }
  4588.  
  4589. /// Clutter
  4590. ///
  4591. ///
  4592. technique UnderwaterClutter
  4593. <
  4594. int renderStage = STAGE_PREWATER + STAGE_POSTEFFECT;
  4595. int parameter = PARAM_UNUSED;
  4596. >
  4597. {
  4598. pass P0
  4599. {
  4600. AlphaState( AlphaBlend_Disable_Write_RGB )
  4601. RasterizerState( Rasterizer_Cull_CW )
  4602. DepthState( Depth_Enable_Less )
  4603.  
  4604. #ifndef DIRECT3D10
  4605. AlphaTestEnable = true;
  4606. AlphaRef = 0x70;
  4607. AlphaFunc = Greater;
  4608. #endif
  4609.  
  4610. VertexShader = compile vs_1_1 ClutterVS();
  4611. PixelShader = compile ps_2_0 ClutterPS( true, d3d_Greater, 0x70 );
  4612. }
  4613. }
  4614.  
  4615. /// UndulatingClutter
  4616. ///
  4617. ///
  4618. technique UndulatingClutter
  4619. <
  4620. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  4621. int parameter = PARAM_UNUSED;
  4622. >
  4623. {
  4624. pass P0
  4625. {
  4626. AlphaState( AlphaBlend_Disable_Write_RGB )
  4627. RasterizerState( Rasterizer_Cull_CW )
  4628. DepthState( Depth_Enable_Less )
  4629.  
  4630. #ifndef DIRECT3D10
  4631. AlphaTestEnable = true;
  4632. AlphaRef = 0x70;
  4633. AlphaFunc = Greater;
  4634. #endif
  4635.  
  4636. VertexShader = compile vs_1_1 UndulatingClutterVS();
  4637. PixelShader = compile ps_2_0 ClutterPS( true, d3d_Greater, 0x70 );
  4638. }
  4639. }
  4640.  
  4641. /// UnderwaterUndulatingClutter
  4642. ///
  4643. ///
  4644. technique UnderwaterUndulatingClutter
  4645. <
  4646. int renderStage = STAGE_PREWATER + STAGE_POSTEFFECT;
  4647. int parameter = PARAM_UNUSED;
  4648. >
  4649. {
  4650. pass P0
  4651. {
  4652. AlphaState( AlphaBlend_Disable_Write_RGB )
  4653. RasterizerState( Rasterizer_Cull_CW )
  4654. DepthState( Depth_Enable_Less )
  4655.  
  4656. #ifndef DIRECT3D10
  4657. AlphaTestEnable = true;
  4658. AlphaRef = 0x70;
  4659. AlphaFunc = Greater;
  4660. #endif
  4661.  
  4662. VertexShader = compile vs_1_1 UndulatingClutterVS();
  4663. PixelShader = compile ps_2_0 ClutterPS( true, d3d_Greater, 0x70 );
  4664. }
  4665. }
  4666.  
  4667. /// NormalMappedTerrain
  4668. ///
  4669. ///
  4670. technique NormalMappedTerrain
  4671. <
  4672. string depthTechnique = "Depth";
  4673. string cartographicTechnique = "CartographicFeature";
  4674. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  4675. int parameter = PARAM_UNUSED;
  4676. >
  4677. {
  4678. pass P0
  4679. {
  4680. AlphaState( AlphaBlend_Disable_Write_RGBA )
  4681. RasterizerState( Rasterizer_Cull_CW )
  4682. DepthState( Depth_Enable_Less )
  4683.  
  4684. #ifndef DIRECT3D10
  4685. AlphaTestEnable = false;
  4686. #endif
  4687.  
  4688. VertexShader = compile vs_1_1 NormalMappedVS();
  4689. PixelShader = compile ps_2_0 NormalMappedTerrainPS();
  4690. }
  4691. }
  4692.  
  4693. /// Unit
  4694. ///
  4695. /// Basic unit techniques.
  4696. technique Unit_HighFidelity
  4697. <
  4698. string abstractTechnique = "Unit";
  4699. int fidelity = FIDELITY_HIGH;
  4700.  
  4701. string cartographicTechnique = "CartographicUnit";
  4702. string depthTechnique = "Depth";
  4703. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  4704. int parameter = PARAM_FRACTIONCOMPLETE;
  4705. >
  4706. {
  4707. pass P0
  4708. {
  4709. RasterizerState( Rasterizer_Cull_CW )
  4710.  
  4711. VertexShader = compile vs_1_1 NormalMappedVS();
  4712. PixelShader = compile ps_2_a NormalMappedPS(true,true,true, false,0,0 );
  4713. }
  4714. }
  4715.  
  4716. technique Unit_MedFidelity
  4717. <
  4718. string abstractTechnique = "Unit";
  4719. int fidelity = FIDELITY_MEDIUM;
  4720.  
  4721. string cartographicTechnique = "CartographicUnit";
  4722. string depthTechnique = "Depth";
  4723. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  4724. int parameter = PARAM_FRACTIONCOMPLETE;
  4725. >
  4726. {
  4727. pass P0
  4728. {
  4729. RasterizerState( Rasterizer_Cull_CW )
  4730.  
  4731. VertexShader = compile vs_1_1 NormalMappedVS();
  4732. PixelShader = compile ps_2_0 NormalMappedPS(true,true,false, false,0,0 );
  4733. }
  4734. }
  4735.  
  4736. technique Unit_LowFidelity
  4737. <
  4738. string abstractTechnique = "Unit";
  4739. int fidelity = FIDELITY_LOW;
  4740.  
  4741. string cartographicTechnique = "CartographicUnit";
  4742. string depthTechnique = "Depth";
  4743. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  4744. int parameter = PARAM_FRACTIONCOMPLETE;
  4745. >
  4746. {
  4747. pass P0
  4748. {
  4749. AlphaState( AlphaBlend_Disable_Write_RGB )
  4750. RasterizerState( Rasterizer_Cull_CW )
  4751.  
  4752. VertexShader = compile vs_1_1 VertexNormalVS();
  4753. PixelShader = compile ps_2_0 ColorMaskPS_LowFidelity();
  4754. }
  4755. }
  4756.  
  4757. /// AlphaFade
  4758. ///
  4759. ///
  4760. technique AlphaFade_HighFidelity
  4761. <
  4762. string abstractTechnique = "AlphaFade";
  4763. int fidelity = FIDELITY_HIGH;
  4764.  
  4765. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4766. int parameter = PARAM_FRACTIONCOMPLETE;
  4767. >
  4768. {
  4769. pass P0
  4770. {
  4771. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  4772. RasterizerState( Rasterizer_Cull_CW )
  4773. DepthState( Depth_Enable_Less )
  4774.  
  4775. #ifndef DIRECT3D10
  4776. AlphaTestEnable = true;
  4777. AlphaRef = 0x23;
  4778. AlphaFunc = Greater;
  4779. #endif
  4780.  
  4781. VertexShader = compile vs_1_1 VertexNormalVS();
  4782. PixelShader = compile ps_2_a AlphaFadePS( 2.0, 0.145, true, true, d3d_Greater, 0x23 );
  4783. }
  4784. }
  4785.  
  4786. technique AlphaFade_MedFidelity
  4787. <
  4788. string abstractTechnique = "AlphaFade";
  4789. int fidelity = FIDELITY_MEDIUM;
  4790.  
  4791. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4792. int parameter = PARAM_FRACTIONCOMPLETE;
  4793. >
  4794. {
  4795. pass P0
  4796. {
  4797. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  4798. RasterizerState( Rasterizer_Cull_CW )
  4799. DepthState( Depth_Enable_Less )
  4800.  
  4801. #ifndef DIRECT3D10
  4802. AlphaTestEnable = true;
  4803. AlphaRef = 0x23;
  4804. AlphaFunc = Greater;
  4805. #endif
  4806.  
  4807. VertexShader = compile vs_1_1 VertexNormalVS();
  4808. PixelShader = compile ps_2_0 AlphaFadePS( 2.0, 0.145, false, true, d3d_Greater, 0x23 );
  4809. }
  4810. }
  4811.  
  4812. technique AlphaFade_LowFidelity
  4813. <
  4814. string abstractTechnique = "AlphaFade";
  4815. int fidelity = FIDELITY_LOW;
  4816.  
  4817. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4818. int parameter = PARAM_FRACTIONCOMPLETE;
  4819. >
  4820. {
  4821. pass P0
  4822. {
  4823. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  4824. RasterizerState( Rasterizer_Cull_CW )
  4825. DepthState( Depth_Enable_Less )
  4826.  
  4827. #ifndef DIRECT3D10
  4828. AlphaTestEnable = true;
  4829. AlphaRef = 0x23;
  4830. AlphaFunc = Greater;
  4831. #endif
  4832.  
  4833. VertexShader = compile vs_1_1 VertexNormalVS();
  4834. PixelShader = compile ps_2_0 AlphaFadeLoFiPS( 2.0, 0.145, true, d3d_Greater, 0x23 );
  4835. }
  4836. }
  4837.  
  4838. technique CommandFeedback
  4839. <
  4840. string cartographicTechnique = "CartographicFeedback";
  4841.  
  4842. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4843. int parameter = PARAM_LIFETIME;
  4844. >
  4845. {
  4846. pass P0
  4847. {
  4848. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB ) // if RGBA is written, then you get glow, just RGB is no glow
  4849. RasterizerState( Rasterizer_Cull_CW )
  4850. DepthState( Depth_Disable )
  4851.  
  4852. #ifndef DIRECT3D10
  4853. AlphaTestEnable = true;
  4854. AlphaRef = 0x23;
  4855. AlphaFunc = Greater;
  4856. #endif
  4857.  
  4858. VertexShader = compile vs_1_1 CommandFeedbackVS(0.7);
  4859. PixelShader = compile ps_2_0 CommandFeedbackPS0(true);
  4860. }
  4861. }
  4862.  
  4863. technique RallyPoint
  4864. <
  4865. string cartographicTechnique = "CartographicFeedback";
  4866.  
  4867. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4868. int parameter = PARAM_LIFETIME;
  4869. >
  4870. {
  4871. pass P0
  4872. {
  4873. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB ) // if RGBA is written, then you get glow, just RGB is no glow
  4874. RasterizerState( Rasterizer_Cull_CW )
  4875. DepthState( Depth_Disable )
  4876.  
  4877. #ifndef DIRECT3D10
  4878. AlphaTestEnable = true;
  4879. AlphaRef = 0x23;
  4880. AlphaFunc = Greater;
  4881. #endif
  4882.  
  4883. VertexShader = compile vs_1_1 CommandFeedbackVS(0.7);
  4884. PixelShader = compile ps_2_0 CommandFeedbackPS0(false);
  4885. }
  4886. }
  4887.  
  4888. technique CommandFeedback2
  4889. <
  4890. string cartographicTechnique = "CartographicFeedback";
  4891.  
  4892. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4893. int parameter = PARAM_LIFETIME;
  4894. >
  4895. {
  4896. pass P0
  4897. {
  4898. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB ) // if RGBA is written, then you get glow, just RGB is no glow
  4899. RasterizerState( Rasterizer_Cull_CW )
  4900. DepthState( Depth_Disable )
  4901.  
  4902. #ifndef DIRECT3D10
  4903. AlphaTestEnable = true;
  4904. AlphaRef = 0x23;
  4905. AlphaFunc = Greater;
  4906. #endif
  4907.  
  4908. VertexShader = compile vs_1_1 CommandFeedbackVS(1.1);
  4909. PixelShader = compile ps_2_0 CommandFeedbackPS0(true);
  4910. }
  4911. }
  4912.  
  4913. technique CommandFeedback3
  4914. <
  4915. string cartographicTechnique = "CartographicFeedback";
  4916.  
  4917. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4918. int parameter = PARAM_UNUSED;
  4919. >
  4920. {
  4921. pass P0
  4922. {
  4923. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  4924. RasterizerState( Rasterizer_Cull_CW )
  4925. DepthState( Depth_Disable )
  4926.  
  4927. VertexShader = compile vs_1_1 VertexNormalVS();
  4928. PixelShader = compile ps_2_0 CommandFeedbackPS0(false);
  4929. }
  4930. }
  4931.  
  4932. technique CommandFeedback4
  4933. <
  4934. string cartographicTechnique = "CartographicFeedback";
  4935.  
  4936. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  4937. int parameter = PARAM_UNUSED;
  4938. >
  4939. {
  4940. pass P0
  4941. {
  4942. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  4943. RasterizerState( Rasterizer_Cull_CW )
  4944. DepthState( Depth_Enable_LessEqual_Write_None )
  4945.  
  4946. DepthBias = -0.0001;
  4947.  
  4948. VertexShader = compile vs_1_1 VertexNormalVS();
  4949. PixelShader = compile ps_2_0 CommandFeedbackPS0(false);
  4950. }
  4951. }
  4952.  
  4953. /// UnitPlace
  4954. ///
  4955. ///
  4956. technique UnitPlace_LowFidelity
  4957. <
  4958. int fidelity = FIDELITY_LOW;
  4959.  
  4960. string abstractTechnique = "UnitPlace";
  4961. string cartographicTechnique = "CartographicPlace";
  4962. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  4963.  
  4964. int parameter = PARAM_FRACTIONCOMPLETE;
  4965. >
  4966. {
  4967. pass P0
  4968. {
  4969. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  4970. RasterizerState( Rasterizer_Cull_CW )
  4971. DepthState( Depth_Enable_Less )
  4972.  
  4973. VertexShader = compile vs_1_1 PositionNormalOffsetVS(0.05);
  4974. PixelShader = compile ps_2_0 UnitPlacePS();
  4975. }
  4976.  
  4977. }
  4978.  
  4979. /// UnitFormationPreview
  4980. ///
  4981. ///
  4982. technique UnitFormationPreview_LowFidelity
  4983. <
  4984. string abstractTechnique = "UnitFormationPreview";
  4985. int fidelity = FIDELITY_LOW;
  4986.  
  4987. string cartographicTechnique = "CartographicPlace";
  4988. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  4989. int parameter = PARAM_FRACTIONCOMPLETE;
  4990. >
  4991. {
  4992. pass P0
  4993. {
  4994. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  4995. RasterizerState( Rasterizer_Cull_CW )
  4996. DepthState( Depth_Enable_Less )
  4997.  
  4998. VertexShader = compile vs_1_1 VertexNormalVS();
  4999. PixelShader = compile ps_2_0 UnitPlacePS(); // Just use UnitPlace for now
  5000. }
  5001. }
  5002.  
  5003. /// Metal
  5004. ///
  5005. ///
  5006. technique Metal_HighFidelity
  5007. <
  5008. string abstractTechnique = "Metal";
  5009. int fidelity = FIDELITY_HIGH;
  5010.  
  5011. string cartographicTechnique = "CartographicUnit";
  5012. string depthTechnique = "Depth";
  5013. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5014. int parameter = PARAM_FRACTIONCOMPLETE;
  5015. >
  5016. {
  5017. pass P0
  5018. {
  5019. RasterizerState( Rasterizer_Cull_CW )
  5020.  
  5021. VertexShader = compile vs_1_1 NormalMappedVS();
  5022. PixelShader = compile ps_2_a NormalMappedMetalPS(true);
  5023. }
  5024. }
  5025.  
  5026. technique Metal_MedFidelity
  5027. <
  5028. string abstractTechnique = "Metal";
  5029. int fidelity = FIDELITY_MEDIUM;
  5030.  
  5031. string cartographicTechnique = "CartographicUnit";
  5032. string depthTechnique = "Depth";
  5033. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5034. int parameter = PARAM_FRACTIONCOMPLETE;
  5035. >
  5036. {
  5037. pass P0
  5038. {
  5039. RasterizerState( Rasterizer_Cull_CW )
  5040.  
  5041. VertexShader = compile vs_1_1 NormalMappedVS();
  5042. PixelShader = compile ps_2_0 NormalMappedMetalPS(false);
  5043. }
  5044. }
  5045.  
  5046. technique Metal_LowFidelity
  5047. <
  5048. string abstractTechnique = "Metal";
  5049. int fidelity = FIDELITY_LOW;
  5050.  
  5051. string cartographicTechnique = "CartographicUnit";
  5052. string depthTechnique = "Depth";
  5053. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5054. int parameter = PARAM_FRACTIONCOMPLETE;
  5055. >
  5056. {
  5057. pass P0
  5058. {
  5059. AlphaState( AlphaBlend_Disable_Write_RGB )
  5060. RasterizerState( Rasterizer_Cull_CW )
  5061.  
  5062. VertexShader = compile vs_1_1 VertexNormalVS();
  5063. PixelShader = compile ps_2_0 ColorMaskPS_LowFidelity();
  5064. }
  5065. }
  5066.  
  5067. /// Insect
  5068. ///
  5069. ///
  5070. technique Insect_HighFidelity
  5071. <
  5072. string abstractTechnique = "Insect";
  5073. int fidelity = FIDELITY_HIGH;
  5074.  
  5075. string cartographicTechnique = "CartographicUnit";
  5076. string depthTechnique = "Depth";
  5077. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5078. int parameter = PARAM_FRACTIONCOMPLETE;
  5079. >
  5080. {
  5081. pass P0
  5082. {
  5083. RasterizerState( Rasterizer_Cull_CW )
  5084.  
  5085. VertexShader = compile vs_1_1 NormalMappedVS();
  5086. PixelShader = compile ps_2_a NormalMappedInsectPS(true);
  5087. }
  5088. }
  5089.  
  5090. technique Insect_MedFidelity
  5091. <
  5092. string abstractTechnique = "Insect";
  5093. int fidelity = FIDELITY_MEDIUM;
  5094.  
  5095. string cartographicTechnique = "CartographicUnit";
  5096. string depthTechnique = "Depth";
  5097. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5098. int parameter = PARAM_FRACTIONCOMPLETE;
  5099. >
  5100. {
  5101. pass P0
  5102. {
  5103. RasterizerState( Rasterizer_Cull_CW )
  5104.  
  5105. VertexShader = compile vs_1_1 NormalMappedVS();
  5106. PixelShader = compile ps_2_0 NormalMappedInsectPS(false);
  5107. }
  5108. }
  5109.  
  5110. technique Insect_LowFidelity
  5111. <
  5112. string abstractTechnique = "Insect";
  5113. int fidelity = FIDELITY_LOW;
  5114.  
  5115. string cartographicTechnique = "CartographicUnit";
  5116. string depthTechnique = "Depth";
  5117. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5118. int parameter = PARAM_FRACTIONCOMPLETE;
  5119. >
  5120. {
  5121. pass P0
  5122. {
  5123. AlphaState( AlphaBlend_Disable_Write_RGB )
  5124. RasterizerState( Rasterizer_Cull_CW )
  5125.  
  5126. VertexShader = compile vs_1_1 VertexNormalVS();
  5127. PixelShader = compile ps_2_0 ColorMaskPS_LowFidelity();
  5128. }
  5129. }
  5130.  
  5131. /// Aeon
  5132. ///
  5133. ///
  5134. technique Aeon_HighFidelity
  5135. <
  5136. string abstractTechnique = "Aeon";
  5137. int fidelity = FIDELITY_HIGH;
  5138.  
  5139. string cartographicTechnique = "CartographicUnit";
  5140. string depthTechnique = "Depth";
  5141. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5142. int parameter = PARAM_FRACTIONCOMPLETE;
  5143.  
  5144. string environment = "<aeon>";
  5145. >
  5146. {
  5147. pass P0
  5148. {
  5149. RasterizerState( Rasterizer_Cull_CW )
  5150.  
  5151. VertexShader = compile vs_1_1 NormalMappedVS();
  5152. PixelShader = compile ps_2_a AeonPS(true);
  5153. }
  5154. }
  5155.  
  5156. technique Aeon_MedFidelity
  5157. <
  5158. string abstractTechnique = "Aeon";
  5159. int fidelity = FIDELITY_MEDIUM;
  5160.  
  5161. string cartographicTechnique = "CartographicUnit";
  5162. string depthTechnique = "Depth";
  5163. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5164. int parameter = PARAM_FRACTIONCOMPLETE;
  5165. >
  5166. {
  5167. pass P0
  5168. {
  5169. RasterizerState( Rasterizer_Cull_CW )
  5170.  
  5171. VertexShader = compile vs_1_1 NormalMappedVS();
  5172. PixelShader = compile ps_2_0 AeonPS(false);
  5173. }
  5174. }
  5175.  
  5176. technique Aeon_LowFidelity
  5177. <
  5178. string abstractTechnique = "Aeon";
  5179. int fidelity = FIDELITY_LOW;
  5180.  
  5181. string cartographicTechnique = "CartographicUnit";
  5182. string depthTechnique = "Depth";
  5183. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5184. int parameter = PARAM_FRACTIONCOMPLETE;
  5185. >
  5186. {
  5187. pass P0
  5188. {
  5189. AlphaState( AlphaBlend_Disable_Write_RGB )
  5190. RasterizerState( Rasterizer_Cull_CW )
  5191.  
  5192. VertexShader = compile vs_1_1 VertexNormalVS();
  5193. PixelShader = compile ps_2_0 ColorMaskPS_LowFidelity();
  5194. }
  5195. }
  5196.  
  5197. /// Seraphim
  5198. ///
  5199. ///
  5200. technique Seraphim_HighFidelity
  5201. <
  5202. string abstractTechnique = "Seraphim";
  5203. int fidelity = FIDELITY_HIGH;
  5204.  
  5205.  
  5206. string cartographicTechnique = "CartographicUnit";
  5207. string depthTechnique = "Depth";
  5208.  
  5209. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5210. int parameter = PARAM_FRACTIONCOMPLETE;
  5211.  
  5212. string environment = "<seraphim>";
  5213.  
  5214. >
  5215. {
  5216. pass P0
  5217. {
  5218. RasterizerState( Rasterizer_Cull_CW )
  5219.  
  5220. VertexShader = compile vs_1_1 UnitFalloffVS();
  5221. PixelShader = compile ps_2_a UnitFalloffPS(true);
  5222. }
  5223. }
  5224.  
  5225. technique Seraphim_MedFidelity
  5226. <
  5227. string abstractTechnique = "Seraphim";
  5228. int fidelity = FIDELITY_MEDIUM;
  5229.  
  5230. string cartographicTechnique = "CartographicUnit";
  5231. string depthTechnique = "Depth";
  5232.  
  5233. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5234. int parameter = PARAM_FRACTIONCOMPLETE;
  5235.  
  5236. string environment = "<seraphim>";
  5237. >
  5238. {
  5239. pass P0
  5240. {
  5241. RasterizerState( Rasterizer_Cull_CW )
  5242.  
  5243. VertexShader = compile vs_1_1 UnitFalloffVS();
  5244. PixelShader = compile ps_2_0 UnitFalloffPS(false);
  5245. }
  5246. }
  5247.  
  5248. technique Seraphim_LowFidelity
  5249. <
  5250. string abstractTechnique = "Seraphim";
  5251. int fidelity = FIDELITY_LOW;
  5252.  
  5253. string cartographicTechnique = "CartographicUnit";
  5254. string depthTechnique = "Depth";
  5255.  
  5256. string environment = "<seraphim>";
  5257.  
  5258. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5259. int parameter = PARAM_FRACTIONCOMPLETE;
  5260. >
  5261. {
  5262. pass P0
  5263. {
  5264. RasterizerState( Rasterizer_Cull_CW )
  5265.  
  5266. VertexShader = compile vs_1_1 NormalMappedVS();
  5267. PixelShader = compile ps_2_0 LowFiUnitFalloffPS();
  5268. }
  5269. }
  5270.  
  5271.  
  5272. /// AeonCZAR
  5273. ///
  5274. ///
  5275. technique AeonCZAR_HighFidelity
  5276. <
  5277. string abstractTechnique = "AeonCZAR";
  5278. int fidelity = FIDELITY_HIGH;
  5279.  
  5280. string cartographicTechnique = "CartographicUnit";
  5281. string depthTechnique = "Depth";
  5282. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5283. int parameter = PARAM_FRACTIONCOMPLETE;
  5284. >
  5285. {
  5286. pass P0
  5287. {
  5288. RasterizerState( Rasterizer_Cull_CW )
  5289.  
  5290. VertexShader = compile vs_1_1 NormalMappedVS();
  5291. PixelShader = compile ps_2_a AeonCZARPS(true);
  5292. }
  5293. }
  5294.  
  5295. technique AeonCZAR_MedFidelity
  5296. <
  5297. string abstractTechnique = "AeonCZAR";
  5298. int fidelity = FIDELITY_MEDIUM;
  5299.  
  5300. string cartographicTechnique = "CartographicUnit";
  5301. string depthTechnique = "Depth";
  5302. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5303. int parameter = PARAM_FRACTIONCOMPLETE;
  5304. >
  5305. {
  5306. pass P0
  5307. {
  5308. RasterizerState( Rasterizer_Cull_CW )
  5309.  
  5310. VertexShader = compile vs_1_1 NormalMappedVS();
  5311. PixelShader = compile ps_2_0 AeonPS(false);
  5312. }
  5313. }
  5314.  
  5315. technique AeonCZAR_LowFidelity
  5316. <
  5317. string abstractTechnique = "AeonCZAR";
  5318. int fidelity = FIDELITY_LOW;
  5319.  
  5320. string cartographicTechnique = "CartographicUnit";
  5321. string depthTechnique = "Depth";
  5322. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5323. int parameter = PARAM_FRACTIONCOMPLETE;
  5324. >
  5325. {
  5326. pass P0
  5327. {
  5328. AlphaState( AlphaBlend_Disable_Write_RGB )
  5329. RasterizerState( Rasterizer_Cull_CW )
  5330.  
  5331. VertexShader = compile vs_1_1 VertexNormalVS();
  5332. PixelShader = compile ps_2_0 ColorMaskPS_LowFidelity();
  5333. }
  5334. }
  5335.  
  5336. /// AeonBuild
  5337. ///
  5338. ///
  5339. technique AeonBuild_HighFidelity
  5340. <
  5341. string abstractTechnique = "AeonBuild";
  5342. int fidelity = FIDELITY_HIGH;
  5343.  
  5344. string cartographicTechnique = "CartographicBuild";
  5345. int renderStage = STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5346. int parameter = PARAM_FRACTIONCOMPLETE;
  5347. >
  5348. {
  5349. pass P0
  5350. {
  5351. RasterizerState( Rasterizer_Cull_CW )
  5352. AlphaState( AlphaBlend_Disable_Write_RGB )
  5353.  
  5354. VertexShader = compile vs_1_1 AeonBuildVS();
  5355. PixelShader = compile ps_2_a AeonBuildPS(true);
  5356. }
  5357. pass P1
  5358. {
  5359. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5360. RasterizerState( Rasterizer_Cull_CW )
  5361.  
  5362. VertexShader = compile vs_1_1 AeonBuildVS();
  5363. PixelShader = compile ps_2_0 AeonBuildOverlayPS();
  5364. }
  5365. }
  5366.  
  5367. technique AeonBuild_MedFidelity
  5368. <
  5369. string abstractTechnique = "AeonBuild";
  5370. int fidelity = FIDELITY_MEDIUM;
  5371.  
  5372. string cartographicTechnique = "CartographicBuild";
  5373. int renderStage = STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5374. int parameter = PARAM_FRACTIONCOMPLETE;
  5375. >
  5376. {
  5377. pass P0
  5378. {
  5379. RasterizerState( Rasterizer_Cull_CW )
  5380. AlphaState( AlphaBlend_Disable_Write_RGB )
  5381.  
  5382. VertexShader = compile vs_1_1 AeonBuildVS();
  5383. PixelShader = compile ps_2_0 AeonBuildPS(false);
  5384. }
  5385. pass P1
  5386. {
  5387. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5388. RasterizerState( Rasterizer_Cull_CW )
  5389.  
  5390. VertexShader = compile vs_1_1 AeonBuildVS();
  5391. PixelShader = compile ps_2_0 AeonBuildOverlayPS();
  5392. }
  5393. }
  5394.  
  5395. technique AeonBuild_LowFidelity
  5396. <
  5397. string abstractTechnique = "AeonBuild";
  5398. int fidelity = FIDELITY_LOW;
  5399.  
  5400. string cartographicTechnique = "CartographicBuild";
  5401. int renderStage = STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5402. int parameter = PARAM_FRACTIONCOMPLETE;
  5403. >
  5404. {
  5405. pass P0
  5406. {
  5407. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5408. RasterizerState( Rasterizer_Cull_CW )
  5409.  
  5410. VertexShader = compile vs_1_1 AeonBuildLoFiVS(1,1,0,0,0,0);
  5411. PixelShader = compile ps_2_0 ColorMaskPS_LowFidelity();
  5412. }
  5413. }
  5414.  
  5415. /// AeonBuildPuddle
  5416. ///
  5417. ///
  5418. technique AeonBuildPuddle_HighFidelity
  5419. <
  5420. string abstractTechnique = "AeonBuildPuddle";
  5421. int fidelity = FIDELITY_HIGH;
  5422.  
  5423. string depthTechnique = "Depth";
  5424. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5425. int parameter = PARAM_FRACTIONCOMPLETE;
  5426. >
  5427. {
  5428. pass P0
  5429. {
  5430. AlphaState( AlphaBlend_Disable_Write_RGBA )
  5431. RasterizerState( Rasterizer_Cull_CW )
  5432.  
  5433. VertexShader = compile vs_1_1 NormalMappedVS();
  5434. PixelShader = compile ps_2_a AeonBuildPuddlePS(true);
  5435. }
  5436. }
  5437.  
  5438. technique AeonBuildPuddle_MedFidelity
  5439. <
  5440. string abstractTechnique = "AeonBuildPuddle";
  5441. int fidelity = FIDELITY_MEDIUM;
  5442.  
  5443. string depthTechnique = "Depth";
  5444. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5445. int parameter = PARAM_FRACTIONCOMPLETE;
  5446. >
  5447. {
  5448. pass P0
  5449. {
  5450. AlphaState( AlphaBlend_Disable_Write_RGBA )
  5451. RasterizerState( Rasterizer_Cull_CW )
  5452.  
  5453. VertexShader = compile vs_1_1 NormalMappedVS();
  5454. PixelShader = compile ps_2_0 AeonBuildPuddlePS(false);
  5455. }
  5456. }
  5457.  
  5458. technique AeonBuildPuddle_LowFidelity
  5459. <
  5460. string abstractTechnique = "AeonBuildPuddle";
  5461. int fidelity = FIDELITY_LOW;
  5462.  
  5463. string depthTechnique = "Depth";
  5464. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5465. int parameter = PARAM_FRACTIONCOMPLETE;
  5466. >
  5467. {
  5468. pass P0
  5469. {
  5470. AlphaState( AlphaBlend_Disable_Write_RGB )
  5471. RasterizerState( Rasterizer_Cull_CW )
  5472.  
  5473. VertexShader = compile vs_1_1 EffectVertexNormalLoFiVS( 1, 1, -0.002, 0.0042, 0, 0 );
  5474. PixelShader = compile ps_2_0 AeonBuildPuddleLoFiPS();
  5475. }
  5476. }
  5477.  
  5478. /// CybranBuild
  5479. ///
  5480. ///
  5481. technique CybranBuild_HighFidelity
  5482. <
  5483. string abstractTechnique = "CybranBuild";
  5484. int fidelity = FIDELITY_HIGH;
  5485.  
  5486. string cartographicTechnique = "CartographicBuild";
  5487. string depthTechnique = "Depth";
  5488. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5489. int parameter = PARAM_FRACTIONCOMPLETE;
  5490. >
  5491. {
  5492. pass P0
  5493. {
  5494. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5495. RasterizerState( Rasterizer_Cull_CW )
  5496.  
  5497. VertexShader = compile vs_1_1 NormalMappedVS();
  5498. PixelShader = compile ps_2_a CybranBuildPS(true);
  5499. }
  5500. pass P1
  5501. {
  5502. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5503. RasterizerState( Rasterizer_Cull_CW )
  5504.  
  5505. VertexShader = compile vs_1_1 EffectVertexNormalLoFiVS( 14, 4, 0, 0, -0.008, 0.008 );
  5506. PixelShader = compile ps_2_0 CybranBuildOverlayPS();
  5507. }
  5508. }
  5509.  
  5510. technique CybranBuild_MedFidelity
  5511. <
  5512. string abstractTechnique = "CybranBuild";
  5513. int fidelity = FIDELITY_MEDIUM;
  5514.  
  5515. string cartographicTechnique = "CartographicBuild";
  5516. string depthTechnique = "Depth";
  5517. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5518. int parameter = PARAM_FRACTIONCOMPLETE;
  5519. >
  5520. {
  5521. pass P0
  5522. {
  5523. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5524. RasterizerState( Rasterizer_Cull_CW )
  5525.  
  5526. VertexShader = compile vs_1_1 NormalMappedVS();
  5527. PixelShader = compile ps_2_0 CybranBuildPS(false);
  5528. }
  5529. pass P1
  5530. {
  5531. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5532. RasterizerState( Rasterizer_Cull_CW )
  5533.  
  5534. VertexShader = compile vs_1_1 EffectVertexNormalLoFiVS( 14, 4, 0, 0, -0.008, 0.008 );
  5535. PixelShader = compile ps_2_0 CybranBuildOverlayPS();
  5536. }
  5537. }
  5538.  
  5539. technique CybranBuild_LowFidelity
  5540. <
  5541. string abstractTechnique = "CybranBuild";
  5542. int fidelity = FIDELITY_LOW;
  5543.  
  5544. string cartographicTechnique = "CartographicBuild";
  5545. string depthTechnique = "Depth";
  5546. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5547. int parameter = PARAM_FRACTIONCOMPLETE;
  5548. >
  5549. {
  5550. pass P0
  5551. {
  5552. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5553. RasterizerState( Rasterizer_Cull_CW )
  5554.  
  5555. VertexShader = compile vs_1_1 VertexNormalVS();
  5556. PixelShader = compile ps_2_0 CybranBuildLoFiPS();
  5557. }
  5558. pass P1
  5559. {
  5560. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5561.  
  5562. VertexShader = compile vs_1_1 EffectVertexNormalLoFiVS( 14, 4, 0, 0, -0.008, 0.008 );
  5563. PixelShader = compile ps_2_0 CybranBuildOverlayPS();
  5564. }
  5565. }
  5566.  
  5567. /// Seraphim Build
  5568. ///
  5569. ///
  5570. technique SeraphimBuild_MedFidelity
  5571. <
  5572. string abstractTechnique = "SeraphimBuild";
  5573. int fidelity = FIDELITY_MEDIUM;
  5574.  
  5575. string cartographicTechnique = "CartographicBuild";
  5576. string depthTechnique = "SeraphimBuildDepth";
  5577.  
  5578. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5579. int parameter = PARAM_FRACTIONCOMPLETE;
  5580. >
  5581. {
  5582. pass P0
  5583. {
  5584. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5585. RasterizerState( Rasterizer_Cull_CW )
  5586.  
  5587. VertexShader = compile vs_1_1 SeraphimBuildVS();
  5588. PixelShader = compile ps_2_0 SeraphimBuildPS(false);
  5589. }
  5590. }
  5591.  
  5592. technique SeraphimBuild_LowFidelity
  5593. <
  5594. string abstractTechnique = "SeraphimBuild";
  5595. int fidelity = FIDELITY_LOW;
  5596.  
  5597. string cartographicTechnique = "CartographicBuild";
  5598. string depthTechnique = "SeraphimBuildDepth";
  5599.  
  5600. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5601. int parameter = PARAM_FRACTIONCOMPLETE;
  5602. >
  5603. {
  5604. pass P0
  5605. {
  5606. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5607. RasterizerState( Rasterizer_Cull_CW )
  5608.  
  5609. VertexShader = compile vs_1_1 SeraphimBuildLofiVS();
  5610. PixelShader = compile ps_2_0 CybranBuildLoFiPS();
  5611. }
  5612. }
  5613.  
  5614. /// UEFBuild
  5615. ///
  5616. ///
  5617. technique UEFBuild_HighFidelity
  5618. <
  5619. string abstractTechnique = "UEFBuild";
  5620. int fidelity = FIDELITY_HIGH;
  5621.  
  5622. string cartographicTechnique = "CartographicBuild";
  5623. string depthTechnique = "Depth";
  5624. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5625. int parameter = PARAM_FRACTIONCOMPLETE;
  5626. >
  5627. {
  5628. pass P0
  5629. {
  5630. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5631. RasterizerState( Rasterizer_Cull_CW )
  5632.  
  5633. VertexShader = compile vs_1_1 NormalMappedVS();
  5634. PixelShader = compile ps_2_a UEFBuildHiFiPS(true);
  5635. }
  5636. pass P1
  5637. {
  5638. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5639. RasterizerState( Rasterizer_Cull_CW )
  5640.  
  5641. VertexShader = compile vs_1_1 EffectVertexNormalHiFiVS( 16.0, 8.0, 0.0192, 0.0176, -0.0122, -0.0122 );
  5642. PixelShader = compile ps_2_0 UEFBuildOverlayHiFiPS();
  5643. }
  5644. }
  5645.  
  5646. technique UEFBuild_MedFidelity
  5647. <
  5648. string abstractTechnique = "UEFBuild";
  5649. int fidelity = FIDELITY_MEDIUM;
  5650.  
  5651. string cartographicTechnique = "CartographicBuild";
  5652. string depthTechnique = "Depth";
  5653. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5654. int parameter = PARAM_FRACTIONCOMPLETE;
  5655. >
  5656. {
  5657. pass P0
  5658. {
  5659. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5660. RasterizerState( Rasterizer_Cull_CW )
  5661.  
  5662. VertexShader = compile vs_1_1 NormalMappedVS();
  5663. PixelShader = compile ps_2_0 UEFBuildHiFiPS(false);
  5664. }
  5665. pass P1
  5666. {
  5667. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5668. RasterizerState( Rasterizer_Cull_CW )
  5669.  
  5670. VertexShader = compile vs_1_1 EffectVertexNormalHiFiVS( 16.0, 8.0, 0.0192, 0.0176, -0.0122, -0.0122 );
  5671. PixelShader = compile ps_2_0 UEFBuildOverlayHiFiPS();
  5672. }
  5673. }
  5674.  
  5675. technique UEFBuild_LowFidelity
  5676. <
  5677. string abstractTechnique = "UEFBuild";
  5678. int fidelity = FIDELITY_LOW;
  5679.  
  5680. string cartographicTechnique = "CartographicBuild";
  5681. string depthTechnique = "Depth";
  5682. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5683. int parameter = PARAM_FRACTIONCOMPLETE;
  5684. >
  5685. {
  5686. pass P0
  5687. {
  5688. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5689. RasterizerState( Rasterizer_Cull_CW )
  5690.  
  5691. VertexShader = compile vs_1_1 VertexNormalVS();
  5692. PixelShader = compile ps_2_0 UEFBuildLoFiPS();
  5693. }
  5694. pass P1
  5695. {
  5696. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5697. RasterizerState( Rasterizer_Cull_CW )
  5698.  
  5699. VertexShader = compile vs_1_1 EffectVertexNormalLoFiVS( 16, 8, 0.0192, 0.0176, -0.05, -0.05 );
  5700. PixelShader = compile ps_2_0 UEFBuildOverlayLoFiPS();
  5701. }
  5702. }
  5703.  
  5704.  
  5705.  
  5706. /// UEFBuildCube
  5707. ///
  5708. ///
  5709. technique UEFBuildCube_MedFidelity
  5710. <
  5711. string abstractTechnique = "UEFBuildCube";
  5712. int fidelity = FIDELITY_MEDIUM;
  5713.  
  5714. string depthTechnique = "Depth";
  5715. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5716. int parameter = PARAM_FRACTIONCOMPLETE;
  5717. >
  5718. {
  5719. pass P0
  5720. {
  5721. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  5722. RasterizerState( Rasterizer_Cull_CW )
  5723. DepthState( Depth_Enable_LessEqual_Write_None )
  5724.  
  5725. VertexShader = compile vs_1_1 NormalMappedVS();
  5726. PixelShader = compile ps_2_0 UEFBuildCubePS();
  5727. }
  5728. }
  5729.  
  5730. technique UEFBuildCube_LowFidelity
  5731. <
  5732. string abstractTechnique = "UEFBuildCube";
  5733. int fidelity = FIDELITY_LOW;
  5734.  
  5735. string depthTechnique = "Depth";
  5736. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5737. int parameter = PARAM_FRACTIONCOMPLETE;
  5738. >
  5739. {
  5740. pass P0
  5741. {
  5742. AlphaState( AlphaBlend_Write_RGB )
  5743. RasterizerState( Rasterizer_Cull_CW )
  5744.  
  5745. VertexShader = compile vs_1_1 EffectVertexNormalLoFiVS( 0.025, 50, 0.0012, 0.0062, -0.25, -0.0062);
  5746. PixelShader = compile ps_2_0 UEFBuildCubeLoFiPS();
  5747. }
  5748. }
  5749.  
  5750. /// Wreckage
  5751. ///
  5752. ///
  5753. technique Wreckage_MedFidelity
  5754. <
  5755. string abstractTechnique = "Wreckage";
  5756. int fidelity = FIDELITY_MEDIUM;
  5757.  
  5758. string cartographicTechnique = "CartographicFeature";
  5759. string depthTechnique = "Depth";
  5760. int renderStage = STAGE_DEPTH + STAGE_PREWATER + STAGE_PREEFFECT;
  5761. int parameter = PARAM_UNUSED;
  5762. >
  5763. {
  5764. pass P0
  5765. {
  5766. RasterizerState( Rasterizer_Cull_CW )
  5767.  
  5768. VertexShader = compile vs_2_0 WreckageVS_HighFidelity();
  5769. PixelShader = compile ps_2_0 WreckagePS();
  5770. }
  5771. };
  5772.  
  5773. technique Wreckage_LowFidelity
  5774. <
  5775. string abstractTechnique = "Wreckage";
  5776. int fidelity = FIDELITY_LOW;
  5777.  
  5778. string cartographicTechnique = "CartographicFeature";
  5779. int renderStage = STAGE_PREWATER + STAGE_PREEFFECT;
  5780. int parameter = PARAM_UNUSED;
  5781. >
  5782. {
  5783. pass P0
  5784. {
  5785. RasterizerState( Rasterizer_Cull_CW )
  5786.  
  5787. VertexShader = compile vs_1_1 WreckageVS_LowFidelity();
  5788. PixelShader = compile ps_2_0 WreckagePS_LowFidelity();
  5789. }
  5790. };
  5791.  
  5792. /// Phase Shield
  5793. ///
  5794. ///
  5795. technique PhaseShield_HighFidelity
  5796. <
  5797. string abstractTechnique = "PhaseShield";
  5798. int fidelity = FIDELITY_HIGH;
  5799.  
  5800. string cartographicTechnique = "CartographicShield";
  5801. string depthTechnique = "Depth";
  5802. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5803. int parameter = PARAM_UNUSED;
  5804. >
  5805. {
  5806. pass P0
  5807. {
  5808. AlphaState( AlphaBlend_Disable_Write_RGBA )
  5809. RasterizerState( Rasterizer_Cull_CW )
  5810.  
  5811. VertexShader = compile vs_1_1 NormalMappedVS();
  5812. PixelShader = compile ps_2_a NormalMappedPS(true,true,true, false,0,0 );
  5813. }
  5814. pass P1
  5815. {
  5816. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5817. RasterizerState( Rasterizer_Cull_CW )
  5818.  
  5819. VertexShader = compile vs_1_1 PositionNormalOffsetVS(0.05);
  5820. PixelShader = compile ps_2_0 PhaseShieldPS();
  5821. }
  5822. }
  5823.  
  5824. /// SeraphimPersonalShield
  5825. ///
  5826. ///
  5827. technique SeraphimPersonalShield_HighFidelity
  5828. <
  5829. string abstractTechnique = "SeraphimPersonalShield";
  5830. int fidelity = FIDELITY_HIGH;
  5831.  
  5832. string cartographicTechnique = "CartographicUnit";
  5833. string depthTechnique = "Depth";
  5834. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5835.  
  5836. int parameter = PARAM_LIFETIME;
  5837.  
  5838. string environment = "<seraphim>";
  5839. >
  5840. {
  5841. pass P0
  5842. {
  5843. AlphaState( AlphaBlend_Disable_Write_RGBA )
  5844. RasterizerState( Rasterizer_Cull_CW )
  5845.  
  5846. VertexShader = compile vs_1_1 UnitFalloffVS();
  5847. PixelShader = compile ps_2_a UnitFalloffPS(true);
  5848. }
  5849. pass P1
  5850. {
  5851. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5852. RasterizerState( Rasterizer_Cull_CW )
  5853.  
  5854. VertexShader = compile vs_1_1 PositionNormalOffsetVS(0.05);
  5855. PixelShader = compile ps_2_0 SeraphimPhaseShieldPS();
  5856. }
  5857. }
  5858.  
  5859. /// SeraphimPersonalShield
  5860. ///
  5861. ///
  5862. technique SeraphimPersonalShield_LowFidelity
  5863. <
  5864. string abstractTechnique = "SeraphimPersonalShield";
  5865. int fidelity = FIDELITY_LOW;
  5866.  
  5867. string cartographicTechnique = "CartographicUnit";
  5868. string depthTechnique = "Depth";
  5869. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5870.  
  5871. int parameter = PARAM_LIFETIME;
  5872.  
  5873. string environment = "<seraphim>";
  5874. >
  5875. {
  5876. pass P0
  5877. {
  5878. AlphaState( AlphaBlend_Disable_Write_RGBA )
  5879. RasterizerState( Rasterizer_Cull_CW )
  5880.  
  5881. VertexShader = compile vs_1_1 NormalMappedVS();
  5882. PixelShader = compile ps_2_0 LowFiUnitFalloffPS();
  5883. }
  5884. pass P1
  5885. {
  5886. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5887. RasterizerState( Rasterizer_Cull_CW )
  5888.  
  5889. VertexShader = compile vs_1_1 PositionNormalOffsetVS(0.05);
  5890. PixelShader = compile ps_2_0 PhaseShieldPS();
  5891. }
  5892. }
  5893.  
  5894. technique PhaseShield_MedFidelity
  5895. <
  5896. string abstractTechnique = "PhaseShield";
  5897. int fidelity = FIDELITY_MEDIUM;
  5898.  
  5899. string cartographicTechnique = "CartographicShield";
  5900. string depthTechnique = "Depth";
  5901. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5902. int parameter = PARAM_UNUSED;
  5903. >
  5904. {
  5905. pass P0
  5906. {
  5907. AlphaState( AlphaBlend_Disable_Write_RGBA )
  5908. RasterizerState( Rasterizer_Cull_CW )
  5909.  
  5910. VertexShader = compile vs_1_1 NormalMappedVS();
  5911. PixelShader = compile ps_2_0 NormalMappedPS(true,true,false, false,0,0 );
  5912. }
  5913. pass P1
  5914. {
  5915. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5916. RasterizerState( Rasterizer_Cull_CW )
  5917.  
  5918. VertexShader = compile vs_1_1 PositionNormalOffsetVS(0.05);
  5919. PixelShader = compile ps_2_0 PhaseShieldPS();
  5920. }
  5921. }
  5922.  
  5923. technique PhaseShield_LowFidelity
  5924. <
  5925. string abstractTechnique = "PhaseShield";
  5926. int fidelity = FIDELITY_LOW;
  5927.  
  5928. string cartographicTechnique = "CartographicShield";
  5929. string depthTechnique = "Depth";
  5930. int renderStage = STAGE_DEPTH + STAGE_REFLECTION + STAGE_PREWATER + STAGE_PREEFFECT;
  5931. int parameter = PARAM_UNUSED;
  5932. >
  5933. {
  5934. pass P0
  5935. {
  5936. AlphaState( AlphaBlend_Disable_Write_RGB )
  5937. RasterizerState( Rasterizer_Cull_CW )
  5938.  
  5939. VertexShader = compile vs_1_1 VertexNormalVS();
  5940. PixelShader = compile ps_2_0 ColorMaskPS_LowFidelity();
  5941. }
  5942. pass P1
  5943. {
  5944. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5945. RasterizerState( Rasterizer_Cull_CW )
  5946.  
  5947. VertexShader = compile vs_1_1 PositionNormalOffsetVS(0.05);
  5948. PixelShader = compile ps_2_0 PhaseShieldPS();
  5949. }
  5950. }
  5951.  
  5952. /// UEF Shield
  5953. ///
  5954. ///
  5955. technique ShieldUEF_MedFidelity
  5956. <
  5957. string abstractTechnique = "ShieldUEF";
  5958. int fidelity = FIDELITY_MEDIUM;
  5959.  
  5960. string cartographicTechnique = "CartographicShield";
  5961. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  5962. int parameter = PARAM_FRACTIONHEALTH;
  5963. >
  5964. {
  5965. pass P0
  5966. {
  5967. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5968. RasterizerState( Rasterizer_Cull_None )
  5969. DepthState( Depth_Enable_LessEqual_Write_None )
  5970.  
  5971. VertexShader = compile vs_1_1 FourUVTexShiftScaleVS( 1, 3, 32, 6, 0, 0, 0.0003, 0.005, -0.001, -0.005, -0.0003, -0.0008 );
  5972. PixelShader = compile ps_2_0 ShieldPS();
  5973. }
  5974. }
  5975.  
  5976. technique ShieldUEF_LowFidelity
  5977. <
  5978. string abstractTechnique = "ShieldUEF";
  5979. int fidelity = FIDELITY_LOW;
  5980.  
  5981. string cartographicTechnique = "CartographicShield";
  5982. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  5983. int parameter = PARAM_FRACTIONHEALTH;
  5984. >
  5985. {
  5986. pass P0
  5987. {
  5988. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  5989. RasterizerState( Rasterizer_Cull_None )
  5990. DepthState( Depth_Enable_LessEqual_Write_None )
  5991.  
  5992. VertexShader = compile vs_1_1 ThreeUVTexShiftScaleLoFiVS( 1, 3, 32, 0, 0, 0.0003, 0.005, -0.001, -0.005 );
  5993. PixelShader = compile ps_2_0 ShieldLoFiPS();
  5994. }
  5995. }
  5996.  
  5997. /// Cybran Shield
  5998. ///
  5999. ///
  6000. technique ShieldCybran_MedFidelity
  6001. <
  6002. string abstractTechnique = "ShieldCybran";
  6003. int fidelity = FIDELITY_MEDIUM;
  6004.  
  6005. string cartographicTechnique = "CartographicShield";
  6006. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6007. int parameter = PARAM_FRACTIONHEALTH;
  6008. >
  6009. {
  6010. pass P0
  6011. {
  6012. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  6013. RasterizerState( Rasterizer_Cull_CW )
  6014. DepthState( Depth_Enable_LessEqual_Write_None )
  6015.  
  6016. VertexShader = compile vs_1_1 FourUVTexShiftScaleVS( 1,1,2,1, -0.01,0, -0.002,0, 0,0.0012, 0.001,-0.0015 );
  6017. PixelShader = compile ps_2_0 ShieldCybranPS(0.17);
  6018. }
  6019. pass P1
  6020. {
  6021. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  6022. DepthState( Depth_Enable_LessEqual_Write_None )
  6023. RasterizerState( Rasterizer_Cull_CW )
  6024.  
  6025. VertexShader = compile vs_1_1 ShieldPositionNormalOffsetVS( 0.01, 1,1,4,1, 0.01,0, -0.002,0, 0,0.0012, 0.001,-0.003 );
  6026. PixelShader = compile ps_2_0 ShieldCybranPS(0.17);
  6027. }
  6028. }
  6029.  
  6030. technique ShieldCybran_LowFidelity
  6031. <
  6032. string abstractTechnique = "ShieldCybran";
  6033. int fidelity = FIDELITY_LOW;
  6034.  
  6035. string cartographicTechnique = "CartographicShield";
  6036. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6037. int parameter = PARAM_FRACTIONHEALTH;
  6038. >
  6039. {
  6040. pass P0
  6041. {
  6042. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  6043. RasterizerState( Rasterizer_Cull_CW )
  6044. DepthState( Depth_Enable_LessEqual_Write_None )
  6045.  
  6046. VertexShader = compile vs_1_1 ThreeUVTexShiftScaleLoFiVS( 1,2,1, 0,0, 0,0.002, 0.001,-0.003 );
  6047. PixelShader = compile ps_2_0 ShieldCybranLoFiPS(0.24);
  6048. }
  6049. }
  6050. /// Aeon Shield
  6051. ///
  6052. ///
  6053. technique ShieldAeon_MedFidelity
  6054. <
  6055. string abstractTechnique = "ShieldAeon";
  6056. int fidelity = FIDELITY_MEDIUM;
  6057.  
  6058. string cartographicTechnique = "CartographicShield";
  6059. int renderStage = STAGE_REFLECTION + STAGE_POSTWATER + STAGE_POSTEFFECT;
  6060. int parameter = PARAM_FRACTIONHEALTH;
  6061. >
  6062. {
  6063. pass P0
  6064. {
  6065. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  6066. RasterizerState( Rasterizer_Cull_CW )
  6067. DepthState( Depth_Enable_LessEqual_Write_None )
  6068.  
  6069. VertexShader = compile vs_1_1 ShieldNormalVS( 1,12,8,3, 0,0, 0,0.032, 0.012,-0.032, 0,0.0012 );
  6070. PixelShader = compile ps_2_0 ShieldAeonPS();
  6071. }
  6072. }
  6073.  
  6074. technique ShieldAeon_LowFidelity
  6075. <
  6076. string abstractTechnique = "ShieldAeon";
  6077. int fidelity = FIDELITY_LOW;
  6078.  
  6079. string cartographicTechnique = "CartographicShield";
  6080. int renderStage = STAGE_REFLECTION + STAGE_POSTWATER + STAGE_POSTEFFECT;
  6081. int parameter = PARAM_FRACTIONHEALTH;
  6082. >
  6083. {
  6084. pass P0
  6085. {
  6086. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  6087. RasterizerState( Rasterizer_Cull_CW )
  6088. DepthState( Depth_Enable_LessEqual_Write_None )
  6089.  
  6090. VertexShader = compile vs_1_1 ThreeUVTexShiftScaleLoFiVS( 1,12,8, 0,0, 0,0.032, 0.012,-0.032 );
  6091. PixelShader = compile ps_2_0 ShieldAeonLoFiPS( 0.5 );
  6092. }
  6093. }
  6094.  
  6095. /// Seraphim Shield
  6096. ///
  6097. ///
  6098. technique ShieldSeraphim_MedFidelity
  6099. <
  6100. string abstractTechnique = "ShieldSeraphim";
  6101. int fidelity = FIDELITY_MEDIUM;
  6102.  
  6103. string cartographicTechnique = "CartographicShield";
  6104. int renderStage = STAGE_REFLECTION + STAGE_POSTWATER + STAGE_POSTEFFECT;
  6105. int parameter = PARAM_FRACTIONHEALTH;
  6106.  
  6107. string environment = "<seraphim>";
  6108. >
  6109. {
  6110. pass P0
  6111. {
  6112. AlphaState( AlphaBlend_SrcAlpha_One_Write_RGB )
  6113.  
  6114. RasterizerState( Rasterizer_Cull_CW )
  6115. DepthState( Depth_Enable_LessEqual_Write_None )
  6116.  
  6117. VertexShader = compile vs_1_1 ShieldNormalVS(5,1,1,11, -0.00153,-0.0159, 0,0, 0.003,-0.0045, -0.005,-0.045 );
  6118. PixelShader = compile ps_2_0 ShieldSeraphimPS();
  6119. }
  6120. }
  6121.  
  6122. technique ShieldSeraphim_LowFidelity
  6123. <
  6124. string abstractTechnique = "ShieldSeraphim";
  6125. int fidelity = FIDELITY_LOW;
  6126.  
  6127. string cartographicTechnique = "CartographicShield";
  6128. int renderStage = STAGE_REFLECTION + STAGE_POSTWATER + STAGE_POSTEFFECT;
  6129. int parameter = PARAM_FRACTIONHEALTH;
  6130.  
  6131. string environment = "<seraphim>";
  6132. >
  6133. {
  6134. pass P0
  6135. {
  6136. AlphaState( AlphaBlend_SrcAlpha_One_Write_RGB )
  6137.  
  6138. RasterizerState( Rasterizer_Cull_CW )
  6139. DepthState( Depth_Enable_LessEqual_Write_None )
  6140.  
  6141. VertexShader = compile vs_1_1 ThreeUVTexShiftScaleLoFiVS( 1,12,8, 0,0, 0,0.032, 0.012,-0.032 );
  6142. PixelShader = compile ps_2_0 ShieldAeonLoFiPS( 0.5 );
  6143. }
  6144. }
  6145.  
  6146.  
  6147. /// ShieldDepthFill
  6148. ///
  6149. ///
  6150. technique ShieldFill
  6151. <
  6152. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6153. int parameter = PARAM_FRACTIONHEALTH;
  6154. >
  6155. {
  6156. pass P0
  6157. {
  6158. AlphaState( AlphaBlend_Disable_Write_None )
  6159. RasterizerState( Rasterizer_Cull_CW )
  6160. DepthState( Depth_Enable )
  6161.  
  6162. #ifndef DIRECT3D10
  6163. AlphaTestEnable = false;
  6164. #endif
  6165.  
  6166. VertexShader = compile vs_1_1 FlatVS();
  6167. PixelShader = compile ps_2_0 ShieldFillPS();
  6168. }
  6169. }
  6170.  
  6171. technique ShieldImpact
  6172. <
  6173. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6174. int parameter = PARAM_UNUSED;
  6175. >
  6176. {
  6177. pass P0
  6178. {
  6179. AlphaState( AlphaBlend_SrcAlpha_One_Write_RGBA )
  6180. RasterizerState( Rasterizer_Cull_CW )
  6181. DepthState( Depth_Enable_LessEqual_Write_None )
  6182.  
  6183. VertexShader = compile vs_1_1 ShieldImpactVS( -0.003, -0.1, -0.085 , -0.15 , 0.25, 0, 0, 0.0, 2.0 );
  6184. PixelShader = compile ps_2_0 ShieldImpactPS( 2.0, 0.2 );
  6185. }
  6186. }
  6187.  
  6188. technique CybranShieldImpact
  6189. <
  6190. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6191. int parameter = PARAM_UNUSED;
  6192. >
  6193. {
  6194. pass P0
  6195. {
  6196. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  6197. RasterizerState( Rasterizer_Cull_None )
  6198. DepthState( Depth_Enable_LessEqual_Write_None )
  6199.  
  6200. VertexShader = compile vs_1_1 ShieldImpactVS( 0, 0, 0, 0, 1, -0.003, -0.06, -0.01, 1 );
  6201. PixelShader = compile ps_2_0 CybranShieldImpactPS( 6.0, 0.15, 4.5 );
  6202. }
  6203. }
  6204.  
  6205.  
  6206. /// Effect
  6207. ///
  6208. ///
  6209. technique Effect
  6210. <
  6211. string depthTechnique = "DepthClip";
  6212. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6213. int parameter = PARAM_UNUSED;
  6214. >
  6215. {
  6216. pass P0
  6217. {
  6218. RasterizerState( Rasterizer_Cull_CW )
  6219.  
  6220. VertexShader = compile vs_1_1 EffectVS();
  6221. PixelShader = compile ps_2_0 EffectPS();
  6222. }
  6223. }
  6224.  
  6225.  
  6226. /// Explosion
  6227. ///
  6228. ///
  6229. technique Explosion
  6230. <
  6231. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6232. int parameter = PARAM_UNUSED;
  6233. >
  6234. {
  6235. pass P0
  6236. {
  6237. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  6238. RasterizerState( Rasterizer_Cull_CW )
  6239. DepthState( Depth_Enable_Less )
  6240.  
  6241. #ifndef DIRECT3D10
  6242. AlphaTestEnable = true;
  6243. AlphaRef = 0x40;
  6244. AlphaFunc = Greater;
  6245. #endif
  6246.  
  6247. VertexShader = compile vs_1_1 EffectVS();
  6248. PixelShader = compile ps_2_0 ExplosionPS( true, d3d_Greater, 0x40 );
  6249. }
  6250. }
  6251.  
  6252. /// Cloud
  6253. ///
  6254. ///
  6255. technique Cloud_HighFidelity
  6256. <
  6257. string abstractTechnique = "Cloud";
  6258. int fidelity = FIDELITY_HIGH;
  6259.  
  6260. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6261. int parameter = PARAM_UNUSED;
  6262. >
  6263. {
  6264. pass P0
  6265. {
  6266. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  6267. DepthState( Depth_Enable )
  6268. RasterizerState( Rasterizer_Cull_CW )
  6269.  
  6270. #ifndef DIRECT3D10
  6271. AlphaTestEnable = false;
  6272. #endif
  6273.  
  6274. VertexShader = compile vs_1_1 EffectVS();
  6275. PixelShader = compile ps_2_a EffectFadePS( 180.0, 0.025, true);
  6276. }
  6277. }
  6278.  
  6279. technique Cloud_MedFidelity
  6280. <
  6281. string abstractTechnique = "Cloud";
  6282. int fidelity = FIDELITY_MEDIUM;
  6283.  
  6284. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6285. int parameter = PARAM_UNUSED;
  6286. >
  6287. {
  6288. pass P0
  6289. {
  6290. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  6291. DepthState( Depth_Enable )
  6292. RasterizerState( Rasterizer_Cull_CW )
  6293.  
  6294. #ifndef DIRECT3D10
  6295. AlphaTestEnable = false;
  6296. #endif
  6297.  
  6298. VertexShader = compile vs_1_1 EffectVS();
  6299. PixelShader = compile ps_2_0 EffectFadePS( 180.0, 0.025, false);
  6300. }
  6301. }
  6302.  
  6303. technique Cloud_LowFidelity
  6304. <
  6305. string abstractTechnique = "Cloud";
  6306. int fidelity = FIDELITY_LOW;
  6307.  
  6308. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6309. int parameter = PARAM_UNUSED;
  6310. >
  6311. {
  6312. pass P0
  6313. {
  6314. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  6315. DepthState( Depth_Enable )
  6316. RasterizerState( Rasterizer_Cull_CW )
  6317.  
  6318. #ifndef DIRECT3D10
  6319. AlphaTestEnable = false;
  6320. #endif
  6321.  
  6322. VertexShader = compile vs_1_1 EffectVS();
  6323. PixelShader = compile ps_2_0 EffectFadePS( 180.0, 0.025, false);
  6324. }
  6325. }
  6326.  
  6327. /// OuterCloud
  6328. ///
  6329. ///
  6330. technique OuterCloud
  6331. <
  6332. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  6333. int parameter = PARAM_UNUSED;
  6334. >
  6335. {
  6336. pass P0
  6337. {
  6338. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  6339. DepthState( Depth_Enable_Less_Write_None )
  6340. RasterizerState( Rasterizer_Cull_CW )
  6341.  
  6342. VertexShader = compile vs_1_1 EffectVS();
  6343. PixelShader = compile ps_2_0 AlphaFadeTexShiftScalePS( 1.0, -0.008, 180.0, 0.025);
  6344. }
  6345. }
  6346.  
  6347. /// NukeUEF
  6348. ///
  6349. ///
  6350. technique NukeUEF
  6351. <
  6352. // string depthTechnique = "Depth";
  6353. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  6354. int parameter = PARAM_UNUSED;
  6355. >
  6356. {
  6357. pass P0
  6358. {
  6359. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  6360. DepthState( Depth_Enable )
  6361. RasterizerState( Rasterizer_Cull_CW )
  6362.  
  6363. #ifndef DIRECT3D10
  6364. AlphaTestEnable = true;
  6365. AlphaRef = 0x0F;
  6366. AlphaFunc = Greater;
  6367. #endif
  6368.  
  6369. VertexShader = compile vs_1_1 EffectVS();
  6370. PixelShader = compile ps_2_0 NukeHeadPS( 1.0, 0.018, 50.0, 0.015, true, d3d_Greater, 0x0F );
  6371. }
  6372. }
  6373.  
  6374. /// NukeEMP
  6375. ///
  6376. ///
  6377. technique NukeEMP
  6378. <
  6379. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  6380. int parameter = PARAM_UNUSED;
  6381. >
  6382. {
  6383. pass P0
  6384. {
  6385. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  6386. DepthState( Depth_Enable_Less_Write_None )
  6387. RasterizerState( Rasterizer_Cull_CW )
  6388.  
  6389. VertexShader = compile vs_1_1 EffectVS();
  6390. PixelShader = compile ps_2_0 AlphaFadeTexShiftScalePS( 1.0, -0.008, 180.0, 0.025);
  6391. }
  6392. }
  6393.  
  6394. /// NukeQuantum
  6395. ///
  6396. ///
  6397. technique NukeQuantum
  6398. <
  6399. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6400. int parameter = PARAM_UNUSED;
  6401. >
  6402. {
  6403. pass P0
  6404. {
  6405. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RBA )
  6406. DepthState( Depth_Enable_Less_Write_None )
  6407. RasterizerState( Rasterizer_Cull_CW )
  6408.  
  6409. VertexShader = compile vs_1_1 EffectVS();
  6410. PixelShader = compile ps_2_0 AlphaFadeTexShiftScalePS( 0.5, -0.006, 150.0, 0.025);
  6411. }
  6412. }
  6413.  
  6414. technique PhalanxEffect
  6415. <
  6416. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  6417. int parameter = PARAM_UNUSED;
  6418. >
  6419. {
  6420. pass P0
  6421. {
  6422. AlphaState( AlphaBlend_One_InvSrcAlpha_Write_RGBA )
  6423. DepthState( Depth_Enable_Less_Write_None )
  6424. RasterizerState( Rasterizer_Cull_CW )
  6425.  
  6426. VertexShader = compile vs_1_1 EffectVertexNormalLoFiVS( 1, 1, -0.05, 0, -0.05, -0.025 );
  6427. PixelShader = compile ps_2_0 TwoTexShiftScalePS( 0.2, 0.2 );
  6428. }
  6429. }
  6430.  
  6431. technique UEFQuantumGate
  6432. <
  6433. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  6434. int parameter = PARAM_UNUSED;
  6435. >
  6436. {
  6437. pass P0
  6438. {
  6439. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGBA )
  6440. DepthState( Depth_Enable_Less_Write_None )
  6441. RasterizerState( Rasterizer_Cull_None )
  6442.  
  6443. VertexShader = compile vs_1_1 ThreeUVTexShiftScaleLoFiVS( 1, 4, 1, 0, 0.025, 0.025, 0.025, 0, 0 );
  6444. PixelShader = compile ps_2_0 TexSubAlphaMaskStaticLoFiPS( 1, 0.4 );
  6445. }
  6446. }
  6447.  
  6448. /// EditorMarker
  6449. ///
  6450. ///
  6451. technique EditorMarker
  6452. <
  6453. int renderStage = STAGE_POSTWATER + STAGE_PREEFFECT;
  6454. int parameter = PARAM_UNUSED;
  6455. >
  6456. {
  6457. pass P0
  6458. {
  6459. AlphaState( AlphaBlend_Disable_Write_RGB )
  6460. DepthState( Depth_Enable )
  6461. RasterizerState( Rasterizer_Cull_CW )
  6462.  
  6463. #ifndef DIRECT3D10
  6464. AlphaTestEnable = false;
  6465. #endif
  6466.  
  6467. VertexShader = compile vs_1_1 VertexNormalVS();
  6468. PixelShader = compile ps_2_0 EditorMarkerPS();
  6469. }
  6470. }
  6471.  
  6472. /// Glass shader
  6473. ///
  6474. ///
  6475. technique GlassAlpha_MedFidelity
  6476. <
  6477. string abstractTechnique = "GlassAlpha";
  6478. int fidelity = FIDELITY_MEDIUM;
  6479.  
  6480. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6481. int parameter = PARAM_FRACTIONHEALTH;
  6482. >
  6483. {
  6484. pass P0
  6485. {
  6486. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  6487. DepthState( Depth_Enable_LessEqual_Write_None )
  6488. RasterizerState( Rasterizer_Cull_CW )
  6489.  
  6490. VertexShader = compile vs_1_1 NormalMappedVS();
  6491. PixelShader = compile ps_2_0 GlassAlphaPS(false);
  6492. }
  6493. }
  6494.  
  6495. technique GlassAlpha_LowFidelity
  6496. <
  6497. string abstractTechnique = "GlassAlpha";
  6498. int fidelity = FIDELITY_LOW;
  6499.  
  6500. int renderStage = STAGE_POSTWATER + STAGE_POSTEFFECT;
  6501. int parameter = PARAM_FRACTIONHEALTH;
  6502. >
  6503. {
  6504. pass P0
  6505. {
  6506. AlphaState( AlphaBlend_SrcAlpha_InvSrcAlpha_Write_RGB )
  6507. DepthState( Depth_Enable_LessEqual_Write_None )
  6508. RasterizerState( Rasterizer_Cull_CW )
  6509.  
  6510. VertexShader = compile vs_1_1 VertexNormalVS();
  6511. PixelShader = compile ps_2_0 GlassAlphaLoFiPS();
  6512. }
  6513. }
Add Comment
Please, Sign In to add comment