Guest User

better version of AutoLuminous.fx for MMD

a guest
Mar 21st, 2019
233
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // AutoLuminous Ver.4.2
  4. // 作成: そぼろ
  5. //
  6. ////////////////////////////////////////////////////////////////////////////////////////////////
  7. ////////////////////////////////////////////////////////////////////////////////////////////////
  8. // ユーザーパラメータ
  9.  
  10. #ifdef MIKUMIKUMOVING
  11.  
  12. int Glare <
  13. string UIName = "Glare";
  14. string UIWidget = "Slider";
  15. string UIHelp = "光芒の数を指定します。";
  16. bool UIVisible = true;
  17. int UIMin = 0;
  18. int UIMax = 6;
  19. > = 0;
  20.  
  21. #endif
  22.  
  23. //MMM用グレア角度
  24. float GlareAngle2 <
  25. string UIName = "GlareAngle";
  26. string UIWidget = "Slider";
  27. string UIHelp = "光芒角度";
  28. bool UIVisible = true;
  29. float UIMin = 0;
  30. float UIMax = 180;
  31. > = 0.0;
  32.  
  33. //MMM用グレア長さ
  34. float GlareLength <
  35. string UIName = "GlareLength";
  36. string UIWidget = "Slider";
  37. string UIHelp = "光芒長さ";
  38. bool UIVisible = true;
  39. float UIMin = 0;
  40. float UIMax = 2.0;
  41. > = 1.0;
  42.  
  43.  
  44. //MMM用発光強度
  45. float Power2 <
  46. string UIName = "LightPower";
  47. string UIWidget = "Slider";
  48. string UIHelp = "発光強度";
  49. bool UIVisible = true;
  50. float UIMin = 0;
  51. float UIMax = 20;
  52. > = 1.0;
  53.  
  54. // ぼかし範囲
  55. float AL_Extent <
  56. string UIName = "AL_Extent";
  57. string UIWidget = "Slider";
  58. string UIHelp = "発光ぼかし範囲";
  59. bool UIVisible = true;
  60. float UIMin = 0;
  61. float UIMax = 0.2;
  62. > = 0.07;
  63.  
  64.  
  65. //グレア強度 1.0前後
  66. float GlarePower <
  67. string UIName = "GlarePower";
  68. string UIWidget = "Slider";
  69. string UIHelp = "グレア強度";
  70. bool UIVisible = true;
  71. float UIMin = 0;
  72. float UIMax = 3;
  73. > = 1.2;
  74.  
  75. //白飛び係数 0~1
  76. float OverExposureRatio <
  77. string UIName = "OverExposure";
  78. string UIWidget = "Slider";
  79. string UIHelp = "白飛び係数";
  80. bool UIVisible = true;
  81. float UIMin = 0;
  82. float UIMax = 3;
  83. > = 0.6; //was 0.85 before using gamma
  84.  
  85. #define OVEREXPOSUREGAMMA 1 //new! Turn down OverExposureRatio when used. ###
  86.  
  87. //弱光減衰 0~1
  88. float Modest <
  89. string UIName = "Modest";
  90. string UIWidget = "Slider";
  91. string UIHelp = "弱い光があまり拡散しなくなります";
  92. bool UIVisible = true;
  93. float UIMin = 0;
  94. float UIMax = 2.0;
  95. > = 1.0;
  96.  
  97. #ifdef MIKUMIKUMOVING
  98.  
  99. float ScreenToneCurve <
  100. string UIName = "ToneCurve";
  101. string UIWidget = "Slider";
  102. string UIHelp = "トーンカーブ変更";
  103. bool UIVisible = true;
  104. float UIMin = 0;
  105. float UIMax = 1;
  106. > = 0;
  107.  
  108. #endif
  109.  
  110.  
  111. //背景色
  112. const float4 BackColor <
  113. string UIName = "BackColor";
  114. string UIWidget = "Color";
  115. string UIHelp = "背景色";
  116. bool UIVisible = true;
  117. > = float4( 0, 0, 0, 0 );
  118.  
  119.  
  120. //残像強度 0~50程度 0で無効
  121. #define AFTERGLOW 0
  122.  
  123. //一方向のサンプリング数
  124. #define AL_SAMP_NUM 3 //originally 6
  125.  
  126. //グレアの一方向のサンプリング数
  127. #define AL_SAMP_NUM2 5 //originally 12, but affects fps very little. Surprisingly
  128.  
  129. //*NEW* Add non-blurred original image, in a less-than-efficient manner but still outside the loop ###
  130. #define DISTANTBRIGHT 1
  131.  
  132. //I think you could combine this with DISTANTBRIGHT with a 'float()' conversion in the code
  133. const float DistantBrightStrength = 0.15;
  134.  
  135. #define USESCREEN4 0 //Minimal effect on either graphics or performance in most cases
  136. #define USESCREEN5 0
  137.  
  138. //performance conclusion: might be from having multiple passes or transferring lots of data. If from calculations, not sure where they are, or how to significantly improve performance.
  139.  
  140. ///////////////////////////////////////////////////////////////////////////////////////////////
  141. //キーカラー
  142.  
  143. //キーカラー認識閾値
  144. float KeyThreshold = 0.38;
  145.  
  146. //キーカラー数・0でキーカラー無効
  147. #define KEYCOLOR_NUM 0 //2
  148. //does this mean it's off, lol. Green isn't in the list but it glows so I think it's off but somehow still glows
  149.  
  150. #if KEYCOLOR_NUM!=0
  151. float3 KeyColors [KEYCOLOR_NUM][3] = {
  152. //{{キー色},{コア色},{発光色}}, のように並べます
  153. //必ず KEYCOLOR_NUM で指定した数だけ並べます(0を除く)
  154. {{1, 0, 1}, {0.2, 0.2, 0.1}, {0.8, 0.5, 0.3}},
  155. {{0, 0, 1}, {1.0, 0.8, 1.0}, {0.2, 0.4, 1.0}},
  156.  
  157. };
  158. #endif
  159.  
  160. ///////////////////////////////////////////////////////////////////////////////////////////////
  161. //オプションスイッチ
  162.  
  163. //編集中の点滅をフレーム数に同期させる
  164. //trueだとフレーム数に応じて光の強さが変化
  165. //falseだと編集中も点滅し続けます
  166. #define SYNC false
  167.  
  168. //発光除外マスクを使用する
  169. //MMEタブに AL_MaskRT が現れます。
  170. //詳しい使い方はReadme上級編にて。
  171. #define MASK_ENABLE 0
  172.  
  173. //トーンカーブの適用を強制
  174. //0がオフ、1がオンです
  175. //ToneCurve.xを読み込むのが面倒であればオンにします
  176. #define SCREEN_TONECURVE 0
  177.  
  178. //グレアを1方向だけ強調します
  179. //0がオフ、1がオンです
  180. //グレアのサンプリング数もそれに応じて増やすことを推奨
  181. #define GLARE_LONGONE 0
  182.  
  183.  
  184. //厳密アルファ出力モード
  185. //MMD上での表示はおかしくなりますが、動画や画像出力としては
  186. //厳密に正しいアルファ付きデータが得られます
  187. //0がオフ、1がオンです
  188. #define ALPHA_OUT 0
  189.  
  190. //MMD上の描画をHDR情報として扱います
  191. //明るさが1を超えた部分が光って見えるようになります
  192. //0がオフ、1がオンです
  193. #define HDR_RENDER 1
  194.  
  195. //作業用バッファのサイズを半分にして軽くします
  196. //画質は落ちます
  197. //0がオフ、1がオンです
  198. #define HALF_DRAW 0
  199.  
  200.  
  201. //テクスチャフォーマット
  202. #define AL_TEXFORMAT "D3DFMT_A16B16G16R16F"
  203.  
  204.  
  205. ////////////////////////////////////////////////////////////////////////////////////
  206.  
  207. #if HALF_DRAW==0
  208. #define TEXSIZE1 1
  209. #define TEXSIZE2 0.5
  210. #define TEXSIZE3 0.25
  211. #define TEXSIZE4 0.125
  212. #define TEXSIZE5 0.0625
  213.  
  214. #else
  215. #define TEXSIZE1 0.5
  216. #define TEXSIZE2 0.25
  217. #define TEXSIZE3 0.125
  218. #define TEXSIZE4 0.0625
  219. #define TEXSIZE5 0.03125
  220.  
  221. #endif
  222.  
  223. ///////////////////////////////////////////////////////////////////////////////////////////////
  224. // 光放射オブジェクト描画先
  225.  
  226. texture AL_EmitterRT: OFFSCREENRENDERTARGET <
  227. string Description = "EmitterDrawRenderTarget for AutoLuminous.fx";
  228. float2 ViewPortRatio = {TEXSIZE1,TEXSIZE1};
  229. float4 ClearColor = { 0, 0, 0, 1 };
  230. float ClearDepth = 1.0;
  231. bool AntiAlias = true;
  232. int MipLevels = 0;
  233. string Format = AL_TEXFORMAT;
  234. string DefaultEffect =
  235. "self = hide;"
  236. "*Luminous.x = hide;"
  237. "ToneCurve.x = hide;"
  238.  
  239. //------------------------------------
  240. //セレクタエフェクトはここで指定します
  241.  
  242.  
  243.  
  244. //------------------------------------
  245.  
  246. //"* = hide;"
  247. "* = AL_Object.fxsub;"
  248. ;
  249. >;
  250.  
  251.  
  252. ///////////////////////////////////////////////////////////////////////////////////
  253. ///////////////////////////////////////////////////////////////////////////////////
  254. ///////////////////////////////////////////////////////////////////////////////////
  255. //これ以降はエフェクトの知識のある人以外は触れないこと
  256.  
  257. sampler EmitterView = sampler_state {
  258. texture = <AL_EmitterRT>;
  259. MinFilter = Linear;
  260. MagFilter = Linear;
  261. MipFilter = Point;
  262. AddressU = Clamp;
  263. AddressV = Clamp;
  264. };
  265.  
  266. ////////////////////////////////////////////////////////////////////////////////////////////////
  267. // マスク描画先
  268.  
  269. #if MASK_ENABLE!=0
  270.  
  271. texture AL_MaskRT: OFFSCREENRENDERTARGET <
  272. string Description = "MaskDrawRenderTarget for AutoLuminous.fx";
  273. float2 ViewPortRatio = {1.0,1.0};
  274. float4 ClearColor = { 0, 0, 0, 0 };
  275. float ClearDepth = 1.0;
  276. bool AntiAlias = true;
  277. int MipLevels = 1;
  278. string Format = "D3DFMT_A8";
  279. string DefaultEffect =
  280. "self = hide;"
  281. "* = hide;"
  282. ;
  283. >;
  284.  
  285. sampler MaskView = sampler_state {
  286. texture = <AL_MaskRT>;
  287. MinFilter = Linear;
  288. MagFilter = Linear;
  289. MipFilter = None;
  290. AddressU = Clamp;
  291. AddressV = Clamp;
  292. };
  293.  
  294. #endif
  295.  
  296. ////////////////////////////////////////////////////////////////////////////////////////////////
  297.  
  298. int AL_LoopIndex = 0;
  299.  
  300.  
  301. #define PI 3.14159
  302.  
  303. float Script : STANDARDSGLOBAL <
  304. string ScriptOutput = "color";
  305. string ScriptClass = "scene";
  306. string ScriptOrder = "postprocess";
  307. > = 0.8;
  308.  
  309.  
  310. // アルファ取得
  311. float alpha1 : CONTROLOBJECT < string name = "(self)"; string item = "Tr"; >;
  312.  
  313. float4x4 matWorld : CONTROLOBJECT < string name = "(self)"; >;
  314. static float pos_y = matWorld._42;
  315. static float pos_z = matWorld._43;
  316.  
  317. static float OverLight = (pos_y + 100) / 100;
  318.  
  319.  
  320. // スケール値取得
  321. float scaling0 : CONTROLOBJECT < string name = "(self)"; >;
  322. static float scaling = scaling0 * 0.1 * (1.0 + pos_z / 100) * Power2;
  323.  
  324. // X回転
  325. float3 rot : CONTROLOBJECT < string name = "(self)"; string item = "Rxyz"; >;
  326.  
  327. static float Power3 = scaling * (1.0 + pos_z / 100) * Power2;
  328.  
  329. //光芒の数
  330.  
  331. #ifndef MIKUMIKUMOVING
  332.  
  333. float Glare : CONTROLOBJECT < string name = "(self)"; string item = "X"; >;
  334.  
  335. #endif
  336.  
  337. //光芒の長さ
  338. static float GlareAspect = (rot.y * 180 / PI + 100) / 100.0 * GlareLength;
  339.  
  340. //光芒角度
  341. static float GlareAngle = rot.x + GlareAngle2 * PI / 180.0;
  342.  
  343.  
  344. #ifndef MIKUMIKUMOVING
  345. #if SCREEN_TONECURVE==0
  346. bool ScreenToneCurve : CONTROLOBJECT < string name = "ToneCurve.x"; >;
  347. #else
  348. bool ScreenToneCurve = true;
  349. #endif
  350. #endif
  351.  
  352. //時間
  353. float ftime : TIME <bool SyncInEditMode = SYNC;>;
  354.  
  355. static float timerate = (rot.z > 0) ? ((1 + cos(ftime * 2 * PI / (rot.z / PI * 180))) * 0.4 + 0.2)
  356. : ((rot.z < 0) ? (frac(ftime / (-rot.z / PI * 180)) < 0.5) : 1.0);
  357.  
  358. // スクリーンサイズ
  359. float2 ViewportSize : VIEWPORTPIXELSIZE;
  360. static float ViewportAspect = ViewportSize.x / ViewportSize.y;
  361. static float2 ViewportOffset = (float2(0.5,0.5)/ViewportSize);
  362. static float2 OnePx = (float2(1,1)/ViewportSize);
  363.  
  364. //static float2 AL_SampStep = (float2(AL_Extent,AL_Extent) / ViewportSize * ViewportSize.y);
  365. static float2 AL_SampStep = (AL_Extent * float2(1/ViewportAspect, 1));
  366. static float2 AL_SampStepScaled = AL_SampStep * alpha1 / (float)AL_SAMP_NUM * 0.08; //changed alpha1 to 0.1; then back to alpha1 after adding DistantBrightStrength ###
  367.  
  368. static float AL_SampStep2 = AL_Extent * alpha1 / (float)AL_SAMP_NUM2 * GlareAspect;
  369.  
  370.  
  371.  
  372. bool ExternLightSampling : CONTROLOBJECT < string name = "LightSampling.x"; >;
  373.  
  374.  
  375. bool TestMode : CONTROLOBJECT < string name = "AL_Test.x"; >;
  376. float TestValue : CONTROLOBJECT < string name = "AL_Test.x"; >;
  377.  
  378.  
  379.  
  380. ////////////////////////////////////////////////////////////////////////////////////
  381. // 深度バッファ
  382. texture2D DepthBuffer : RENDERDEPTHSTENCILTARGET <
  383. float2 ViewPortRatio = {TEXSIZE1,TEXSIZE1};
  384. string Format = "D24S8";
  385. >;
  386. texture2D DepthBuffer2 : RENDERDEPTHSTENCILTARGET <
  387. float2 ViewPortRatio = {TEXSIZE2,TEXSIZE2};
  388. string Format = "D24S8";
  389. >;
  390. texture2D DepthBuffer3 : RENDERDEPTHSTENCILTARGET <
  391. float2 ViewPortRatio = {TEXSIZE3,TEXSIZE3};
  392. string Format = "D24S8";
  393. >;
  394. texture2D DepthBuffer4 : RENDERDEPTHSTENCILTARGET <
  395. float2 ViewPortRatio = {TEXSIZE4,TEXSIZE4};
  396. string Format = "D24S8";
  397. >;
  398. texture2D DepthBuffer5 : RENDERDEPTHSTENCILTARGET <
  399. float2 ViewPortRatio = {TEXSIZE5,TEXSIZE5};
  400. string Format = "D24S8";
  401. >;
  402.  
  403. ///////////////////////////////////////////////////////////////////////////////////////////////
  404.  
  405. // オリジナルの描画結果を記録するためのレンダーターゲット
  406. texture2D ScnMap : RENDERCOLORTARGET <
  407. float2 ViewPortRatio = {1.0,1.0};
  408. int MipLevels = 1;
  409. #if HDR_RENDER==0
  410. string Format = "A8R8G8B8" ;
  411. #else
  412. string Format = AL_TEXFORMAT ;
  413. #endif
  414. >;
  415. sampler2D ScnSamp = sampler_state {
  416. texture = <ScnMap>;
  417. MinFilter = Linear;
  418. MagFilter = Linear;
  419. MipFilter = None;
  420. AddressU = CLAMP;
  421. AddressV = CLAMP;
  422. };
  423.  
  424. // 高輝度部分を記録するためのレンダーターゲット
  425. texture2D HighLight : RENDERCOLORTARGET <
  426. float2 ViewPortRatio = {TEXSIZE1,TEXSIZE1};
  427. int MipLevels = 0;
  428. string Format = AL_TEXFORMAT ;
  429.  
  430. >;
  431. sampler2D HighLightView = sampler_state {
  432. texture = <HighLight>;
  433. MinFilter = Linear;
  434. MagFilter = Linear;
  435. MipFilter = Point;
  436. AddressU = Border;
  437. AddressV = Border;
  438. };
  439.  
  440. // 外部から高輝度部分を取得するためのレンダーターゲット
  441. shared texture2D ExternalHighLight : RENDERCOLORTARGET <
  442. float2 ViewPortRatio = {1.0,1.0};
  443. int MipLevels = 1;
  444. string Format = AL_TEXFORMAT ;
  445.  
  446. >;
  447. sampler2D ExternalHighLightView = sampler_state {
  448. texture = <ExternalHighLight>;
  449. MinFilter = Linear;
  450. MagFilter = Linear;
  451. MipFilter = NONE;
  452. AddressU = Border;
  453. AddressV = Border;
  454. };
  455.  
  456. // X方向のぼかし結果を記録するためのレンダーターゲット
  457. texture2D ScnMapX : RENDERCOLORTARGET <
  458. float2 ViewPortRatio = {TEXSIZE1,TEXSIZE1};
  459. int MipLevels = 1;
  460. string Format = AL_TEXFORMAT ;
  461. >;
  462. sampler2D ScnSampX = sampler_state {
  463. texture = <ScnMapX>;
  464. MinFilter = Linear;
  465. MagFilter = Linear;
  466. MipFilter = Point;
  467. AddressU = Clamp;
  468. AddressV = Clamp;
  469. };
  470.  
  471. // 出力結果を記録するためのレンダーターゲット
  472. texture2D ScnMapOut : RENDERCOLORTARGET <
  473. float2 ViewPortRatio = {TEXSIZE1,TEXSIZE1};
  474. int MipLevels = 1;
  475. string Format = AL_TEXFORMAT ;
  476. >;
  477. sampler2D ScnSampOut = sampler_state {
  478. texture = <ScnMapOut>;
  479. MinFilter = Linear;
  480. MagFilter = Linear;
  481. MipFilter = Point;
  482. AddressU = Clamp;
  483. AddressV = Clamp;
  484. };
  485.  
  486. // X方向のぼかし結果を記録するためのレンダーターゲット
  487. texture2D ScnMapX2 : RENDERCOLORTARGET <
  488. float2 ViewPortRatio = {TEXSIZE2,TEXSIZE2};
  489. int MipLevels = 1;
  490. string Format = AL_TEXFORMAT ;
  491. >;
  492. sampler2D ScnSampX2 = sampler_state {
  493. texture = <ScnMapX2>;
  494. MinFilter = Linear;
  495. MagFilter = Linear;
  496. MipFilter = Point;
  497. AddressU = Clamp;
  498. AddressV = Clamp;
  499. };
  500.  
  501. // 出力結果を記録するためのレンダーターゲット
  502. texture2D ScnMapOut2 : RENDERCOLORTARGET <
  503. float2 ViewPortRatio = {TEXSIZE2,TEXSIZE2};
  504. int MipLevels = 1;
  505. string Format = AL_TEXFORMAT ;
  506. >;
  507. sampler2D ScnSampOut2 = sampler_state {
  508. texture = <ScnMapOut2>;
  509. MinFilter = Linear;
  510. MagFilter = Linear;
  511. MipFilter = Point;
  512. AddressU = Clamp;
  513. AddressV = Clamp;
  514. };
  515.  
  516. // X方向のぼかし結果を記録するためのレンダーターゲット
  517. texture2D ScnMapX3 : RENDERCOLORTARGET <
  518. float2 ViewPortRatio = {TEXSIZE3,TEXSIZE3};
  519. int MipLevels = 1;
  520. string Format = AL_TEXFORMAT ;
  521. >;
  522. sampler2D ScnSampX3 = sampler_state {
  523. texture = <ScnMapX3>;
  524. MinFilter = Linear;
  525. MagFilter = Linear;
  526. MipFilter = Point;
  527. AddressU = Clamp;
  528. AddressV = Clamp;
  529. };
  530.  
  531. // 出力結果を記録するためのレンダーターゲット
  532. texture2D ScnMapOut3 : RENDERCOLORTARGET <
  533. float2 ViewPortRatio = {TEXSIZE3,TEXSIZE3};
  534. int MipLevels = 1;
  535. string Format = AL_TEXFORMAT ;
  536. >;
  537. sampler2D ScnSampOut3 = sampler_state {
  538. texture = <ScnMapOut3>;
  539. MinFilter = Linear;
  540. MagFilter = Linear;
  541. MipFilter = Point;
  542. AddressU = Clamp;
  543. AddressV = Clamp;
  544. };
  545.  
  546. #if USESCREEN4!=0
  547. // X方向のぼかし結果を記録するためのレンダーターゲット
  548. texture2D ScnMapX4 : RENDERCOLORTARGET <
  549. float2 ViewPortRatio = {TEXSIZE4,TEXSIZE4};
  550. int MipLevels = 1;
  551. string Format = AL_TEXFORMAT ;
  552. >;
  553. sampler2D ScnSampX4 = sampler_state {
  554. texture = <ScnMapX4>;
  555. MinFilter = Linear;
  556. MagFilter = Linear;
  557. MipFilter = Point;
  558. AddressU = Clamp;
  559. AddressV = Clamp;
  560. };
  561.  
  562. // 出力結果を記録するためのレンダーターゲット
  563. texture2D ScnMapOut4 : RENDERCOLORTARGET <
  564. float2 ViewPortRatio = {TEXSIZE4,TEXSIZE4};
  565. int MipLevels = 1;
  566. string Format = AL_TEXFORMAT ;
  567. >;
  568. sampler2D ScnSampOut4 = sampler_state {
  569. texture = <ScnMapOut4>;
  570. MinFilter = Linear;
  571. MagFilter = Linear;
  572. MipFilter = Point;
  573. AddressU = Clamp;
  574. AddressV = Clamp;
  575. };
  576. #endif
  577.  
  578. #if USESCREEN5!=0
  579. // X方向のぼかし結果を記録するためのレンダーターゲット
  580. texture2D ScnMapX5 : RENDERCOLORTARGET <
  581. float2 ViewPortRatio = {TEXSIZE5,TEXSIZE5};
  582. int MipLevels = 1;
  583. string Format = AL_TEXFORMAT ;
  584. >;
  585. sampler2D ScnSampX5 = sampler_state {
  586. texture = <ScnMapX5>;
  587. MinFilter = Linear;
  588. MagFilter = Linear;
  589. MipFilter = Point;
  590. AddressU = Clamp;
  591. AddressV = Clamp;
  592. };
  593.  
  594. // 出力結果を記録するためのレンダーターゲット
  595. texture2D ScnMapOut5 : RENDERCOLORTARGET <
  596. float2 ViewPortRatio = {TEXSIZE5,TEXSIZE5};
  597. int MipLevels = 1;
  598. string Format = AL_TEXFORMAT ;
  599. >;
  600. sampler2D ScnSampOut5 = sampler_state {
  601. texture = <ScnMapOut5>;
  602. MinFilter = Linear;
  603. MagFilter = Linear;
  604. MipFilter = Point;
  605. AddressU = Clamp;
  606. AddressV = Clamp;
  607. };
  608. #endif
  609.  
  610. // グレアを記録するためのレンダーターゲット
  611. texture2D ScnMapGlare : RENDERCOLORTARGET <
  612. float2 ViewPortRatio = {TEXSIZE2,TEXSIZE2};
  613. int MipLevels = 1;
  614. string Format = AL_TEXFORMAT ;
  615. >;
  616. sampler2D ScnSampGlare = sampler_state {
  617. texture = <ScnMapGlare>;
  618. MinFilter = Linear;
  619. MagFilter = Linear;
  620. MipFilter = Point;
  621. AddressU = Clamp;
  622. AddressV = Clamp;
  623. };
  624.  
  625.  
  626. #if AFTERGLOW!=0
  627.  
  628. // 残光を記録するためのレンダーターゲット
  629. texture2D AfterGlowMap : RENDERCOLORTARGET <
  630. float2 ViewPortRatio = {TEXSIZE2,TEXSIZE2};
  631. int MipLevels = 1;
  632. string Format = AL_TEXFORMAT ;
  633. >;
  634. sampler2D AfterGlowSamp = sampler_state {
  635. texture = <AfterGlowMap>;
  636. MinFilter = Linear;
  637. MagFilter = Linear;
  638. MipFilter = Point;
  639. AddressU = Clamp;
  640. AddressV = Clamp;
  641. };
  642.  
  643. #endif
  644.  
  645. ////////////////////////////////////////////////////////////////////////////////////////////////
  646. // 白とび表現関数
  647. float4 OverExposure(float4 color){
  648.  
  649. #define OVEREXPOSUREGAMMA 1 // new ###
  650. #if OVEREXPOSUREGAMMA==1
  651. color.rgb = pow(color.rgb, 1.8);
  652. #endif
  653.  
  654. float4 newcolor = color;
  655.  
  656. //ある色が1を超えると、他の色にあふれる
  657. newcolor.gb += max(color.r - 1, 0) * OverExposureRatio * float2(0.65, 0.6);
  658. newcolor.rb += max(color.g - 1, 0) * OverExposureRatio * float2(0.5, 0.6);
  659. newcolor.rg += max(color.b - 1, 0) * OverExposureRatio * float2(0.5, 0.6);
  660.  
  661. #if OVEREXPOSUREGAMMA==1
  662. newcolor.rgb = pow(newcolor.rgb, 1/1.8);
  663. #endif
  664.  
  665.  
  666. return newcolor;
  667. }
  668.  
  669.  
  670. ////////////////////////////////////////////////////////////////////////////////////////////////
  671. //キーカラー比較
  672.  
  673. float ColorMuch(float4 color1, float3 key){
  674. float3 s = color1.rgb - key;
  675. float val = length(s) / KeyThreshold;
  676. val = saturate((1 - val) * 4);
  677. return val;
  678. }
  679.  
  680. ////////////////////////////////////////////////////////////////////////////////////////////////
  681. //トーンカーブの調整
  682. //自分でも何がどうなっているかよくわからない関数になってしまったが、
  683. //何となくうまく動いているので怖くていじれない
  684.  
  685. float4 ToneCurve(float4 Color){
  686. float3 newcolor;
  687. const float th = 0.65;
  688. newcolor = normalize(Color.rgb) * (th + sqrt(max(0, (length(Color.rgb) - th) / 2))); //normalize scales 3d vector to 1
  689. newcolor.r = (Color.r > 0) ? newcolor.r : Color.r;
  690. newcolor.g = (Color.g > 0) ? newcolor.g : Color.g;
  691. newcolor.b = (Color.b > 0) ? newcolor.b : Color.b;
  692.  
  693. Color.rgb = min(Color.rgb, newcolor);
  694. //for 1,1,1, output should be 1.068*0.577=0.617? 0.65,0.65,0.65 outputs 0.375? why did nothing change when I turned this off in Mix function?
  695. //tested again, it does change. Maybe strength/size was too low before or just tested it wrong.
  696. return Color;
  697. }
  698.  
  699. ////////////////////////////////////////////////////////////////////////////////////////////////
  700. //共通頂点シェーダ
  701. struct VS_OUTPUT {
  702. float4 Pos : POSITION;
  703. float2 Tex : TEXCOORD0;
  704. };
  705.  
  706. VS_OUTPUT VS_ALDraw( float4 Pos : POSITION, float2 Tex : TEXCOORD0 , uniform int miplevel) {
  707. VS_OUTPUT Out = (VS_OUTPUT)0;
  708.  
  709.  
  710. #ifdef MIKUMIKUMOVING
  711. float ofsetsize = 1;
  712. #else
  713. float ofsetsize = pow(2, miplevel);
  714. #endif
  715.  
  716.  
  717. Out.Pos = Pos;
  718. Out.Tex = Tex + float2(ViewportOffset.x, ViewportOffset.y) * ofsetsize;
  719.  
  720. return Out;
  721. }
  722.  
  723.  
  724. ////////////////////////////////////////////////////////////////////////////////////////////////
  725. //高輝度成分の抽出
  726.  
  727. struct DoubleColor{
  728. float4 Color0 : COLOR0;
  729. float4 Color1 : COLOR1;
  730. };
  731.  
  732. DoubleColor PS_DrawHighLight( float2 Tex: TEXCOORD0 ) {
  733. DoubleColor Out = (DoubleColor)0;
  734. float4 Color, OrgColor, OverLightColor, ExtColor;
  735.  
  736. Color = tex2Dlod(EmitterView, float4(Tex, 0, 0));
  737. //Color.a = 0;
  738.  
  739. //元スクリーンの高輝度成分の抽出
  740. OrgColor = tex2Dlod(ScnSamp, float4(Tex, 0, 0));
  741. OverLightColor = OrgColor * OverLight;
  742. OverLightColor = max(0, OverLightColor - 0.98);
  743. OverLightColor = ToneCurve(OverLightColor);
  744.  
  745. #if KEYCOLOR_NUM!=0 //I think this is off by default
  746. [unroll] //ループ展開
  747. for(int i = 0; i < KEYCOLOR_NUM; i++){
  748. float cm = ColorMuch(OrgColor, KeyColors[i][0]);
  749. Color.rgb += cm * KeyColors[i][2];
  750. Out.Color1 = lerp(Out.Color1, float4(KeyColors[i][1], 1), cm); //linear interpolation
  751. }
  752. #endif
  753.  
  754. Color *= timerate;
  755.  
  756. ExtColor = tex2Dlod(ExternalHighLightView, float4(Tex, 0, 0));
  757. Color.rgb += (OverLightColor.rgb * !ExternLightSampling + ExtColor.rgb);
  758.  
  759. Color *= scaling * 2;
  760.  
  761. Color.a = 1;
  762.  
  763. Out.Color0 = Color;
  764.  
  765. return Out;
  766. }
  767.  
  768. ////////////////////////////////////////////////////////////////////////////////////////////////
  769.  
  770. #define HLSampler HighLightView
  771.  
  772. ////////////////////////////////////////////////////////////////////////////////////////////////
  773. // MipMap利用ぼかし
  774.  
  775. float4 PS_AL_Gaussian( float2 Tex: TEXCOORD0,
  776. uniform bool Horizontal, uniform sampler2D Samp,
  777. uniform int miplevel, uniform int scalelevel
  778. ) : COLOR {
  779.  
  780. float e, n = 0;
  781. float2 stex;
  782. float4 Color, sum = 0;
  783. float scalepow = pow(2, scalelevel);
  784. float step = (Horizontal ? AL_SampStepScaled.x : AL_SampStepScaled.y) * scalepow;
  785. const float2 dir = float2(Horizontal, !Horizontal);
  786. float4 scolor;
  787.  
  788. [unroll] //ループ展開
  789. for(int i = -AL_SAMP_NUM; i <= AL_SAMP_NUM; i++){
  790. e = exp(-pow((float)i / (AL_SAMP_NUM / 2.0), 2) / 2); //正規分布
  791. //might be possible to improve performance by hardcoding these numbers. exp=expression? is -pow negative and how does that help? is this effect creating multiple images and combining them; is it doing this for every pixel; why would this be necessary if it already has a normal distribution?
  792. stex = Tex + dir * (step * (float)i);
  793. scolor = tex2Dlod( Samp, float4(stex, 0, miplevel)); //how expensive is it to call this in a loop for each pixel, if that's what it does, instead of calling it once and adding it to multiple pixels with a different 'e'? too hard to test, don't even know if it's possible to do it that way
  794. sum += scolor * e;
  795. n += e; //probably unnecessary, proportional to AL_SAMP_NUM. Maybe slight change in total brightness if you changed AL_SAMP_NUM and simplified this. Every step in the loop counts, probably!
  796. }
  797.  
  798. Color = sum / n ; // ###
  799. #if DISTANTBRIGHT==1 //new variable!
  800. //don't understand alpha here, there's the complicated stuff in the mix part where it might get 'un-premultiplied' or something. Just going with float4 here because it's what the rest uses.
  801. //Color += tex2Dlod( Samp, float4(Tex, 0, miplevel)) * DistantBrightStrength; //no lod would just use Tex, try both; 10 is a guess. Might look bad. Was 5 but didn't test.
  802. Color += tex2D( Samp, Tex) * DistantBrightStrength;
  803.  
  804. //this was probably to brighten eye highlight but didn't work
  805. //float4 tempcolor = tex2D(Samp, Tex);
  806. //Color = max( Color + tempcolor * DistantBrightStrength, tempcolor);
  807.  
  808. //not gamma-corrected but I don't even care. Main problem might be that however the glowing color is derived (not even sure if it's described in this effect file), it gets blurred and darkens at a distance.
  809. #endif
  810.  
  811. //低輝度領域の光の広がりを制限
  812. //if(!Horizontal) Color = max(0, abs(Color) - scalepow * (2 - alpha1) * 0.002) * sign(Color);
  813. //Color = max(0, abs(Color) - scalepow * 0.0007) * sign(Color);
  814. // if(!Horizontal) Color = min(abs(Color), pow(abs(Color), 1 + scalelevel * 0.1 * (2 - alpha1) * Modest)) * sign(Color);
  815. // turned this off, it uses 'Modest' and somehow makes small objects less bright. *Because it's less than one, it gets smaller with high exponent. ###
  816.  
  817. return Color;
  818. }
  819.  
  820.  
  821. ////////////////////////////////////////////////////////////////////////////////////////////////
  822. //方向性ぼかし
  823.  
  824. float4 PS_AL_DirectionalBlur( float2 Tex: TEXCOORD0 , uniform sampler2D Samp, uniform bool isfirst) : COLOR {
  825. float e, n = 0;
  826. float2 stex1, stex2, stex3, stex4;
  827. float4 Color, sum = 0;
  828. float4 sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0;
  829.  
  830. float step = AL_SampStep2 * (1.0 + cos(AL_LoopIndex * 5.1 + rot.x * 10) * 0.3);
  831.  
  832. float ang = (AL_LoopIndex * 180.0 / (int)Glare) * PI / 180 + GlareAngle;
  833. float2 dir = float2(cos(ang) / ViewportAspect, sin(ang)) * step;
  834. float p = 1;
  835.  
  836. #if GLARE_LONGONE!=0
  837. p = (1 + (AL_LoopIndex == 0)) * 0.7;
  838. dir *= p;
  839. #endif
  840.  
  841. [unroll] //ループ展開
  842. for(int i = -AL_SAMP_NUM2; i <= AL_SAMP_NUM2; i++){
  843. e = exp(-pow((float)i / (AL_SAMP_NUM2 / 2.0), 2) / 2); //正規分布
  844. if(isfirst){
  845. stex1 = Tex + dir * ((float)i * 1.0);
  846. stex2 = Tex + dir * ((float)i * 1.8);
  847. stex3 = Tex + dir * ((float)i * 3.9);
  848. //stex4 = Tex + dir * ((float)i * 7.7);
  849. }else{
  850. stex1 = Tex + dir * ((float)i * 0.75);
  851. }
  852. if(isfirst){
  853. sum1 += max(0, tex2Dlod( Samp, float4(stex1, 0, 1) )) * e;
  854. sum2 += max(0, tex2Dlod( Samp, float4(stex2, 0, 2) )) * e;
  855. sum3 += max(0, tex2Dlod( Samp, float4(stex3, 0, 3) )) * e;
  856. //sum4 += max(0, tex2Dlod( Samp, float4(stex4, 0, 4) )) * e;
  857. }else{
  858. sum1 += max(0, tex2Dlod( Samp, float4(stex1, 0, 0) )) * e;
  859. }
  860.  
  861. n += e;
  862. }
  863.  
  864. sum1 /= n;
  865. sum2 /= n;
  866. sum3 /= n;
  867. //sum4 /= n;
  868.  
  869. sum1 = max(0, sum1 - 0.006); sum2 = max(0, sum2 - 0.015); sum3 = max(0, sum3 - 0.029); //sum4 = max(0, sum4 - 0.032);
  870.  
  871. Color = sum1 + sum2 + sum3 + sum4;
  872.  
  873. if(isfirst){
  874. Color *= GlareAspect;
  875. Color *= p;
  876. Color /= sqrt(0.2 + (float)((int)Glare));
  877. Color = ToneCurve(Color * GlarePower);
  878. }
  879.  
  880. return Color;
  881. }
  882.  
  883. ////////////////////////////////////////////////////////////////////////////////////////////////
  884.  
  885. //this looks useful but I think it's off because KEYCOLOR_NUM=0 lol
  886. float4 PS_DrawCoreColor( float2 Tex: TEXCOORD0 ) : COLOR {
  887. float4 Color;
  888.  
  889. Color = tex2D(ScnSampOut, Tex);
  890.  
  891. Color = max(Color, 0.8 * tex2D( ScnSampOut, Tex+float2(0,OnePx.y)));
  892. Color = max(Color, 0.8 * tex2D( ScnSampOut, Tex+float2(0,-OnePx.y)));
  893. Color = max(Color, 0.8 * tex2D( ScnSampOut, Tex+float2(OnePx.x,0)));
  894. Color = max(Color, 0.8 * tex2D( ScnSampOut, Tex+float2(-OnePx.x,0)));
  895.  
  896. Color = max(Color, 0.5 * tex2D( ScnSampOut, Tex+float2(OnePx.x,OnePx.y)));
  897. Color = max(Color, 0.5 * tex2D( ScnSampOut, Tex+float2(OnePx.x,-OnePx.y)));
  898. Color = max(Color, 0.5 * tex2D( ScnSampOut, Tex+float2(-OnePx.x,OnePx.y)));
  899. Color = max(Color, 0.5 * tex2D( ScnSampOut, Tex+float2(-OnePx.x,-OnePx.y)));
  900.  
  901. return Color;
  902. }
  903.  
  904. ////////////////////////////////////////////////////////////////////////////////////////////////
  905.  
  906. #if AFTERGLOW!=0
  907. float4 PS_AfterGlowCopy( float2 Tex: TEXCOORD0 ) : COLOR {
  908. float4 Color = tex2D(AfterGlowSamp, Tex);
  909. float2 step = AL_SampStep * 0.1;
  910.  
  911. Color += tex2D(AfterGlowSamp, Tex + float2(step.x, 0));
  912. Color += tex2D(AfterGlowSamp, Tex - float2(step.x, 0));
  913. Color += tex2D(AfterGlowSamp, Tex + float2(0, step.y));
  914. Color += tex2D(AfterGlowSamp, Tex - float2(0, step.y));
  915. Color /= 5;
  916.  
  917.  
  918. Color *= (1.0 - 1.0 / AFTERGLOW);
  919. //Color -= 0.1;
  920. //Color = max(Color, 0);
  921.  
  922. return Color;
  923. }
  924. #endif
  925.  
  926. ////////////////////////////////////////////////////////////////////////////////////////////////
  927. //合成
  928.  
  929. float4 PS_AL_Mix( float2 Tex: TEXCOORD0 , uniform bool FullOut) : COLOR {
  930.  
  931. float4 Color;
  932.  
  933. float crate1 = 1, crate2 = 1, crate3 = 1, crate4 = 0.8;
  934.  
  935. Color = tex2D(ScnSampOut, Tex);
  936. Color += tex2D(ScnSampOut2, Tex) * crate1;
  937. Color += tex2D(ScnSampOut3, Tex) * crate2;
  938. #if USESCREEN5!=0
  939. Color += tex2D(ScnSampOut4, Tex) * crate3; //what if you turn these off? visual difference; do you have to turn it off elsewhere for performance increase?
  940. #endif
  941.  
  942. #if USESCREEN5!=0
  943. Color += tex2D(ScnSampOut5, Tex) * crate4;
  944. #endif
  945.  
  946. Color *= (1 - 0.3 * (Glare >= 1));
  947.  
  948. Color += tex2D(ScnSampGlare, Tex);
  949.  
  950. if(!ScreenToneCurve) Color = ToneCurve(Color); //トーンカーブの調整
  951.  
  952. //マスクの適用
  953. #if MASK_ENABLE!=0
  954. Color *= 1 - tex2D(MaskView, Tex).a;
  955. #endif
  956.  
  957. #if AFTERGLOW!=0
  958. Color = max(Color, tex2D(ScnSampX2, Tex));
  959. #endif
  960.  
  961. if(!FullOut){
  962. Color.a = saturate(Color.a);
  963. return Color;
  964. }
  965.  
  966.  
  967. float4 basecolor = tex2D(ScnSamp, Tex);
  968. basecolor.rgb *= OverLight;
  969. basecolor.rgb = saturate(basecolor.rgb); //if hdr, multiply by 1.02 first, then divide by 1.02; also increase glare for 'step 0' in one map
  970. Color.rgb=saturate(Color.rgb/2)*2; //added
  971. Color = pow(pow(Color,1.8) + pow(basecolor*(1-max(length(Color.rgb)/2-0.3,0)),1.8),1/1.8); //was linear ###
  972.  
  973. //白とび表現
  974. Color = OverExposure(Color);
  975.  
  976. if(ScreenToneCurve) Color = ToneCurve(Color); //トーンカーブの調整
  977.  
  978. Color.a = basecolor.a + length(Color.rgb);
  979. Color.a = saturate(Color.a);
  980. Color.rgb /= Color.a;
  981.  
  982. return Color;
  983. }
  984.  
  985. ////////////////////////////////////////////////////////////////////////////////////////////////
  986.  
  987. float4 PS_Test( float2 Tex: TEXCOORD0 ) : COLOR {
  988. return float4(tex2D(HighLightView, Tex).rgb * TestValue * 0.1, 1);
  989. //return float4(tex2D(EmitterView, Tex).rgb, 1);
  990.  
  991. }
  992.  
  993. ////////////////////////////////////////////////////////////////////////////////////////////////
  994. //テクニック
  995.  
  996. // レンダリングターゲットのクリア値
  997.  
  998. float4 ClearColor = {0,0,0,0};
  999. float ClearDepth = 1.0;
  1000.  
  1001.  
  1002. technique AutoLuminous <
  1003. string Script =
  1004.  
  1005. "RenderColorTarget0=ExternalHighLight;"
  1006. "ClearSetColor=ClearColor;"
  1007. "Clear=Color;"
  1008.  
  1009. "RenderColorTarget0=ScnMap;"
  1010. "RenderDepthStencilTarget=DepthBuffer;"
  1011. "ClearSetColor=BackColor; ClearSetDepth=ClearDepth;"
  1012. "Clear=Color; Clear=Depth;"
  1013. "ScriptExternal=Color;"
  1014.  
  1015. "RenderColorTarget0=HighLight;"
  1016. "RenderColorTarget1=ScnMapOut;"
  1017. "ClearSetColor=ClearColor; ClearSetDepth=ClearDepth;"
  1018. "Clear=Color; Clear=Depth;"
  1019. "Pass=DrawHighLight;"
  1020.  
  1021. #if KEYCOLOR_NUM!=0
  1022. "RenderColorTarget0=ScnMap;"
  1023. "RenderColorTarget1=;"
  1024. "RenderDepthStencilTarget=DepthBuffer;"
  1025. "Pass=DrawCoreColor;"
  1026. #endif
  1027.  
  1028.  
  1029.  
  1030. "RenderColorTarget0=ScnMapGlare;"
  1031. "RenderColorTarget1=;"
  1032. "RenderDepthStencilTarget=DepthBuffer2;"
  1033. "Clear=Color; Clear=Depth;"
  1034.  
  1035. "LoopByCount=Glare;"
  1036. "LoopGetIndex=AL_LoopIndex;"
  1037.  
  1038. "RenderColorTarget0=ScnMapX2;"
  1039. "Clear=Color; Clear=Depth;"
  1040. "Pass=AL_DirectionalBlur1;"
  1041.  
  1042. "RenderColorTarget0=ScnMapGlare;"
  1043. "Clear=Depth;"
  1044. "Pass=AL_DirectionalBlur2;"
  1045.  
  1046. "LoopEnd=;"
  1047.  
  1048.  
  1049. "RenderColorTarget0=ScnMapX;"
  1050. "RenderColorTarget1=;"
  1051. "RenderDepthStencilTarget=DepthBuffer;"
  1052. "ClearSetColor=ClearColor; ClearSetDepth=ClearDepth;"
  1053. "Clear=Color; Clear=Depth;"
  1054. "Pass=AL_Gaussian_X;"
  1055.  
  1056. "RenderColorTarget0=ScnMapOut;"
  1057. "Clear=Color; Clear=Depth;"
  1058. "Pass=AL_Gaussian_Y;"
  1059.  
  1060. "RenderColorTarget0=ScnMapX2;"
  1061. "RenderDepthStencilTarget=DepthBuffer2;"
  1062. "Clear=Color; Clear=Depth;"
  1063. "Pass=AL_Gaussian_X2;"
  1064.  
  1065. "RenderColorTarget0=ScnMapOut2;"
  1066. "Clear=Color; Clear=Depth;"
  1067. "Pass=AL_Gaussian_Y2;"
  1068.  
  1069. "RenderColorTarget0=ScnMapX3;"
  1070. "RenderDepthStencilTarget=DepthBuffer3;"
  1071. "Clear=Color; Clear=Depth;"
  1072. "Pass=AL_Gaussian_X3;"
  1073.  
  1074. "RenderColorTarget0=ScnMapOut3;"
  1075. "Clear=Color; Clear=Depth;"
  1076. "Pass=AL_Gaussian_Y3;"
  1077.  
  1078. #if USESCREEN5!=0
  1079. "RenderColorTarget0=ScnMapX4;"
  1080. "RenderDepthStencilTarget=DepthBuffer4;"
  1081. "Clear=Color; Clear=Depth;"
  1082. "Pass=AL_Gaussian_X4;"
  1083.  
  1084. "RenderColorTarget0=ScnMapOut4;"
  1085. "Clear=Color; Clear=Depth;"
  1086. "Pass=AL_Gaussian_Y4;"
  1087. #endif
  1088.  
  1089. #if USESCREEN5!=0
  1090. "RenderColorTarget0=ScnMapX5;"
  1091. "RenderDepthStencilTarget=DepthBuffer5;"
  1092. "Clear=Color; Clear=Depth;"
  1093. "Pass=AL_Gaussian_X5;"
  1094.  
  1095. "RenderColorTarget0=ScnMapOut5;"
  1096. "Clear=Color; Clear=Depth;"
  1097. "Pass=AL_Gaussian_Y5;"
  1098. #endif
  1099.  
  1100.  
  1101. #if AFTERGLOW!=0
  1102. "RenderColorTarget0=ScnMapX2;"
  1103. "RenderDepthStencilTarget=DepthBuffer2;"
  1104. "ClearSetColor=ClearColor; ClearSetDepth=ClearDepth;"
  1105. "Clear=Color; Clear=Depth;"
  1106. "Pass=AfterGlowCopy;"
  1107.  
  1108. "RenderColorTarget0=AfterGlowMap;"
  1109. "RenderDepthStencilTarget=DepthBuffer2;"
  1110. "ClearSetDepth=ClearDepth;"
  1111. "Clear=Depth;"
  1112. "Pass=AfterGlow;"
  1113. #endif
  1114.  
  1115. "RenderColorTarget0=;"
  1116. "RenderDepthStencilTarget=;"
  1117. "ClearSetColor=ClearColor; ClearSetDepth=ClearDepth;"
  1118. "Clear=Depth;"
  1119. "Clear=Color;"
  1120. "Pass=AL_Mix;"
  1121.  
  1122. "LoopByCount=TestMode;"
  1123. "LoopGetIndex=AL_LoopIndex;"
  1124.  
  1125. "Pass=AL_Test;"
  1126.  
  1127. "LoopEnd=;"
  1128. ;
  1129.  
  1130. > {
  1131.  
  1132. pass AL_Gaussian_X < string Script= "Draw=Buffer;"; > {
  1133. AlphaBlendEnable = false;
  1134. AlphaTestEnable = false;
  1135. VertexShader = compile vs_3_0 VS_ALDraw(0);
  1136. PixelShader = compile ps_3_0 PS_AL_Gaussian(true, HLSampler, 0, 0);
  1137. }
  1138. pass AL_Gaussian_Y < string Script= "Draw=Buffer;"; > {
  1139. AlphaBlendEnable = false;
  1140. AlphaTestEnable = false;
  1141. VertexShader = compile vs_3_0 VS_ALDraw(0);
  1142. PixelShader = compile ps_3_0 PS_AL_Gaussian(false, ScnSampX, 0, 0);
  1143. }
  1144.  
  1145. pass AL_Gaussian_X2 < string Script= "Draw=Buffer;"; > {
  1146. AlphaBlendEnable = false;
  1147. AlphaTestEnable = false;
  1148. VertexShader = compile vs_3_0 VS_ALDraw(1);
  1149. PixelShader = compile ps_3_0 PS_AL_Gaussian(true, HLSampler, 2, 2);
  1150. }
  1151. pass AL_Gaussian_Y2 < string Script= "Draw=Buffer;"; > {
  1152. AlphaBlendEnable = false;
  1153. AlphaTestEnable = false;
  1154. VertexShader = compile vs_3_0 VS_ALDraw(1);
  1155. PixelShader = compile ps_3_0 PS_AL_Gaussian(false, ScnSampX2, 0, 2);
  1156. }
  1157.  
  1158. pass AL_Gaussian_X3 < string Script= "Draw=Buffer;"; > {
  1159. AlphaBlendEnable = false;
  1160. AlphaTestEnable = false;
  1161. VertexShader = compile vs_3_0 VS_ALDraw(2);
  1162. PixelShader = compile ps_3_0 PS_AL_Gaussian(true, HLSampler, 4, 4);
  1163. }
  1164. pass AL_Gaussian_Y3 < string Script= "Draw=Buffer;"; > {
  1165. AlphaBlendEnable = false;
  1166. AlphaTestEnable = false;
  1167. VertexShader = compile vs_3_0 VS_ALDraw(2);
  1168. PixelShader = compile ps_3_0 PS_AL_Gaussian(false, ScnSampX3, 0, 4);
  1169. }
  1170.  
  1171. #if USESCREEN4!=0
  1172. pass AL_Gaussian_X4 < string Script= "Draw=Buffer;"; > {
  1173. AlphaBlendEnable = false;
  1174. AlphaTestEnable = false;
  1175. VertexShader = compile vs_3_0 VS_ALDraw(3);
  1176. PixelShader = compile ps_3_0 PS_AL_Gaussian(true, HLSampler, 5, 5);
  1177. }
  1178. pass AL_Gaussian_Y4 < string Script= "Draw=Buffer;"; > {
  1179. AlphaBlendEnable = false;
  1180. AlphaTestEnable = false;
  1181. VertexShader = compile vs_3_0 VS_ALDraw(3);
  1182. PixelShader = compile ps_3_0 PS_AL_Gaussian(false, ScnSampX4, 0, 5);
  1183. }
  1184. #endif
  1185.  
  1186. #if USESCREEN5!=0
  1187. pass AL_Gaussian_X5 < string Script= "Draw=Buffer;"; > {
  1188. AlphaBlendEnable = false;
  1189. AlphaTestEnable = false;
  1190. VertexShader = compile vs_3_0 VS_ALDraw(4);
  1191. PixelShader = compile ps_3_0 PS_AL_Gaussian(true, HLSampler, 7, 7);
  1192. }
  1193. pass AL_Gaussian_Y5 < string Script= "Draw=Buffer;"; > {
  1194. AlphaBlendEnable = false;
  1195. AlphaTestEnable = false;
  1196. VertexShader = compile vs_3_0 VS_ALDraw(4);
  1197. PixelShader = compile ps_3_0 PS_AL_Gaussian(false, ScnSampX5, 0, 7);
  1198. }
  1199. #endif
  1200.  
  1201.  
  1202. pass AL_DirectionalBlur1 < string Script= "Draw=Buffer;"; > {
  1203. SRCBLEND = ONE;
  1204. DESTBLEND = ONE;
  1205. AlphaTestEnable = false;
  1206. VertexShader = compile vs_3_0 VS_ALDraw(1);
  1207. PixelShader = compile ps_3_0 PS_AL_DirectionalBlur(HLSampler, true);
  1208. }
  1209.  
  1210. pass AL_DirectionalBlur2 < string Script= "Draw=Buffer;"; > {
  1211. SRCBLEND = ONE;
  1212. DESTBLEND = ONE;
  1213. AlphaTestEnable = false;
  1214. VertexShader = compile vs_3_0 VS_ALDraw(1);
  1215. PixelShader = compile ps_3_0 PS_AL_DirectionalBlur(ScnSampX2, false);
  1216. }
  1217. pass AL_DirectionalBlur3 < string Script= "Draw=Buffer;"; > {
  1218. SRCBLEND = ONE;
  1219. DESTBLEND = ONE;
  1220. AlphaTestEnable = false;
  1221. VertexShader = compile vs_3_0 VS_ALDraw(1);
  1222. PixelShader = compile ps_3_0 PS_AL_DirectionalBlur(ScnSampOut2, false);
  1223. }
  1224.  
  1225.  
  1226.  
  1227. pass DrawHighLight < string Script= "Draw=Buffer;"; > {
  1228. AlphaTestEnable = false;
  1229. AlphaBlendEnable = false;
  1230. VertexShader = compile vs_3_0 VS_ALDraw(0);
  1231. PixelShader = compile ps_3_0 PS_DrawHighLight();
  1232. }
  1233.  
  1234. pass DrawCoreColor < string Script= "Draw=Buffer;"; > {
  1235. AlphaTestEnable = true;
  1236. AlphaBlendEnable = true;
  1237. VertexShader = compile vs_3_0 VS_ALDraw(0);
  1238. PixelShader = compile ps_3_0 PS_DrawCoreColor();
  1239. }
  1240.  
  1241. #if AFTERGLOW!=0
  1242. pass AfterGlowCopy < string Script= "Draw=Buffer;"; > {
  1243. AlphaTestEnable = false;
  1244. VertexShader = compile vs_3_0 VS_ALDraw(1);
  1245. PixelShader = compile ps_3_0 PS_AfterGlowCopy();
  1246. }
  1247.  
  1248. pass AfterGlow < string Script= "Draw=Buffer;"; > {
  1249.  
  1250. #if ALPHA_OUT!=0
  1251. AlphaBlendEnable = false;
  1252. AlphaTestEnable = false;
  1253. #endif
  1254.  
  1255. VertexShader = compile vs_3_0 VS_ALDraw(1);
  1256. PixelShader = compile ps_3_0 PS_AL_Mix(false);
  1257. }
  1258.  
  1259. #endif
  1260.  
  1261. pass AL_Mix < string Script= "Draw=Buffer;"; > {
  1262.  
  1263. #if ALPHA_OUT!=0
  1264. AlphaBlendEnable = false;
  1265. AlphaTestEnable = false;
  1266. #endif
  1267.  
  1268. VertexShader = compile vs_3_0 VS_ALDraw(0);
  1269. PixelShader = compile ps_3_0 PS_AL_Mix(true);
  1270. }
  1271.  
  1272. pass AL_Test < string Script= "Draw=Buffer;"; > {
  1273. AlphaBlendEnable = false;
  1274. AlphaTestEnable = false;
  1275. VertexShader = compile vs_3_0 VS_ALDraw(0);
  1276. PixelShader = compile ps_3_0 PS_Test();
  1277. }
  1278. }
  1279.  
  1280. ////////////////////////////////////////////////////////////////////////////////////////////////
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×