Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------------------------------------------------
- // Shader settings
- //------------------------------------------------------------------------------------------
- texture gCustomTexture;
- float2 posAdd = float2(0,0); // move uv(0 - 1) left right , up down
- float2 posMult = float2(1,1); // stretch uv(0 - n ) x , y
- float4 gColorMult = float4(1,1,1,1); // multiply r g b a colors (0 - 1)
- //------------------------------------------------------------------------------------------
- // Include some common stuff
- //------------------------------------------------------------------------------------------
- texture gTexture0 < string textureState="0,Texture"; >;
- //------------------------------------------------------------------------------------------
- // Sampler for the textures
- //------------------------------------------------------------------------------------------
- sampler Sampler0 = sampler_state
- {
- Texture = (gTexture0);
- };
- sampler SamplerCustom = sampler_state
- {
- Texture = (gCustomTexture);
- };
- //------------------------------------------------------------------------------------------
- // Pixel Shader
- //------------------------------------------------------------------------------------------
- float4 PSFunction(float4 TexCoord : TEXCOORD0, float4 Position : POSITION, float4 Color : COLOR0) : COLOR0
- {
- float2 textureCoordinate = TexCoord.xy;
- textureCoordinate *= posMult;
- textureCoordinate += posAdd;
- float4 Tex0 = tex2D(Sampler0, TexCoord.xy);
- float4 Tex1 = tex2D(SamplerCustom, textureCoordinate) * gColorMult;
- float4 Tex = lerp(Tex1, Tex0, Tex1.a);
- Tex *= Color;
- return saturate(Tex);
- }
- //------------------------------------------------------------------------------------------
- // Techniques
- //------------------------------------------------------------------------------------------
- technique texRepTra
- {
- pass p0
- {
- PixelShader = compile ps_2_0 PSFunction();
- }
- }
- technique fallback
- {
- pass P0
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment