home *** CD-ROM | disk | FTP | other *** search
- //sky pixel shader:
- //mixes color of 2 layers of sky
- //Luke Lenhart
- //(C)2004-2005 Digipen Institute of Technology
-
- //blend factor between 2 layers
- float blend;
-
- //"extra" color to add to final color
- float4 clrExtra;
-
- //base color sampler
- sampler2D sampSky1;
-
- //cloud sampler
- sampler2D sampSky2;
-
- //shader input
- struct PS_INPUT
- {
- float4 Color : COLOR;
- float2 Tex0 : TEXCOORD0;
- float2 Tex1 : TEXCOORD1;
- };
-
- //shader code
- float4 PShader(PS_INPUT In) : COLOR
- {
- //sample textutes
- float4 sky1=tex2D(sampSky1,In.Tex0);
- float4 sky2=tex2D(sampSky2,In.Tex1);
-
- //base color is blend of the 2 laters
- float4 clr=lerp(sky1,sky2,blend);
-
- //alpha is modulus of both blended with base
- clr.a=lerp(sky1.a*0.5f, sky2.a, blend*blend);
-
- //blend with vert color
- clr*=In.Color + clrExtra*In.Color.a;
-
- //spit out color
- return clr;
- }
-