1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
|
/* Project Starshatter 4.5
Destroyer Studios LLC
Copyright © 1997-2005. All Rights Reserved.
SUBSYSTEM: Stars.exe
FILE: magic.fx
AUTHOR: John DiCamillo
OVERVIEW
========
DirectX9 rendering effects for solid objects
*/
float4 eye = { 0, 0, 0, 1 };
float4 black : COLOR = { 0, 0, 0, 1 };
float4 cheat : COLOR = { 0.1, 0.1, 0.1, 1 };
float4 white : COLOR = { 1, 1, 1, 1 };
float4 red : COLOR = { 1, 0, 0, 0 };
/*********** Material Properties ***********/
float4 Ka : Ambient = { 0.2f, 0.2f, 0.2f, 1.0f };
float4 Kd : Diffuse = { 1.0f, 1.0f, 1.0f, 1.0f };
float4 Ks : Specular = { 0.2f, 0.2f, 0.2f, 1.0f };
float Ns : SpecularPower = 20;
float4 Ke : Emissive = { 0.0f, 0.0f, 0.0f, 0.0f };
float offsetAmp = 0.001;
float bias = -0.00001;
texture tex_d : DiffuseMap;
texture tex_s : SpecularMap;
texture tex_n : NormalMap;
texture tex_e : EmissiveMap;
texture tex_x : DiffuseMap;
/************** light info *****************/
float4 ambientColor : LIGHTCOLOR = { 0.2f, 0.2f, 0.2f, 1.0f };
float4 light1Pos : POSITION = { 100, 100, 100, 1 };
float4 light1Dir : DIRECTION = {-100,-100,-100, 1 };
float4 light1Color : LIGHTCOLOR = { 1, 0, 0, 1 };
/************** xform matrices *************/
float4x4 world : World;
float4x4 view : View;
float4x4 proj : Projection;
float4x4 wvp : WorldViewProjection;
float4x4 worldInv : WorldInverse;
float4 eyeObj : POSITION = { 0, 0, 0, 1 };
/********** SAMPLERS ***********************/
sampler2D diffuseSampler = sampler_state
{
Texture = <tex_d>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};
sampler2D specularSampler = sampler_state
{
Texture = <tex_s>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};
sampler2D normalSampler = sampler_state
{
Texture = <tex_n>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};
sampler2D emissiveSampler = sampler_state
{
Texture = <tex_e>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};
sampler2D extraSampler = sampler_state
{
Texture = <tex_x>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};
/****************************************************/
struct VS_OUTPUT_NOPS
{
float4 position : POSITION;
float3 lightVec : COLOR0;
float3 specular : COLOR1;
float2 tex0 : TEXCOORD0;
float2 tex1 : TEXCOORD1;
float2 tex2 : TEXCOORD2;
};
struct VS_OUTPUT
{
float4 position : POSITION;
float2 tex0 : TEXCOORD0;
float3 lightVec : TEXCOORD1;
float3 eyeVec : TEXCOORD2;
};
struct VS_OUTPUT_SIMPLE
{
float4 position : POSITION;
float4 diffuse : COLOR0;
float4 specular : COLOR1;
float2 tex0 : TEXCOORD0;
};
/**************************************/
/***** VERTEX SHADER ******************/
/**************************************/
VS_OUTPUT_SIMPLE
vtxSimple(
float4 position : POSITION,
float3 normal : NORMAL,
float2 tex0 : TEXCOORD0)
{
VS_OUTPUT_SIMPLE Out;
// transform vertex position to homogeneous clip space
Out.position = mul(position, wvp);
float4x4 wv = mul(world, view);
float3 L = normalize(mul(-light1Dir.xyz, (float3x3) view));
float3 N = normalize(mul(normal, (float3x3) wv));
float3 P = mul(position, (float4x3) wv); // position (view space)
float3 R = normalize(2 * dot(N, L) * N - L); // reflection vector (view space)
float3 V = -normalize(P); // view direction (view space)
Out.diffuse = ambientColor * Ka +
light1Color * Kd * max(0, dot(N, L));
Out.specular = light1Color * Ks * pow(max(0, dot(R, V)), Ns);
Out.tex0 = tex0;
return Out;
}
VS_OUTPUT_NOPS
vtxNormalNoPS(
float4 position : POSITION,
float3 normal : NORMAL,
float2 tex0 : TEXCOORD0,
float2 tex1 : TEXCOORD1,
float3 tangent : TANGENT2,
float3 binormal : BINORMAL3)
{
VS_OUTPUT_NOPS Out;
// transform vertex position to homogeneous clip space
Out.position = mul(position, wvp);
//pass texture coordinates
Out.tex0 = tex0;
Out.tex1 = tex0;
Out.tex2 = tex0;
// compute the 3x3 tranform from object space to tangent space
float3x3 obj2tan;
obj2tan[0] = tangent;
obj2tan[1] = binormal;
obj2tan[2] = normal;
// Transform light vector to tangent space
float3 L = mul(obj2tan, -light1Dir.xyz);
// Normalize and bias transformed light vector
L = normalize(L) * 0.5 + 0.5;
Out.lightVec = L;
float3 N = normal;
float3 V = normalize(eyeObj.xyz - position.xyz);
L = normalize(-light1Dir.xyz);
float3 H = normalize(V+L);
float N_dot_L = dot(N,L);
float N_dot_H = dot(N,H);
bool2 test;
test.x = N_dot_L > 0;
test.y = N_dot_H > 0;
if (all(test)) {
Out.specular = Ks * pow(N_dot_H, Ns);
}
else {
Out.specular = black;
}
return Out;
}
VS_OUTPUT vtxNormal(
float4 position : POSITION,
float3 normal : NORMAL,
float2 tex0 : TEXCOORD0,
float2 tex1 : TEXCOORD1,
float3 tangent : TANGENT2,
float3 binormal : BINORMAL3)
{
VS_OUTPUT Out;
// transform vertex position to homogeneous clip space
Out.position = mul(position, wvp);
//pass texture coordinates
Out.tex0 = tex0;
// compute the 3x3 tranform from object space to tangent space
float3x3 obj2tan;
obj2tan[0] = tangent;
obj2tan[1] = binormal;
obj2tan[2] = normal;
// Transform light vector to tangent space
float3 L = mul(obj2tan, -light1Dir.xyz);
// Normalize transformed light vector
Out.lightVec = normalize(L);
// Transform eye vector from obj space to tangent space
float3 objEyeVec = eyeObj.xyz - position.xyz;
Out.eyeVec = normalize(mul(obj2tan, objEyeVec));
return Out;
}
VS_OUTPUT_SIMPLE
vtxAtmosphere(
float4 position : POSITION,
float3 normal : NORMAL,
float2 tex0 : TEXCOORD0)
{
VS_OUTPUT_SIMPLE Out;
// transform vertex position to homogeneous clip space
float4 tmp = position;
tmp.xyz *= 1.04;
Out.position = mul(tmp, wvp);
float4x4 wv = mul(world, view);
float3 L = normalize(mul(-light1Dir.xyz, (float3x3) view));
float3 N = normalize(mul(normal, (float3x3) wv));
float3 V = normalize(eyeObj - position); // eye ray
float n = clamp(dot(V, normal), 0, 1);
float a = pow(1-n, 2);
Out.diffuse = Ka * abs(clamp(dot(N, L), -0.2, 1));
Out.specular = black;
Out.tex0 = float2(0, 1-a);
return Out;
}
/**************************************/
/********* PIXEL SHADER ***************/
/**************************************/
float4 pixDiffuse(
VS_OUTPUT_SIMPLE In,
uniform sampler2D diffTex
) : COLOR
{
float4 diffuse = tex2D(diffTex, In.tex0);
return In.diffuse * diffuse + In.specular;
}
float4 pixSpecular(
VS_OUTPUT_SIMPLE In,
uniform sampler2D diffTex,
uniform sampler2D specTex
) : COLOR
{
float4 diffuse = tex2D(diffTex, In.tex0);
float4 specular = tex2D(specTex, In.tex0);
return In.diffuse * diffuse + In.specular * specular;
}
float4 pixEmissive(
VS_OUTPUT_SIMPLE In,
uniform sampler2D diffTex,
uniform sampler2D glowTex
) : COLOR
{
float4 diffuse = tex2D(diffTex, In.tex0);
float4 emissive = tex2D(glowTex, In.tex0);
return In.diffuse * diffuse + In.specular + emissive;
}
float4 pixEmissiveSpecular(
VS_OUTPUT_SIMPLE In,
uniform sampler2D diffTex,
uniform sampler2D glowTex,
uniform sampler2D specTex
) : COLOR
{
float4 diffuse = tex2D(diffTex, In.tex0);
float4 emissive = tex2D(glowTex, In.tex0);
float4 specular = tex2D(specTex, In.tex0);
return In.diffuse * diffuse + In.specular * specular + emissive;
}
float4 pixNightLightSpecular(
VS_OUTPUT_SIMPLE In,
uniform sampler2D diffTex,
uniform sampler2D glowTex,
uniform sampler2D specTex
) : COLOR
{
float4 diffuse = tex2D(diffTex, In.tex0);
float4 emissive = tex2D(glowTex, In.tex0);
float4 specular = tex2D(specTex, In.tex0);
float inv_diff = 1 - In.diffuse.b;
float4 night = float4(inv_diff, inv_diff, inv_diff, 0);
return In.diffuse * diffuse + In.specular * specular + emissive * night;
}
float4 pixNormalSpecular(
VS_OUTPUT In,
uniform sampler2D diffTex,
uniform sampler2D specTex,
uniform sampler2D normTex
) : COLOR
{
float4 diffuse = tex2D(diffTex, In.tex0);
float4 specular = tex2D(specTex, In.tex0);
float3 normal = tex2D(normTex, In.tex0).xyz * 2.0 - 1.0;
float3 N = normalize(normal);
float3 V = In.eyeVec; //normalize(In.eyeVec);
float3 L = In.lightVec; //normalize(In.lightVec);
float3 H = normalize(V+L);
float4 coeff = lit(dot(N,L), dot(N,H), Ns);
return light1Color * (Kd*diffuse*coeff.y + Ks*specular*coeff.z);
}
float4 pixNormal(
VS_OUTPUT In,
uniform sampler2D diffTex,
uniform sampler2D normTex
) : COLOR
{
float4 diffuse = tex2D(diffTex, In.tex0);
float3 normal = tex2D(normTex, In.tex0).xyz * 2.0 - 1.0;
float3 N = normalize(normal);
float3 V = normalize(In.eyeVec);
float3 L = normalize(In.lightVec);
float3 H = normalize(V+L);
float4 coeff = lit(dot(N,L), dot(N,H), Ns);
return light1Color * (Kd*diffuse*coeff.y + Ks*coeff.z);
}
float4 pixAtmosphere(
VS_OUTPUT_SIMPLE In,
uniform sampler2D limbTex
) : COLOR
{
float4 limb = tex2D(limbTex, In.tex0);
return In.diffuse * limb;
}
/****************************************************/
/********** TECHNIQUES ******************************/
/****************************************************/
technique SimplePix
{
pass P0
{
FogEnable = false;
VertexShader = compile vs_1_1 vtxSimple();
PixelShader = compile ps_2_0 pixDiffuse(diffuseSampler);
}
}
technique SpecMapPix
{
pass P0
{
FogEnable = false;
VertexShader = compile vs_1_1 vtxSimple();
PixelShader = compile ps_2_0 pixSpecular(diffuseSampler,specularSampler);
}
}
technique EmissivePix
{
pass P0
{
FogEnable = false;
VertexShader = compile vs_1_1 vtxSimple();
PixelShader = compile ps_2_0 pixEmissive(diffuseSampler,emissiveSampler);
}
}
technique EmissiveSpecMapPix
{
pass P0
{
FogEnable = false;
VertexShader = compile vs_1_1 vtxSimple();
PixelShader = compile ps_2_0 pixEmissiveSpecular(diffuseSampler,emissiveSampler,specularSampler);
}
}
technique BumpSpecMapPix
{
pass P0
{
TexCoordIndex[0] = 0;
TexCoordIndex[1] = 1;
TexCoordIndex[2] = 2;
TexCoordIndex[3] = 3;
DepthBias = (bias);
FogEnable = false;
VertexShader = compile vs_1_1 vtxNormal();
PixelShader = compile ps_2_0 pixNormalSpecular(diffuseSampler,specularSampler,normalSampler);
}
}
technique BumpSpecMap
{
pass P0
{
Sampler[0] = (normalSampler);
Sampler[1] = (diffuseSampler);
Sampler[2] = (specularSampler);
ColorOp[0] = DOTPRODUCT3;
ColorArg1[0] = TEXTURE;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = SELECTARG1;
AlphaArg1[0] = TEXTURE;
TexCoordIndex[0] = 0;
ColorOp[1] = MODULATE;
ColorArg1[1] = TEXTURE;
ColorArg2[1] = CURRENT;
AlphaOp[1] = SELECTARG1;
AlphaArg1[1] = TEXTURE;
TexCoordIndex[1] = 1;
ColorOp[2] = MULTIPLYADD;
ColorArg1[2] = TEXTURE;
ColorArg2[2] = SPECULAR;
AlphaOp[2] = SELECTARG1;
AlphaArg1[2] = TEXTURE;
TexCoordIndex[2] = 2;
ColorOp[3] = DISABLE;
AlphaOp[3] = DISABLE;
TexCoordIndex[3] = 3;
DepthBias = (bias);
FogEnable = false;
VertexShader = compile vs_1_1 vtxNormalNoPS();
PixelShader = NULL;
}
}
technique BumpMapPix
{
pass P0
{
TexCoordIndex[0] = 0;
TexCoordIndex[1] = 1;
TexCoordIndex[2] = 2;
TexCoordIndex[3] = 3;
DepthBias = (bias);
FogEnable = false;
VertexShader = compile vs_1_1 vtxNormal();
PixelShader = compile ps_2_0 pixNormal(diffuseSampler,normalSampler);
}
}
technique BumpMap
{
pass P0
{
Sampler[0] = (normalSampler);
Sampler[1] = (diffuseSampler);
ColorOp[0] = DOTPRODUCT3;
ColorArg1[0] = TEXTURE;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = SELECTARG1;
AlphaArg1[0] = TEXTURE;
TexCoordIndex[0] = 0;
ColorOp[1] = MODULATE;
ColorArg1[1] = TEXTURE;
ColorArg2[1] = CURRENT;
AlphaOp[1] = SELECTARG1;
AlphaArg1[1] = TEXTURE;
TexCoordIndex[1] = 1;
ColorOp[2] = DISABLE;
AlphaOp[2] = DISABLE;
TexCoordIndex[2] = 2;
DepthBias = (bias);
FogEnable = false;
VertexShader = compile vs_1_1 vtxNormalNoPS();
PixelShader = NULL;
}
}
technique SimpleMaterial
{
pass P0
{
//FogEnable = false;
MaterialAmbient = (Ka);
MaterialDiffuse = (Kd);
MaterialSpecular = (Ks);
MaterialPower = (Ns);
MaterialEmissive = (Ke);
Lighting = TRUE;
SpecularEnable = TRUE;
// NO textures
ColorOp[0] = DISABLE;
AlphaOp[0] = DISABLE;
// NO shaders
VertexShader = NULL;
PixelShader = NULL;
}
}
technique SimpleTexture
{
pass P0
{
//FogEnable = false;
MaterialAmbient = (Ka);
MaterialDiffuse = (Kd);
MaterialSpecular = (Ks);
MaterialPower = (Ns);
MaterialEmissive = (black);
Lighting = TRUE;
SpecularEnable = TRUE;
Sampler[0] = (diffuseSampler);
// texture stages
ColorOp[0] = MODULATE;
ColorArg1[0] = TEXTURE;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = MODULATE;
AlphaArg1[0] = TEXTURE;
AlphaArg2[0] = DIFFUSE;
TexCoordIndex[0] = 0;
ColorOp[1] = DISABLE;
AlphaOp[1] = DISABLE;
// NO shaders
VertexShader = NULL;
PixelShader = NULL;
}
}
technique SpecularTexture
{
pass P0
{
//FogEnable = false;
MaterialAmbient = (Ka);
MaterialDiffuse = (Kd);
MaterialSpecular = (Ks);
MaterialPower = (Ns);
MaterialEmissive = (Ke);
Lighting = TRUE;
SpecularEnable = TRUE;
Sampler[0] = (diffuseSampler);
Sampler[1] = (specularSampler);
// texture stages
ColorOp[0] = MODULATE;
ColorArg1[0] = TEXTURE;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = MODULATE;
AlphaArg1[0] = TEXTURE;
AlphaArg2[0] = DIFFUSE;
TexCoordIndex[0] = 0;
ColorOp[1] = MULTIPLYADD;
ColorArg1[1] = TEXTURE;
ColorArg2[1] = SPECULAR;
AlphaOp[1] = SELECTARG1;
AlphaArg1[1] = CURRENT;
TexCoordIndex[1] = 0;
ColorOp[2] = DISABLE;
AlphaOp[2] = DISABLE;
// NO shaders
VertexShader = NULL;
PixelShader = NULL;
}
}
technique EmissiveTexture
{
pass P0
{
//FogEnable = false;
MaterialAmbient = (Ka);
MaterialDiffuse = (Kd);
MaterialSpecular = (Ks);
MaterialPower = (Ns);
MaterialEmissive = (black);
Lighting = TRUE;
SpecularEnable = FALSE;
Sampler[0] = (diffuseSampler);
Sampler[1] = (emissiveSampler);
// texture stages
ColorOp[0] = MODULATE;
ColorArg1[0] = TEXTURE;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = MODULATE;
AlphaArg1[0] = TEXTURE;
AlphaArg2[0] = DIFFUSE;
TexCoordIndex[0] = 0;
ColorOp[1] = ADD;
ColorArg1[1] = TEXTURE;
ColorArg2[1] = CURRENT;
AlphaOp[1] = SELECTARG1;
AlphaArg1[1] = CURRENT;
TexCoordIndex[1] = 0;
ColorOp[2] = DISABLE;
AlphaOp[2] = DISABLE;
// NO shaders
VertexShader = NULL;
PixelShader = NULL;
}
}
technique EmissiveSpecularTexture
{
pass P0
{
//FogEnable = false;
MaterialAmbient = (Ka);
MaterialDiffuse = (Kd);
MaterialSpecular = (Ks);
MaterialPower = (Ns);
MaterialEmissive = (black);
Lighting = TRUE;
SpecularEnable = TRUE;
Sampler[0] = (diffuseSampler);
Sampler[1] = (specularSampler);
Sampler[2] = (emissiveSampler);
// texture stages
ColorOp[0] = MODULATE;
ColorArg1[0] = TEXTURE;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = MODULATE;
AlphaArg1[0] = TEXTURE;
AlphaArg2[0] = DIFFUSE;
TexCoordIndex[0] = 0;
ColorOp[1] = MULTIPLYADD;
ColorArg1[1] = TEXTURE;
ColorArg2[1] = SPECULAR;
AlphaOp[1] = SELECTARG1;
AlphaArg1[1] = CURRENT;
TexCoordIndex[1] = 0;
ColorOp[2] = ADD;
ColorArg1[2] = TEXTURE;
ColorArg2[2] = CURRENT;
AlphaOp[2] = SELECTARG1;
AlphaArg1[2] = CURRENT;
TexCoordIndex[2] = 0;
ColorOp[3] = DISABLE;
AlphaOp[3] = DISABLE;
// NO shaders
VertexShader = NULL;
PixelShader = NULL;
}
}
technique PlanetSurf
{
pass P0
{
AlphaBlendEnable = true;
BlendOp = ADD;
SrcBlend = ONE;
DestBlend = ONE;
FogEnable = false;
VertexShader = compile vs_1_1 vtxSimple();
PixelShader = compile ps_2_0 pixEmissiveSpecular(diffuseSampler,emissiveSampler,specularSampler);
}
}
technique PlanetSurfNightLight
{
pass P0
{
AlphaBlendEnable = true;
BlendOp = ADD;
SrcBlend = ONE;
DestBlend = ONE;
FogEnable = false;
VertexShader = compile vs_1_1 vtxSimple();
PixelShader = compile ps_2_0 pixNightLightSpecular(diffuseSampler,emissiveSampler,specularSampler);
}
}
technique PlanetLimb
{
pass P0
{
AlphaBlendEnable = true;
SrcBlend = SRCALPHA;
DestBlend = INVSRCALPHA;
FogEnable = false;
VertexShader = compile vs_1_1 vtxAtmosphere();
PixelShader = compile ps_2_0 pixAtmosphere(diffuseSampler);
}
}
matrix mID; // Identity transform
matrix env_matrix; // Environment map transform
textureCUBE env_cube; // Cubic environment map
technique WaterReflections
{
pass P0
{
VertexShader = null;
MaterialAmbient = (Ka);
MaterialDiffuse = (Kd);
MaterialSpecular = (Ks);
MaterialPower = (Ns);
MaterialEmissive = (black);
Lighting = TRUE;
SpecularEnable = TRUE;
Sampler[0] = (diffuseSampler);
ColorOp[0] = MODULATE;
ColorArg1[0] = TEXTURE;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = MODULATE;
AlphaArg1[0] = TEXTURE;
AlphaArg2[0] = DIFFUSE;
TexCoordIndex[0] = 0;
ColorOp[1] = DISABLE;
AlphaOp[1] = DISABLE;
// Stage2
/*
ColorOp[1] = BlendCurrentAlpha;
ColorArg1[1] = Texture;
ColorArg2[1] = Current;
AlphaOp[1] = SelectArg2;
AlphaArg2[1] = Current;
MinFilter[1] = Linear;
MagFilter[1] = Linear;
MipFilter[1] = Point;
Texture[1] = <env_cube>;
TextureTransform[1] = <env_matrix>;
TextureTransformFlags[1] = Count3;
TexCoordIndex[1] = CameraSpaceReflectionVector;
// Stage3
ColorOp[2] = Disable;
AlphaOp[2] = Disable;
*/
}
}
|