Guest User

Updated PanelLightObject.fxsub with point light

a guest
Jun 30th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.70 KB | None | 0 0
  1. // See boards.4chan.org/e/thread/2329745#p2331303
  2.  
  3. ////////////////////////////////////////////////////////////////////////////////////////////////
  4. //
  5. // PanelLightObject.fxsub Non Shadow Edition ver1.0
  6. // 作成: そぼろ
  7. //
  8. ////////////////////////////////////////////////////////////////////////////////////////////////
  9. // ユーザーパラメータ
  10.  
  11. //ライト発光強度
  12. float LightPower2 = 3;
  13.  
  14. //拡散光係数
  15. float AmbientPower = 0.15;
  16.  
  17. //距離減衰係数(0~4程度)
  18. float Distance_Attenuate = 1.6;
  19.  
  20. // Added to distance
  21. #define EXTRA_DISTANCE 12.0
  22.  
  23. // Only use one. Opposite side of panel.
  24. //#define OPPOSITE_ATTRACTS_LIGHT // Bugged
  25. //#define OPPOSITE_SHINES_LIGHT
  26. //#define OPPOSITE_ATTRACTS_LIGHT_V2 // Wouldn't work. Mirrored position gives 'panel shines light'
  27. #define OPPOSITE_SHINES_LIGHT_V2 // Actually attracts light, because THIS IS REALLY CONFUSING. But it's smooth and doesn't need the 'fade at panel plane' thing.
  28.  
  29. // Because messing with distance didn't work well enough. This might limit the 'sum' from the complicated math. 3.0: too high, no effect. 0.01: too small.
  30. //#define MAXIMUM_LIGHT 0.2
  31.  
  32. // Point light from center of panel, because opposite light is too hard
  33. #define EXTRA_POINT_LIGHT_STRENGTH 25.0
  34.  
  35. #define POINT_LIGHT_OFFSET float3(0,3.0,0)
  36. #define EXTRA_DISTANCE_FOR_POINT_LIGHT_ONLY 5.0
  37.  
  38. // Point light uses AmbientColor2 instead of AmbientColor. More light for accessories.
  39.  
  40. //ライトマップテクスチャ:コメントアウト解除で有効化
  41. //#define LIGHTMAP_TEXTURE "lightmap1.png"
  42.  
  43. //疑似トゥーン処理
  44. #define PARATOON 1
  45.  
  46. ////////////////////////////////////////////////////////////////////////////////////////////////
  47. // パラメータ宣言
  48.  
  49.  
  50. // 座法変換行列
  51. float4x4 WorldViewProjMatrix : WORLDVIEWPROJECTION;
  52. float4x4 WorldMatrix : WORLD;
  53. float4x4 ViewMatrix : VIEW;
  54.  
  55. float3 CameraPosition : POSITION < string Object = "Camera"; >;
  56.  
  57. // マテリアル色
  58. float4 MaterialDiffuse : DIFFUSE < string Object = "Geometry"; >;
  59. float3 MaterialAmbient : AMBIENT < string Object = "Geometry"; >;
  60. float3 MaterialEmissive : EMISSIVE < string Object = "Geometry"; >;
  61. float3 MaterialSpecular : SPECULAR < string Object = "Geometry"; >;
  62. float SpecularPower : SPECULARPOWER < string Object = "Geometry"; >;
  63. float3 MaterialToon : TOONCOLOR;
  64. float4 EdgeColor : EDGECOLOR;
  65. // ライト色
  66. float3 LightDiffuse : DIFFUSE < string Object = "Light"; >;
  67. float3 LightAmbient : AMBIENT < string Object = "Light"; >;
  68. float3 LightSpecular : SPECULAR < string Object = "Light"; >;
  69.  
  70.  
  71.  
  72. //光強度のMMDからの制御
  73. float alpha1 : CONTROLOBJECT < string name = "(OffscreenOwner)"; string item = "Tr"; >;
  74. float size_acc : CONTROLOBJECT < string name = "(OffscreenOwner)"; >;
  75. float4x4 matrix_acc : CONTROLOBJECT < string name = "(OffscreenOwner)"; >;
  76.  
  77. //PMX入力
  78. float power_pmx : CONTROLOBJECT < string name = "(OffscreenOwner)"; string item = "Power"; >;
  79. float size_pmx : CONTROLOBJECT < string name = "(OffscreenOwner)"; string item = "Size"; >;
  80. float4x4 matrix_pmx : CONTROLOBJECT < string name = "(OffscreenOwner)"; string item = "発光中心"; >;
  81.  
  82. bool exist_acc : CONTROLOBJECT < string name = "PanelLight.x"; >;
  83.  
  84. static bool IsPMX = (power_pmx > 0) || (size_pmx > 0) || (!exist_acc);
  85.  
  86. //パラメータ入力選択
  87. static float power_in = lerp(alpha1, power_pmx, IsPMX);
  88. static float size_in = lerp(size_acc, size_pmx * 100, IsPMX);
  89.  
  90. static float4x4 sizemat = { size_in, 0, 0, 0,
  91. 0, size_in, 0, 0,
  92. 0, 0, size_in, 0,
  93. 0, 0, 0, 1};
  94.  
  95. static float4x4 LightMatrix = lerp(matrix_acc, mul(sizemat, matrix_pmx), IsPMX);
  96. static float3 LightMainCenter = mul(float4(0, 0, 0, 1), LightMatrix).xyz;
  97.  
  98. static float3 LightMainVector = normalize(mul(float4(0, 1, 0, 1), LightMatrix).xyz - LightMainCenter);
  99. static float3 LightXVector = normalize(mul(float4(1, 0, 0, 1), LightMatrix).xyz - LightMainCenter);
  100. static float3 LightZVector = normalize(mul(float4(0, 0, 1, 1), LightMatrix).xyz - LightMainCenter);
  101.  
  102.  
  103. bool use_toon;
  104.  
  105. //ライトパワー
  106. static const float lpower = power_in * LightPower2;
  107.  
  108. //制御色合成
  109. static const float4 DiffuseColor = MaterialDiffuse * float4(LightDiffuse, 1.0f);
  110. static float3 AmbientColor = MaterialAmbient * lerp(0.7, 1.2, use_toon) + MaterialEmissive * lerp(1, 0.7, use_toon);
  111. static const float3 SpecularColor = MaterialSpecular;
  112.  
  113. static float3 AmbientColor2 = (MaterialAmbient + MaterialEmissive) * (use_toon ? 0.3 : 1.0); // More light for accessories. Is balanced or something; also, accessories probably have lower ambient/emissive because diffuse adds to color, while 'toon' subtracts from color. 'Gamma-space light'.
  114.  
  115. //距離減衰の中央位置設定。PowerCenterがなければ20
  116.  
  117. #define PowerCenterDistance 20
  118. #define PowerColdDistance 3
  119.  
  120.  
  121. bool transp; // 半透明フラグ
  122. bool spadd; // スフィアマップ加算合成フラグ
  123. #define SKII1 1500
  124. #define SKII2 8000
  125. #define Toon 3
  126.  
  127.  
  128. // MMD本来のsamplerを上書きしないための記述です。削除不可。
  129. sampler MMDSamp0 : register(s0);
  130. sampler MMDSamp1 : register(s1);
  131. sampler MMDSamp2 : register(s2);
  132.  
  133. // スフィアマップのテクスチャ
  134. texture ObjectSphereMap: MATERIALSPHEREMAP;
  135. sampler ObjSphareSampler = sampler_state {
  136. texture = <ObjectSphereMap>;
  137. MINFILTER = ANISOTROPIC;
  138. MAGFILTER = ANISOTROPIC;
  139. MIPFILTER = LINEAR;
  140. MAXANISOTROPY = 16;
  141. };
  142.  
  143. // オブジェクトのテクスチャ
  144. texture ObjectTexture: MATERIALTEXTURE;
  145. sampler ObjTexSampler = sampler_state {
  146. texture = <ObjectTexture>;
  147. MINFILTER = ANISOTROPIC;
  148. MAGFILTER = ANISOTROPIC;
  149. MIPFILTER = LINEAR;
  150. MAXANISOTROPY = 16;
  151. };
  152.  
  153. ////////////////////////////////////////////////////////////////////////////////////////////////
  154.  
  155. #ifdef LIGHTMAP_TEXTURE
  156. //光源テクスチャ
  157. texture2D Tex1 <
  158. string ResourceName = LIGHTMAP_TEXTURE;
  159. int MipLevels = 0;
  160. >;
  161. sampler Tex1Samp = sampler_state {
  162. texture = <Tex1>;
  163. MINFILTER = LINEAR;
  164. MAGFILTER = LINEAR;
  165. MIPFILTER = LINEAR;
  166. AddressU = CLAMP;
  167. AddressV = CLAMP;
  168. };
  169.  
  170. #endif
  171.  
  172. ////////////////////////////////////////////////////////////////////////////////////////////////
  173. //MMM対応
  174.  
  175. #ifdef MIKUMIKUMOVING
  176.  
  177. #define GETPOS MMM_SkinnedPosition(IN.Pos, IN.BlendWeight, IN.BlendIndices, IN.SdefC, IN.SdefR0, IN.SdefR1)
  178.  
  179. int voffset : VERTEXINDEXOFFSET;
  180.  
  181. #else
  182.  
  183. struct MMM_SKINNING_INPUT{
  184. float4 Pos : POSITION;
  185. float2 Tex : TEXCOORD0;
  186. float4 AddUV1 : TEXCOORD1;
  187. float4 AddUV2 : TEXCOORD2;
  188. float4 AddUV3 : TEXCOORD3;
  189. float3 Normal : NORMAL;
  190. int Index : _INDEX;
  191. };
  192.  
  193. #define GETPOS (IN.Pos)
  194.  
  195. const int voffset = 0;
  196.  
  197. #endif
  198.  
  199. ////////////////////////////////////////////////////////////////////////////////////////////
  200. // 輪郭描画
  201.  
  202. // 頂点シェーダ
  203. float4 ColorRender_VS(MMM_SKINNING_INPUT IN) : POSITION
  204. {
  205. // カメラ視点のワールドビュー射影変換
  206. return mul( GETPOS, WorldViewProjMatrix );
  207. }
  208.  
  209. // ピクセルシェーダ
  210. float4 ColorRender_PS() : COLOR
  211. {
  212. // 黒で塗りつぶし
  213. return float4(0,0,0,1);
  214. }
  215.  
  216. // 輪郭描画用テクニック
  217. technique EdgeTec < string MMDPass = "edge"; > {
  218. pass DrawEdge {
  219. AlphaBlendEnable = FALSE;
  220. AlphaTestEnable = FALSE;
  221. VertexShader = compile vs_2_0 ColorRender_VS();
  222. PixelShader = compile ps_2_0 ColorRender_PS();
  223. }
  224. }
  225.  
  226.  
  227. ///////////////////////////////////////////////////////////////////////////////////////////////
  228. // 影描画
  229.  
  230. // 地面影は表示しない
  231. technique ShadowTec < string MMDPass = "shadow"; > { }
  232. // MMD標準のセルフシャドウは表示しない
  233. technique ZplotTec < string MMDPass = "zplot"; > { }
  234.  
  235.  
  236. ///////////////////////////////////////////////////////////////////////////////////////////////
  237. // オブジェクト描画(セルフシャドウOFF)
  238.  
  239. struct VS_OUTPUT {
  240. float4 Pos : POSITION; // 射影変換座標
  241. float4 ZCalcTex : TEXCOORD0; // Z値
  242. float2 Tex : TEXCOORD1; // テクスチャ
  243. float3 Normal : TEXCOORD2; // 法線
  244. float3 PosFromLight : TEXCOORD3; // カメラとの相対位置
  245. float2 SpTex : TEXCOORD4; // スフィアマップテクスチャ座標
  246. float4 WorldPos : TEXCOORD5; // ワールド座標
  247.  
  248. };
  249.  
  250. // 頂点シェーダ
  251. VS_OUTPUT Basic_VS(MMM_SKINNING_INPUT IN, uniform bool useTexture, uniform bool useSphereMap, uniform bool useToon)
  252. {
  253. VS_OUTPUT Out = (VS_OUTPUT)0;
  254.  
  255. float4 pos = GETPOS;
  256.  
  257. ////ワールド座標の算出
  258. Out.WorldPos = mul( pos, WorldMatrix );
  259.  
  260. // カメラ視点のワールドビュー射影変換
  261. Out.Pos = mul( pos, WorldViewProjMatrix );
  262.  
  263. //ライトとの相対位置
  264. Out.PosFromLight = Out.WorldPos.xyz - LightMainCenter.xyz;
  265.  
  266. // 頂点法線
  267. Out.Normal = normalize( mul( IN.Normal, (float3x3)WorldMatrix ) );
  268.  
  269. // テクスチャ座標
  270. Out.Tex = IN.Tex;
  271.  
  272. if ( useSphereMap ) {
  273. // スフィアマップテクスチャ座標
  274. float2 NormalWV = mul( Out.Normal, (float3x3)ViewMatrix ).xy;
  275. Out.SpTex.x = NormalWV.x * 0.5f + 0.5f;
  276. Out.SpTex.y = NormalWV.y * -0.5f + 0.5f;
  277. }
  278.  
  279. return Out;
  280. }
  281.  
  282.  
  283. ////////////////////////////////////////////////////////////////////////////////////
  284. // ピクセルシェーダ
  285.  
  286.  
  287. static float3 rectvtx1 = mul(float4( 2, 0, 2, 1), LightMatrix).xyz;
  288. static float3 rectvtx2 = mul(float4( 2, 0,-2, 1), LightMatrix).xyz;
  289. static float3 rectvtx3 = mul(float4(-2, 0,-2, 1), LightMatrix).xyz;
  290. static float3 rectvtx4 = mul(float4(-2, 0, 2, 1), LightMatrix).xyz;
  291.  
  292.  
  293. float4 Basic_PS(VS_OUTPUT IN, uniform bool useTexture, uniform bool useSphereMap, uniform bool useToon) : COLOR0
  294. {
  295.  
  296. float4 Color = float4(0,0,0, DiffuseColor.a);
  297. float3 Specular = float3(0,0,0);
  298.  
  299. float Distance = dot(IN.PosFromLight, LightMainVector);
  300. float XDistance = dot(IN.PosFromLight, LightXVector);
  301. float ZDistance = dot(IN.PosFromLight, LightZVector);
  302.  
  303. float DistanceRate = 1 / (max(0, (Distance + EXTRA_DISTANCE) / 10) + 0.5) ; // Added EXTRA_DISTANCE and the 4.0
  304. DistanceRate = pow(max(0, DistanceRate), Distance_Attenuate) * (1 + Distance_Attenuate * 0.5) * 1.5; // 4.0 goes here, now 1.5
  305.  
  306.  
  307. //境界積分法///////////////////////////////
  308. //参考:http://nis-lab.is.s.u-tokyo.ac.jp/~nis/CG/cgtxt/cg5/cg52.htm
  309.  
  310. //#ifdef OPPOSITE_ATTRACTS_LIGHT_V2
  311. #ifdef OPPOSITE_SHINES_LIGHT_V2
  312. IN.WorldPos.xyz -= Distance > 0 ? 0 : Distance * 2 * LightMainVector;
  313. IN.Normal = Distance > 0 ? IN.Normal: IN.Normal - dot(IN.Normal,LightMainVector) * 2 * LightMainVector;
  314. #endif
  315. float3 rectvtx_trans[5] = {
  316. rectvtx1 - IN.WorldPos.xyz,
  317. rectvtx2 - IN.WorldPos.xyz,
  318. rectvtx3 - IN.WorldPos.xyz,
  319. rectvtx4 - IN.WorldPos.xyz,
  320. rectvtx1 - IN.WorldPos.xyz
  321. };
  322. float sum = 0;
  323.  
  324. #ifndef MIKUMIKUMOVING
  325. [unroll] //ループ展開
  326. #endif
  327. for(int i = 0; i < 4; i++){
  328.  
  329. float3 p1 = rectvtx_trans[i];
  330. float3 p2 = rectvtx_trans[i+1];
  331.  
  332. float3 vec1 = normalize(p1);
  333. float3 vec2 = normalize(p2);
  334. float3 vec3 = cross(vec1, vec2);
  335.  
  336. float beta = acos(dot(vec1, vec2));
  337. float cos_sigma = dot(vec3, -IN.Normal);
  338.  
  339. //cos_sigma = sign(cos_sigma) * pow(cos_sigma, 0.3);
  340.  
  341. sum += beta * cos_sigma;
  342.  
  343. }
  344.  
  345. sum = sum * 0.08;
  346.  
  347. // Shines on both sides? Reverses light on opposite side. Step 2.
  348. #if defined OPPOSITE_SHINES_LIGHT || defined OPPOSITE_SHINES_LIGHT_V2
  349. sum *= Distance > 0 ? 1 : -1;
  350. #endif
  351.  
  352. sum = max(0, sum);
  353.  
  354. #if defined MAXIMUM_LIGHT
  355. sum = min(MAXIMUM_LIGHT, sum);
  356. #endif
  357.  
  358. #if PARATOON==1
  359. sum = sign(sum) * sqrt(sum) * 0.5; //疑似トゥーン
  360. #endif
  361. sum *= DistanceRate;
  362. //sum *= max(0, dot( IN.Normal, -LightMainVector ));
  363. #if !(defined OPPOSITE_ATTRACTS_LIGHT || defined OPPOSITE_SHINES_LIGHT || defined OPPOSITE_SHINES_LIGHT_V2) // 'Attracts light' doesn't work right
  364. //#if defined OPPOSITE_SHINES_LIGHT
  365. sum *= saturate(1 + dot( IN.Normal, -LightMainVector )) * (Distance > 0); //背面キャンセル
  366. // Step 1 of 'light shines on opposite side'. With just this, and not Step 2 above, light comes toward the panel on opposite side.
  367. #else
  368. sum *= saturate(1 + dot( IN.Normal, -LightMainVector * (Distance > 0 ? 1 : -1)));
  369. #endif
  370. // Weird effects at panel plane. But saturate() doesn't work for some reason... ok it's fine
  371. #if defined OPPOSITE_SHINES_LIGHT
  372. sum *= saturate(abs(Distance)*2.0);
  373. #endif
  374.  
  375. Color.rgb = AmbientColor.rgb * sum;
  376. Specular = pow( max(0, MaterialSpecular * sum), abs(SpecularPower) );
  377.  
  378.  
  379. //疑似アンビエント項/////////////////////
  380.  
  381. float ambient;
  382. float3 HLAmbient;
  383.  
  384. //ハーフランバート
  385. ambient = max(0, 0.4 + dot( IN.Normal, -LightMainVector ) * 0.6);
  386. //範囲制限
  387. ambient *= saturate((2.3 - abs((XDistance + EXTRA_DISTANCE) / size_in)) / 0.3);
  388. ambient *= saturate((2.3 - abs((ZDistance + EXTRA_DISTANCE) / size_in)) / 0.3) * 5.0; // Added the 4.0, now 5.0. Really have no idea how this was obtained, though.
  389.  
  390. HLAmbient = max(0, ambient * MaterialEmissive * AmbientPower);
  391. // Added the second MaterialToon, then removed it because model apparently isn't using toons anyway
  392. if(useToon) HLAmbient *= MaterialToon; // * MaterialToon; //トゥーン適用
  393.  
  394. Color.rgb = max(Color.rgb, HLAmbient);
  395.  
  396.  
  397. #ifdef EXTRA_POINT_LIGHT_STRENGTH
  398. // Usually not a problem. Normal could be the wrong way around. Maybe with two-sided faces or if it was just defined wrong. Result of below investigation.
  399. float PointLight = dot(-normalize(IN.PosFromLight + POINT_LIGHT_OFFSET), IN.Normal);
  400.  
  401. // I guess this might be fine, but... two-sided strands in hair catch the light? And lack of antialiasing? Trying to modify flipnormal to bias 'no change' didn't help.
  402. float flipnormal = (dot(IN.Normal, IN.WorldPos.xyz - CameraPosition + POINT_LIGHT_OFFSET) * PointLight) >= 0 ? 1 : -1;
  403. PointLight = max(flipnormal * PointLight, PointLight);
  404.  
  405. // Light goes towards back a little. LINEAR LIGHT.
  406. //PointLight = clamp((PointLight + 0.3), 0, 1);
  407. // Larger maximum area
  408. PointLight = max((PointLight + 0.3)/1.3, 0);
  409. PointLight *= EXTRA_POINT_LIGHT_STRENGTH;
  410. // Let's just leave this to show how bad it is.
  411. //PointLight /= Distance + EXTRA_DISTANCE; // EXTRA_DISTANCE is really essential here
  412. //PointLight *= (Distance + EXTRA_DISTANCE) * (Distance + EXTRA_DISTANCE);
  413. // Still wrong
  414. //PointLight /= (length(IN.PosFromLight) + EXTRA_DISTANCE) * (length(IN.PosFromLight) + EXTRA_DISTANCE);
  415. // Still wrong
  416. //PointLight /= (length(IN.PosFromLight) + EXTRA_DISTANCE) * (length(IN.PosFromLight) + EXTRA_DISTANCE);
  417. float modifiedDistance = length(IN.WorldPos.xyz - LightMainCenter.xyz + POINT_LIGHT_OFFSET) + EXTRA_DISTANCE_FOR_POINT_LIGHT_ONLY;
  418. PointLight /= modifiedDistance * modifiedDistance;
  419. // Convert to 'gamma' because the other colors probably are
  420. PointLight = sqrt(PointLight);
  421.  
  422. // Doing this later so can use AmbientColor2. Or... it's already done, so
  423. PointLight *= AmbientColor2;
  424. Color.rgb = max(Color.rgb,PointLight);
  425.  
  426. // Test. Result: accessory's corner has messed-up normals. Pointing downwards. (Maybe the face's vertexes are listed in the wrong order, or the normal is just upside down.)
  427. //Color.rgb = dot(IN.Normal, float3(0,1,0)) > -0.1 ; // Which is just IN.Normal.y.
  428. //Color.rgb = max(-IN.Normal.y,0);
  429. #endif // Point light
  430.  
  431. //テクスチャ適用/////////////////////
  432.  
  433. if ( useTexture ) {
  434. // テクスチャ適用
  435. float4 TexColor = tex2D( ObjTexSampler, IN.Tex );
  436. Color *= TexColor;
  437. }
  438. if ( useSphereMap ) {
  439. // スフィアマップ適用
  440. float4 TexColor = tex2D(ObjSphareSampler,IN.SpTex);
  441. if(spadd){
  442. //Color.rgb += TexColor.rgb;
  443. }else{
  444. Color.rgb *= TexColor.rgb;
  445. }
  446. }
  447.  
  448. // スペキュラ適用
  449. Color.rgb += Specular;
  450.  
  451. Color.rgb *= lpower;
  452.  
  453. //ライトマップテクスチャ適用
  454. #ifdef LIGHTMAP_TEXTURE
  455.  
  456. float2 uv = float2(XDistance, -ZDistance) / size_in / 4 + 0.5;
  457.  
  458. float3 extnm = IN.Normal * Distance / dot(IN.Normal, LightMainVector);
  459. float3 extpos = IN.WorldPos.xyz + extnm;
  460.  
  461. float2 extuv = float2(-dot(extpos, LightXVector), dot(extpos, LightZVector)) / size_in / 4 + 0.5;
  462.  
  463. float3 texcolor = (float3)0;
  464.  
  465. texcolor += tex2Dlod(Tex1Samp, float4(uv, 0, 2)).rgb;
  466. texcolor += tex2Dlod(Tex1Samp, float4(0.5,0.5, 0, 100)).rgb;
  467. texcolor += tex2Dlod(Tex1Samp, float4(extuv, 0, 4)).rgb;
  468. texcolor += float3(1,1,1);
  469.  
  470. texcolor /= 4;
  471.  
  472. Color.rgb *= texcolor;
  473.  
  474. #endif
  475.  
  476. return Color;
  477.  
  478. }
  479.  
  480.  
  481. ///////////////////////////////////////////////////////////////////////////////////////////////
  482. // テクニックのリスト
  483.  
  484. // オブジェクト描画用テクニック(アクセサリ用)
  485. technique MainTec0 < string MMDPass = "object"; bool UseTexture = false; bool UseSphereMap = false; bool UseToon = false; > {
  486. pass DrawObject {
  487. VertexShader = compile vs_3_0 Basic_VS(false, false, false);
  488. PixelShader = compile ps_3_0 Basic_PS(false, false, false);
  489. }
  490. }
  491.  
  492. technique MainTec1 < string MMDPass = "object"; bool UseTexture = true; bool UseSphereMap = false; bool UseToon = false; > {
  493. pass DrawObject {
  494. VertexShader = compile vs_3_0 Basic_VS(true, false, false);
  495. PixelShader = compile ps_3_0 Basic_PS(true, false, false);
  496. }
  497. }
  498.  
  499. technique MainTec2 < string MMDPass = "object"; bool UseTexture = false; bool UseSphereMap = true; bool UseToon = false; > {
  500. pass DrawObject {
  501. VertexShader = compile vs_3_0 Basic_VS(false, true, false);
  502. PixelShader = compile ps_3_0 Basic_PS(false, true, false);
  503. }
  504. }
  505.  
  506. technique MainTec3 < string MMDPass = "object"; bool UseTexture = true; bool UseSphereMap = true; bool UseToon = false; > {
  507. pass DrawObject {
  508. VertexShader = compile vs_3_0 Basic_VS(true, true, false);
  509. PixelShader = compile ps_3_0 Basic_PS(true, true, false);
  510. }
  511. }
  512.  
  513. // オブジェクト描画用テクニック(PMDモデル用)
  514. technique MainTec4 < string MMDPass = "object"; bool UseTexture = false; bool UseSphereMap = false; bool UseToon = true; > {
  515. pass DrawObject {
  516. VertexShader = compile vs_3_0 Basic_VS(false, false, true);
  517. PixelShader = compile ps_3_0 Basic_PS(false, false, true);
  518. }
  519. }
  520.  
  521. technique MainTec5 < string MMDPass = "object"; bool UseTexture = true; bool UseSphereMap = false; bool UseToon = true; > {
  522. pass DrawObject {
  523. VertexShader = compile vs_3_0 Basic_VS(true, false, true);
  524. PixelShader = compile ps_3_0 Basic_PS(true, false, true);
  525. }
  526. }
  527.  
  528. technique MainTec6 < string MMDPass = "object"; bool UseTexture = false; bool UseSphereMap = true; bool UseToon = true; > {
  529. pass DrawObject {
  530. VertexShader = compile vs_3_0 Basic_VS(false, true, true);
  531. PixelShader = compile ps_3_0 Basic_PS(false, true, true);
  532. }
  533. }
  534.  
  535. technique MainTec7 < string MMDPass = "object"; bool UseTexture = true; bool UseSphereMap = true; bool UseToon = true; > {
  536. pass DrawObject {
  537. VertexShader = compile vs_3_0 Basic_VS(true, true, true);
  538. PixelShader = compile ps_3_0 Basic_PS(true, true, true);
  539. }
  540. }
  541.  
  542.  
  543. ///////////////////////////////////////////////////////////////////////////////////////////////
  544. // オブジェクト描画(セルフシャドウON)
  545. // セルフシャドウOFF時と同じ描画を行う
  546.  
  547. // オブジェクト描画用テクニック(アクセサリ用)
  548. technique MainTecBS0 < string MMDPass = "object_ss"; bool UseTexture = false; bool UseSphereMap = false; bool UseToon = false; > {
  549. pass DrawObject {
  550. VertexShader = compile vs_3_0 Basic_VS(false, false, false);
  551. PixelShader = compile ps_3_0 Basic_PS(false, false, false);
  552. }
  553. }
  554.  
  555. technique MainTecBS1 < string MMDPass = "object_ss"; bool UseTexture = true; bool UseSphereMap = false; bool UseToon = false; > {
  556. pass DrawObject {
  557. VertexShader = compile vs_3_0 Basic_VS(true, false, false);
  558. PixelShader = compile ps_3_0 Basic_PS(true, false, false);
  559. }
  560. }
  561.  
  562. technique MainTecBS2 < string MMDPass = "object_ss"; bool UseTexture = false; bool UseSphereMap = true; bool UseToon = false; > {
  563. pass DrawObject {
  564. VertexShader = compile vs_3_0 Basic_VS(false, true, false);
  565. PixelShader = compile ps_3_0 Basic_PS(false, true, false);
  566. }
  567. }
  568.  
  569. technique MainTecBS3 < string MMDPass = "object_ss"; bool UseTexture = true; bool UseSphereMap = true; bool UseToon = false; > {
  570. pass DrawObject {
  571. VertexShader = compile vs_3_0 Basic_VS(true, true, false);
  572. PixelShader = compile ps_3_0 Basic_PS(true, true, false);
  573. }
  574. }
  575.  
  576. // オブジェクト描画用テクニック(PMDモデル用)
  577. technique MainTecBS4 < string MMDPass = "object_ss"; bool UseTexture = false; bool UseSphereMap = false; bool UseToon = true; > {
  578. pass DrawObject {
  579. VertexShader = compile vs_3_0 Basic_VS(false, false, true);
  580. PixelShader = compile ps_3_0 Basic_PS(false, false, true);
  581. }
  582. }
  583.  
  584. technique MainTecBS5 < string MMDPass = "object_ss"; bool UseTexture = true; bool UseSphereMap = false; bool UseToon = true; > {
  585. pass DrawObject {
  586. VertexShader = compile vs_3_0 Basic_VS(true, false, true);
  587. PixelShader = compile ps_3_0 Basic_PS(true, false, true);
  588. }
  589. }
  590.  
  591. technique MainTecBS6 < string MMDPass = "object_ss"; bool UseTexture = false; bool UseSphereMap = true; bool UseToon = true; > {
  592. pass DrawObject {
  593. VertexShader = compile vs_3_0 Basic_VS(false, true, true);
  594. PixelShader = compile ps_3_0 Basic_PS(false, true, true);
  595. }
  596. }
  597.  
  598. technique MainTecBS7 < string MMDPass = "object_ss"; bool UseTexture = true; bool UseSphereMap = true; bool UseToon = true; > {
  599. pass DrawObject {
  600. VertexShader = compile vs_3_0 Basic_VS(true, true, true);
  601. PixelShader = compile ps_3_0 Basic_PS(true, true, true);
  602. }
  603. }
Advertisement
Add Comment
Please, Sign In to add comment