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
|
float4x4 WorldView;
float4x4 Projection;
float4 GlowColor=float4(0.0f,0.0f,1.0f,1.0f);
float GlowThickness=1.0f;
struct VSOutput
{
float4 Position:POSITION;
float4 Diffuse:COLOR0;
};
VSOutput VSProc(float4 Position:POSITION,float3 Normal:NORMAL)
{
VSOutput Out=(VSOutput)(0);
float3 N = normalize(mul(Normal, (float3x3)WorldView)); // normal (view space)
float3 P = mul(Position, WorldView) + GlowThickness * N; // displaced position (view space)
float3 A = float3(0, 0, 1); // glow axis
float Power;
Power = dot(N, A);
Power *= Power;
Power -= 1;
Power *= Power; // Power = (1 - (N.A)^2)^2 [ = ((N.A)^2 - 1)^2 ]
float4 GlowAmbient=float4(0.0f,0.0f,1.0f,1.0f);
Out.Position = mul(float4(P, 1), Projection); // projected position
Out.Diffuse = GlowColor * Power + GlowAmbient; // modulated glow color + glow ambient
return Out;
}
TECHNIQUE T1
{
PASS P1
{
MaterialDiffuse = {1.0f,0.0f,0.0f,1.0f};
MaterialAmbient = {1.0f,0.0f,0.0f,0.0f};
MaterialEmissive = {1.0f,0.0f,0.0f,0.0f};
MaterialSpecular = {1.0f,0.0f,1.0f,0.0f};
MaterialPower = 30.0f;
SpecularEnable = true;
LightType[0] = Point;
LightAmbient[0] = {0.0f,0.0f,0.0f,1.0f};
//LightDiffuse[0] = {1.0f,1.0f,1.0f,1.0f};
LightSpecular[0] = {1.0f,0.0f,0.0f,1.0f};
LightPosition[0] = {0.0f,20.0f,0.0f};
LightRange[0] = 100.0f;
LightAttenuation0[0] = 0.0f;
LightAttenuation1[0] = 0.01f;
LightAttenuation2[0] = 0.0f;
LightEnable[0] = true;
}
PASS P2
{
VertexShader=compile vs_1_1 VSProc();
PixelShader=NULL;// no texture
Texture[0] = NULL;
// enable alpha blending
AlphaBlendEnable = TRUE;
SrcBlend = ONE;
DestBlend = ONE;
// set up texture stage states to use the diffuse color
ColorOp[0] = SELECTARG2;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = SELECTARG2;
AlphaArg2[0] = DIFFUSE;
ColorOp[1] = DISABLE;
AlphaOp[1] = DISABLE;
MaterialDiffuse = {1.0f,0.0f,0.0f,1.0f};
MaterialAmbient = {1.0f,0.0f,0.0f,0.0f};
MaterialEmissive = {1.0f,0.0f,0.0f,0.0f};
MaterialSpecular = {1.0f,0.0f,1.0f,0.0f};
MaterialPower = 30.0f;
SpecularEnable = true;
LightType[0] = Point;
LightAmbient[0] = {0.0f,0.0f,0.0f,1.0f};
//LightDiffuse[0] = {1.0f,1.0f,1.0f,1.0f};
LightSpecular[0] = {1.0f,0.0f,0.0f,1.0f};
LightPosition[0] = {0.0f,20.0f,0.0f};
LightRange[0] = 100.0f;
LightAttenuation0[0] = 0.0f;
LightAttenuation1[0] = 0.01f;
LightAttenuation2[0] = 0.0f;
LightEnable[0] = true;
}
}
|