Guest User

AL_Object.fxsub Edit

a guest
May 21st, 2025
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.12 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // 発光部位描画エフェクト for AutoLuminous
  4. // Ver.4.2
  5. //
  6. ////////////////////////////////////////////////////////////////////////////////////////////////
  7.  
  8. // PMDパラメータ
  9. float3 Origin : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "スケール原点"; >;
  10. float3 ScaleXYZ : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "スケール変更"; >;
  11. float Expansion : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "拡大"; >;
  12. float Reduction : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "縮小"; >;
  13. float Expansion2 : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "拡大2"; >;
  14. float Reduction2 : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "縮小2"; >;
  15. float Expansion3 : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "拡大3"; >;
  16. float Reduction3 : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "縮小3"; >;
  17. float Expansion4 : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "拡大4"; >;
  18. float Reduction4 : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "縮小4"; >;
  19. float Expansion100 : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "拡大100"; >;
  20. float Reduction100 : CONTROLOBJECT < string name = "ScaleControl.pmd"; string item = "縮小100"; >;
  21.  
  22.  
  23.  
  24. static float3 Scale = float3( clamp( pow(10.0f, 0.1f*ScaleXYZ.x), 0.01f, 100.0f ),
  25. clamp( pow(10.0f, 0.1f*ScaleXYZ.y), 0.01f, 100.0f ),
  26. clamp( pow(10.0f, -0.1f*ScaleXYZ.z), 0.01f, 100.0f ) );
  27. static float ScaleAll = (1.0f + 9.0f*Expansion)*(1.0f - 0.9f*Reduction)*(1.0f + 9.0f*Expansion2)*(1.0f - 0.9f*Reduction2)*(1.0f + 9.0f*Expansion3)*(1.0f - 0.9f*Reduction3)*(1.0f + 9.0f*Expansion4)*(1.0f - 0.9f*Reduction4)*(1.0f + 99.0f*Expansion100)*(1.0f - 0.99f*Reduction100);
  28.  
  29.  
  30.  
  31.  
  32.  
  33. //#define USE_AL_CODE
  34. //PERFORMANCE (for MWF_ObjectEmit): No difference. With AL code, 22 fps; without AL code, 22 fps; with default shader, 22 fps. But without AL code compiles ~4 times faster.
  35. //Under test condition 2, one CPU at 1.6 GHz (and zoomed in a bit), AL code is 44 fps, no AL code is 51 fps. (default shader 31 fps.)
  36. //Condition 3, maximized window, no code is 39.5 fps, code is 34.5 fps, default is 23 fps.
  37.  
  38. //異方性フィルタリング作業用テクスチャサイズ
  39. // 0で無効化 (MMDx64では0推奨)
  40. #define MIPMAPTEX_SIZE 0 //512
  41.  
  42. //発光部分を少し前面に押し出す
  43. // 0で無効、1で有効
  44. #define POPUP_LIGHT 0
  45.  
  46. //テクスチャ高輝度識別フラグ
  47. //#define TEXTURE_SELECTLIGHT
  48.  
  49. //テクスチャ高輝度識別閾値
  50. float LightThreshold = 0.9; //was 0.9
  51.  
  52. //フレーム数に同期させるかどうか
  53. #define SYNC false
  54.  
  55.  
  56. ////////////////////////////////////////////////////////////////////////////////////////////////
  57. //Clone連携機能
  58.  
  59. //Cloneのパラメータ読み込み指定
  60. #define CLONE_PARAMINCLUDE
  61.  
  62. //以下のコメントアウトを外し、クローンエフェクトファイル名を指定
  63. //include "Clone.fx"
  64.  
  65. //ダミー変数・関数宣言
  66. #ifndef CLONE_MIPMAPTEX_SIZE
  67. int CloneIndex = 0; //ループ変数
  68. int CloneCount = 1; //複製数
  69. float4 ClonePos(float4 Pos) { return Pos; }
  70. #endif
  71.  
  72. ////////////////////////////////////////////////////////////////////////////////////////////////
  73.  
  74.  
  75. #define SPECULAR_BASE 100
  76.  
  77.  
  78.  
  79. bool use_toon; //トゥーンの有無
  80.  
  81.  
  82. // マテリアル色
  83. float4 MaterialDiffuse : DIFFUSE < string Object = "Geometry"; >;
  84. float3 MaterialAmbient : AMBIENT < string Object = "Geometry"; >;
  85. float3 MaterialEmissive : EMISSIVE < string Object = "Geometry"; >;
  86. float3 MaterialSpecular : SPECULAR < string Object = "Geometry"; >;
  87.  
  88. #ifdef MIKUMIKUMOVING
  89. float SpecularPower : SPECULARPOWER < string Object = "Geometry"; >;
  90. static float materialAlpha = MaterialDiffuse.a;
  91. #else
  92. float4 EgColor; // ... how does this do anything
  93. float4 SpcColor;
  94. static float SpecularPower = SpcColor.a;
  95. static float materialAlpha = EgColor.a;
  96. #endif
  97.  
  98. // 座法変換行列
  99. float4x4 WorldViewProjMatrix : WORLDVIEWPROJECTION;
  100. //float4x4 WorldMatrix : WORLD;
  101. //float4x4 ViewMatrix : VIEW;
  102. float4x4 LightWorldViewProjMatrix : WORLDVIEWPROJECTION < string Object = "Light"; >;
  103.  
  104.  
  105. float3 CameraDirection : DIRECTION < string Object = "Camera"; >;
  106.  
  107. #define PI 3.14159
  108.  
  109. float LightUp : CONTROLOBJECT < string name = "(self)"; string item = "LightUp"; >;
  110. float LightUpE : CONTROLOBJECT < string name = "(self)"; string item = "LightUpE"; >;
  111. float LightOff : CONTROLOBJECT < string name = "(self)"; string item = "LightOff"; >;
  112. float Blink : CONTROLOBJECT < string name = "(self)"; string item = "LightBlink"; >;
  113. float BlinkSq : CONTROLOBJECT < string name = "(self)"; string item = "LightBS"; >;
  114. float BlinkDuty : CONTROLOBJECT < string name = "(self)"; string item = "LightDuty"; >;
  115. float BlinkMin : CONTROLOBJECT < string name = "(self)"; string item = "LightMin"; >;
  116. float LClockUp : CONTROLOBJECT < string name = "(self)"; string item = "LClockUp"; >;
  117. float LClockDown : CONTROLOBJECT < string name = "(self)"; string item = "LClockDown"; >;
  118.  
  119. //時間
  120. float ftime : TIME <bool SyncInEditMode = SYNC;>;
  121.  
  122. static float duty = (BlinkDuty <= 0) ? 0.5 : BlinkDuty;
  123. static float timerate = ((Blink > 0) ? ((1 - cos(saturate(frac(ftime / (Blink * 10)) / (duty * 2)) * 2 * PI)) * 0.5) : 1.0)
  124. * ((BlinkSq > 0) ? (frac(ftime / (BlinkSq * 10)) < duty) : 1.0);
  125. static float timerate1 = timerate * (1 - BlinkMin) + BlinkMin;
  126.  
  127. static float ClockShift = (1 + LClockDown * 5) / (1 + LClockUp * 5);
  128.  
  129. static bool IsEmission = (SPECULAR_BASE < SpecularPower)/* && (SpecularPower <= (SPECULAR_BASE + 100))*/ && (length(MaterialSpecular) < 0.01);
  130. static float EmissionPower0 = IsEmission ? ((SpecularPower - SPECULAR_BASE) / 7.0) : 1;
  131. static float EmissionPower1 = EmissionPower0 * (LightUp * 2 + 1.0) * pow(400, LightUpE) * (1.0 - LightOff);
  132.  
  133.  
  134. sampler MMDSamp0 : register(s0);
  135. sampler MMDSamp1 : register(s1);
  136. sampler MMDSamp2 : register(s2);
  137.  
  138.  
  139. // レンダリングターゲットのクリア値
  140. float4 ClearColor = {0,0,0,0};
  141. float ClearDepth = 1.0;
  142.  
  143.  
  144. #if MIPMAPTEX_SIZE==0
  145. #define DRAWSCRIPT "RenderColorTarget0=;" \
  146. "RenderDepthStencilTarget=;" \
  147. "LoopByCount=CloneCount;" \
  148. "LoopGetIndex=CloneIndex;" \
  149. "Pass=DrawObject;" \
  150. "LoopEnd=;"
  151.  
  152. #define MIPMAPSCRIPT "RenderColorTarget0=;" \
  153. "RenderDepthStencilTarget=;" \
  154. "LoopByCount=CloneCount;" \
  155. "LoopGetIndex=CloneIndex;" \
  156. "Pass=DrawObject;" \
  157. "LoopEnd=;"
  158.  
  159. #define CREATEMIPMAP
  160.  
  161. // オブジェクトのテクスチャ
  162. texture ObjectTexture: MATERIALTEXTURE;
  163. sampler ObjTexSampler = sampler_state {
  164. texture = <ObjectTexture>;
  165. MINFILTER = ANISOTROPIC;
  166. MAGFILTER = ANISOTROPIC;
  167. //MINFILTER = LINEAR;
  168. //MAGFILTER = LINEAR;
  169. MIPFILTER = LINEAR;
  170. MAXANISOTROPY = 16;
  171. };
  172.  
  173. #else
  174. #define DRAWSCRIPT "RenderColorTarget0=;" \
  175. "RenderDepthStencilTarget=;" \
  176. "LoopByCount=CloneCount;" \
  177. "LoopGetIndex=CloneIndex;" \
  178. "Pass=DrawObject;" \
  179. "LoopEnd=;"
  180.  
  181. #define MIPMAPSCRIPT "RenderColorTarget0=UseMipmapObjectTexture;" \
  182. "RenderDepthStencilTarget=MipDepthBuffer;" \
  183. "ClearSetColor=ClearColor; Clear=Color;" \
  184. "ClearSetDepth=ClearDepth; Clear=Depth;" \
  185. "Pass=CreateMipmap;" \
  186. "RenderColorTarget0=;" \
  187. "RenderDepthStencilTarget=;" \
  188. "LoopByCount=CloneCount;" \
  189. "LoopGetIndex=CloneIndex;" \
  190. "Pass=DrawObject;" \
  191. "LoopEnd=;"
  192.  
  193. #define CREATEMIPMAP pass CreateMipmap < string Script= "Draw=Buffer;"; > { \
  194. AlphaBlendEnable = FALSE; \
  195. ZEnable = FALSE; \
  196. VertexShader = compile vs_3_0 VS_MipMapCreater(); \
  197. PixelShader = compile ps_3_0 PS_MipMapCreater(); \
  198. }
  199.  
  200. // オブジェクトのテクスチャ
  201. texture ObjectTexture: MATERIALTEXTURE<
  202. int MipLevels = 0;
  203. >;
  204. sampler DefObjTexSampler = sampler_state {
  205. texture = <ObjectTexture>;
  206. MINFILTER = LINEAR;
  207. MAGFILTER = LINEAR;
  208. };
  209.  
  210. texture2D MipDepthBuffer : RenderDepthStencilTarget <
  211. int Width = MIPMAPTEX_SIZE;
  212. int Height = MIPMAPTEX_SIZE;
  213. string Format = "D24S8";
  214. >;
  215. texture UseMipmapObjectTexture : RENDERCOLORTARGET <
  216. int Width = MIPMAPTEX_SIZE;
  217. int Height = MIPMAPTEX_SIZE;
  218. int MipLevels = 0;
  219. string Format = "A8R8G8B8" ;
  220. >;
  221. sampler ObjTexSampler = sampler_state {
  222. texture = <UseMipmapObjectTexture>;
  223. MINFILTER = ANISOTROPIC;
  224. MAGFILTER = ANISOTROPIC;
  225. MIPFILTER = LINEAR;
  226. MAXANISOTROPY = 16;
  227. };
  228.  
  229. // テクセル位置のオフセット
  230. static float2 MipTexOffset = (float2(0.5,0.5)/MIPMAPTEX_SIZE);
  231.  
  232. #endif
  233.  
  234.  
  235. // スフィアマップのテクスチャ
  236. texture ObjectSphereMap: MATERIALSPHEREMAP;
  237. sampler ObjSphareSampler = sampler_state {
  238. texture = <ObjectSphereMap>;
  239. MINFILTER = POINT;
  240. MAGFILTER = POINT;
  241. MIPFILTER = NONE;
  242. AddressU = CLAMP;
  243. AddressV = CLAMP;
  244. };
  245. sampler ObjSphareSampler2 = sampler_state {
  246. texture = <ObjectSphereMap>;
  247. MINFILTER = LINEAR;
  248. MAGFILTER = LINEAR;
  249. MIPFILTER = NONE;
  250. AddressU = CLAMP;
  251. AddressV = CLAMP;
  252. };
  253.  
  254. ////////////////////////////////////////////////////////////////////////////////////////////////
  255. //MMM対応
  256.  
  257. #ifdef MIKUMIKUMOVING
  258.  
  259. #define GETPOS MMM_SkinnedPosition(IN.Pos, IN.BlendWeight, IN.BlendIndices, IN.SdefC, IN.SdefR0, IN.SdefR1)
  260.  
  261. #else
  262.  
  263. struct MMM_SKINNING_INPUT{
  264. float4 Pos : POSITION;
  265. float2 Tex : TEXCOORD0;
  266. float4 AddUV1 : TEXCOORD1;
  267. float4 AddUV2 : TEXCOORD2;
  268. float4 AddUV3 : TEXCOORD3;
  269. float4 Normal : NORMAL;
  270.  
  271. };
  272.  
  273. #define GETPOS (IN.Pos)
  274.  
  275. #endif
  276.  
  277. ////////////////////////////////////////////////////////////////////////////////////////////////
  278. // ミップマップ作成
  279.  
  280. #if MIPMAPTEX_SIZE!=0
  281. struct VS_OUTPUT_MIPMAPCREATER {
  282. float4 Pos : POSITION;
  283. float2 Tex : TEXCOORD0;
  284. };
  285. VS_OUTPUT_MIPMAPCREATER VS_MipMapCreater( float4 Pos : POSITION, float4 Tex : TEXCOORD0 ){
  286. VS_OUTPUT_MIPMAPCREATER Out;
  287. Out.Pos = Pos;
  288. Out.Tex = Tex + MipTexOffset;
  289. return Out;
  290. }
  291.  
  292. float4 PS_MipMapCreater(float2 Tex: TEXCOORD0) : COLOR0
  293. {
  294. return tex2D(DefObjTexSampler,Tex);
  295. }
  296.  
  297. #endif
  298.  
  299. ///////////////////////////////////////////////////////////////////////////////////////////////
  300.  
  301. float texlight(float3 rgb){
  302. float val = saturate((length(rgb) - LightThreshold) * 3);
  303.  
  304. val *= 0.2;
  305.  
  306. return val;
  307. }
  308.  
  309. ///////////////////////////////////////////////////////////////////////////////////////////////
  310.  
  311. float3 HSV_to_RGB(float3 hsv){
  312. float H = frac(hsv.x);
  313. float S = hsv.y;
  314. float V = hsv.z;
  315.  
  316. float3 Color = 0;
  317.  
  318. float Hp3 = H * 6.0;
  319. float h = floor(Hp3);
  320. float P = V * (1 - S);
  321. float Q = V * (1 - S * (Hp3 - h));
  322. float T = V * (1 - S * (1 - (Hp3 - h)));
  323.  
  324. /*if(h <= 0.01) { Color.rgb = float3(V, T, P); }
  325. else if(h <= 1.01) { Color.rgb = float3(Q, V, P); }
  326. else if(h <= 2.01) { Color.rgb = float3(P, V, T); }
  327. else if(h <= 3.01) { Color.rgb = float3(P, Q, V); }
  328. else if(h <= 4.01) { Color.rgb = float3(T, P, V); }
  329. else { Color.rgb = float3(V, P, Q); }*/
  330.  
  331. Color.rgb += float3(V, T, P) * max(0, 1 - abs(h - 0));
  332. Color.rgb += float3(Q, V, P) * max(0, 1 - abs(h - 1));
  333. Color.rgb += float3(P, V, T) * max(0, 1 - abs(h - 2));
  334. Color.rgb += float3(P, Q, V) * max(0, 1 - abs(h - 3));
  335. Color.rgb += float3(T, P, V) * max(0, 1 - abs(h - 4));
  336. Color.rgb += float3(V, P, Q) * max(0, 1 - abs(h - 5));
  337.  
  338. return Color;
  339. }
  340.  
  341. ///////////////////////////////////////////////////////////////////////////////////////////////
  342. // 追加UVがAL用データかどうか判別
  343.  
  344. bool DecisionSystemCode(float4 SystemCode){
  345. bool val = (0.199 < SystemCode.r) && (SystemCode.r < 0.201)
  346. && (0.699 < SystemCode.g) && (SystemCode.g < 0.701);
  347. return val;
  348. }
  349.  
  350.  
  351. float4 getFlags(float flagcode){
  352. float4 val = frac(flagcode * float4(0.1, 0.01, 0.001, 0.0001));
  353. val = floor(val * 10 + 0.001);
  354. return val;
  355. }
  356.  
  357.  
  358. float2 DecisionSequenceCode(float4 color){
  359. bool val = (color.r > 0.99) && (abs(color.g - 0.5) < 0.02)
  360. && ((color.b < 0.01) || (color.g > 0.99));
  361.  
  362. return float2(val, (color.b < 0.01));
  363. }
  364.  
  365. ///////////////////////////////////////////////////////////////////////////////////////////////
  366. // オブジェクト描画
  367.  
  368. struct VS_OUTPUT {
  369. float4 Pos : POSITION; // 射影変換座標
  370. float4 Color : TEXCOORD0; // 色
  371. float4 Tex : TEXCOORD1; // UV
  372. };
  373.  
  374.  
  375. // 頂点シェーダ
  376. VS_OUTPUT Basic_VS(MMM_SKINNING_INPUT IN)
  377. {
  378. VS_OUTPUT Out = (VS_OUTPUT)0;
  379.  
  380. #ifdef USE_AL_CODE
  381. float4 SystemCode = IN.AddUV1;
  382. float4 ColorCode = IN.AddUV2;
  383. float4 AppendCode = IN.AddUV3;
  384.  
  385. bool IsALCode = DecisionSystemCode(SystemCode);
  386. float4 flags = getFlags(SystemCode.w);
  387. #endif
  388.  
  389. // カメラ視点のワールドビュー射影変換
  390. float4 pos = GETPOS; //位置取得
  391.  
  392. float4 TransPos(float4 Pos : POSITION) : POSITION
  393. {
  394. Pos.x -= Origin.x;
  395. Pos.y -= Origin.y;
  396. Pos.z -= Origin.z;
  397.  
  398. Pos.x *= ScaleAll * Scale.x;
  399. Pos.y *= ScaleAll * Scale.y;
  400. Pos.z *= ScaleAll * Scale.z;
  401.  
  402. Pos.x += Origin.x;
  403. Pos.y += Origin.y;
  404. Pos.z += Origin.z;
  405.  
  406. return Pos;
  407. }
  408.  
  409. Pos = TransPos(Pos);
  410.  
  411. pos = ClonePos(pos);
  412.  
  413. #ifdef USE_AL_CODE
  414. pos.xyz += IsALCode * AppendCode.z * IN.Normal.xyz;
  415. #endif
  416.  
  417. Out.Pos = mul( pos, WorldViewProjMatrix );
  418.  
  419. Out.Color = MaterialDiffuse;
  420. Out.Color.a = materialAlpha;
  421. Out.Color.rgb += MaterialEmissive / 2;
  422. Out.Color.rgb *= 0.5;
  423. Out.Color.rgb = IsEmission ? Out.Color.rgb : float3(0,0,0);
  424.  
  425. #ifdef USE_AL_CODE
  426. // 頂点発光 ////////////////////////
  427.  
  428. float3 UVColor = ColorCode.rgb;
  429. UVColor = lerp(UVColor, HSV_to_RGB(UVColor), flags.y);
  430. UVColor *= ColorCode.a;
  431.  
  432. Out.Color.rgb += IsALCode ? UVColor : float3(0,0,0);
  433.  
  434. float Tv = SystemCode.z * ClockShift;
  435. float Ph = AppendCode.y * ClockShift;
  436. float timerate2 = (Tv > 0) ? ((1 - cos(saturate(frac((ftime + Ph) / Tv) / (duty * 2)) * 2 * PI)) * 0.5)
  437. : ((Tv < 0) ? (frac((ftime + Ph) / (-Tv / PI * 180)) < duty) : 1.0);
  438. Out.Color.rgb *= max(timerate2 * (1 - BlinkMin) + BlinkMin, !IsALCode);
  439. Out.Color.rgb *= max(timerate1, SystemCode.z != 0);
  440. #else
  441. Out.Color.rgb *= timerate1;
  442. #endif
  443.  
  444. ////////////////////////
  445.  
  446. Out.Tex.xy = IN.Tex; //テクスチャUV
  447. #ifdef USE_AL_CODE
  448. Out.Tex.z = IsALCode * AppendCode.x;
  449. Out.Tex.w = IsALCode * flags.x;
  450. #endif
  451.  
  452. #if POPUP_LIGHT
  453. Out.Pos.z -= 0.01 * saturate(length(Out.Color.rgb));
  454. #endif
  455.  
  456. return Out;
  457. }
  458.  
  459. ///////////////////////////////////////////////////////////////////////////////////////////////
  460.  
  461. // ピクセルシェーダ
  462. float4 Basic_PS(VS_OUTPUT IN, uniform bool useTexture, uniform bool useSphereMap) : COLOR0
  463. {
  464. float4 Color = IN.Color;
  465. float4 texcolor;
  466.  
  467.  
  468. #ifdef USE_AL_CODE
  469. // 発光シーケンス ////////////////////////
  470.  
  471. if(useSphereMap){
  472. //float4 spcolor1 = tex2Dlod(ObjSphareSampler, float4(1,0,0,0));
  473. float4 spcolor2 = tex2Dlod(ObjSphareSampler, float4(1,1,0,0));
  474.  
  475. float4 spcolor3 = tex2Dlod(ObjSphareSampler, float4(0,1,0,0));
  476.  
  477. float Ts = spcolor3.r * (255 * 60) + spcolor3.g * 255 + spcolor3.b * (255 / 100.0);
  478. Ts *= ClockShift;
  479.  
  480. float t1 = frac((ftime/* + Ph * IsALCode*/) / Ts);
  481. float4 spcolor4 = tex2Dlod(ObjSphareSampler, float4(t1 * 0.25,0,0,0));
  482. float4 spcolor5 = tex2Dlod(ObjSphareSampler2, float4(t1 * 0.25,0,0,0));
  483.  
  484. float2 sel = DecisionSequenceCode(spcolor2);
  485.  
  486. Color.rgb *= lerp(float3(1,1,1), lerp(spcolor5.rgb, spcolor4.rgb, sel.y), sel.x);
  487.  
  488. }
  489. #endif
  490.  
  491.  
  492. if(useTexture){
  493.  
  494. texcolor = tex2D(ObjTexSampler,IN.Tex.xy);
  495. #ifdef USE_AL_CODE
  496. texcolor.rgb = saturate(texcolor.rgb - IN.Tex.z);
  497. #endif
  498.  
  499. #ifdef TEXTURE_SELECTLIGHT
  500. Color = texcolor;
  501. Color.rgb *= texlight(Color.rgb);
  502. #else
  503. #ifdef USE_AL_CODE
  504. float4 Color2, Color3;
  505.  
  506. Color2 = Color * texcolor;
  507. Color3 = Color * texcolor;
  508. Color3.rgb *= texlight(texcolor.rgb);
  509.  
  510. Color = (IN.Tex.w < 0.1) ? Color2 : ((IN.Tex.w < 1.1) ? Color : Color3);
  511. #else
  512. Color *= texcolor;
  513. #endif //USE_AL_CODE
  514.  
  515. #endif //TEXTURE_SELECTLIGHT
  516.  
  517. }
  518.  
  519. //Color.rgb *= lerp(EmissionPower0, EmissionPower1, (float)use_toon);
  520. Color.rgb *= use_toon ? EmissionPower1 : EmissionPower0;
  521.  
  522. return Color;
  523. }
  524.  
  525. ///////////////////////////////////////////////////////////////////////////////////////////////
  526.  
  527. // オブジェクト描画用テクニック
  528.  
  529. #ifdef USE_AL_CODE
  530. #define SPHERE bool UseSphereMap = false;
  531. #else
  532. #define SPHERE
  533. #endif
  534.  
  535. technique MainTec1 < string MMDPass = "object"; bool UseTexture = false; SPHERE
  536. string Script = DRAWSCRIPT;
  537. > {
  538. pass DrawObject {
  539. VertexShader = compile vs_3_0 Basic_VS();
  540. PixelShader = compile ps_3_0 Basic_PS(false, false);
  541. }
  542. }
  543.  
  544. technique MainTec2 < string MMDPass = "object"; bool UseTexture = true; SPHERE
  545. string Script = MIPMAPSCRIPT;
  546. > {
  547.  
  548. CREATEMIPMAP
  549.  
  550. pass DrawObject {
  551. VertexShader = compile vs_3_0 Basic_VS();
  552. PixelShader = compile ps_3_0 Basic_PS(true, false);
  553. }
  554. }
  555.  
  556. #ifdef USE_AL_CODE
  557. technique MainTec3 < string MMDPass = "object"; bool UseTexture = false; bool UseSphereMap = true;
  558. string Script = DRAWSCRIPT;
  559. > {
  560. pass DrawObject {
  561. VertexShader = compile vs_3_0 Basic_VS();
  562. PixelShader = compile ps_3_0 Basic_PS(false, true);
  563. }
  564. }
  565.  
  566. technique MainTec4 < string MMDPass = "object"; bool UseTexture = true; bool UseSphereMap = true;
  567. string Script = MIPMAPSCRIPT;
  568. > {
  569.  
  570. CREATEMIPMAP
  571.  
  572. pass DrawObject {
  573. VertexShader = compile vs_3_0 Basic_VS();
  574. PixelShader = compile ps_3_0 Basic_PS(true, true);
  575. }
  576. }
  577. #endif
  578.  
  579. technique MainTecBS1 < string MMDPass = "object_ss"; bool UseTexture = false; SPHERE
  580. string Script = DRAWSCRIPT;
  581. > {
  582. pass DrawObject {
  583. VertexShader = compile vs_3_0 Basic_VS();
  584. PixelShader = compile ps_3_0 Basic_PS(false, false);
  585. }
  586. }
  587.  
  588. technique MainTecBS2 < string MMDPass = "object_ss"; bool UseTexture = true; SPHERE
  589. string Script = MIPMAPSCRIPT;
  590. > {
  591.  
  592. CREATEMIPMAP
  593.  
  594. pass DrawObject {
  595. VertexShader = compile vs_3_0 Basic_VS();
  596. PixelShader = compile ps_3_0 Basic_PS(true, false);
  597. }
  598. }
  599.  
  600. #ifdef USE_AL_CODE
  601. technique MainTecBS3 < string MMDPass = "object_ss"; bool UseTexture = false; bool UseSphereMap = true;
  602. string Script = DRAWSCRIPT;
  603. > {
  604. pass DrawObject {
  605. VertexShader = compile vs_3_0 Basic_VS();
  606. PixelShader = compile ps_3_0 Basic_PS(false, true);
  607. }
  608. }
  609.  
  610. technique MainTecBS4 < string MMDPass = "object_ss"; bool UseTexture = true; bool UseSphereMap = true;
  611. string Script = MIPMAPSCRIPT;
  612. > {
  613.  
  614. CREATEMIPMAP
  615.  
  616. pass DrawObject {
  617. VertexShader = compile vs_3_0 Basic_VS();
  618. PixelShader = compile ps_3_0 Basic_PS(true, true);
  619. }
  620. }
  621. #endif
  622.  
  623. ///////////////////////////////////////////////////////////////////////////////////////////////
  624.  
  625. //影や輪郭は描画しない
  626. technique EdgeTec < string MMDPass = "edge"; > { }
  627. technique ShadowTec < string MMDPass = "shadow"; > { }
  628. technique ZplotTec < string MMDPass = "zplot"; > { }
  629.  
Add Comment
Please, Sign In to add comment