Changeset 9425 for data/trunk/programs/ps_glow.cg
- Timestamp:
- Oct 31, 2012, 6:02:05 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
data/trunk/programs/ps_glow.cg
r9408 r9425 1 float4 main(uniform float alpha_value, uniform float time, uniform float4 color) : COLOR 1 struct vertexOut 2 2 { 3 color.w = alpha_value * ((sin(time * 5.0) / 3.14 + 1.0) / 2.0 ); 3 float4 position : POSITION; 4 float2 uv : TEXCOORD0; 5 float3 worldNormal : TEXCOORD1; 6 float3 worldView : TEXCOORD2; 7 }; 8 9 float4 main(vertexOut input, uniform float alphaValue, uniform float cutoffAngle, uniform float exponent, uniform float time, uniform float4 color) : COLOR 10 { 11 float3 Nn = normalize(input.worldNormal); 12 float3 Vn = normalize(input.worldView); 13 float alphaMod = dot(Nn, Vn);//this is a measure for how close we are to the edge of a model according to our view 14 float cutoff=cos(cutoffAngle * 3.14 / 180.0);//pi divided by 180 15 if(alphaMod<cutoff)//transform output range so it only affects angles close to 90 degrees 16 { 17 alphaMod/=cutoff; 18 } 19 else 20 { 21 alphaMod=1.0; 22 } 23 alphaMod = pow(alphaMod,exponent); //how fast should the intensity of the glow decrease 24 color.w = alphaMod * alphaValue * ((sin(time)/3.14 + 1.0) / 2.0 + 0.1); 4 25 return color; 5 26 }
Note: See TracChangeset
for help on using the changeset viewer.