Skip to content

Instantly share code, notes, and snippets.

@NaokiStark
Created June 14, 2018 17:17
Show Gist options
  • Save NaokiStark/a35fb6d440406e4b00e3e19c6dd3e851 to your computer and use it in GitHub Desktop.
Save NaokiStark/a35fb6d440406e4b00e3e19c6dd3e851 to your computer and use it in GitHub Desktop.
float4x4 World;
float4x4 View;
float4x4 Projection;
float4x4 xWorldViewProjection;
Texture xColoredTexture;
float DisplacementScroll;
sampler ColoredTextureSampler = sampler_state
{
texture = <xColoredTexture>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = mirror;
AddressV = mirror;
};
struct VertexShaderInput
{
float4 Position : POSITION0;
float4 textureCoordinates : TEXCOORD0;
};
struct VertexShaderOutput
{
float4 Position : POSITION0;
float4 textureCoordinates : TEXCOORD0;
};
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
float4 Color;
float2 texCoord2 = input.textureCoordinates.xy + DisplacementScroll;
float2 texCoord3 = input.textureCoordinates.xy - DisplacementScroll;
float4 color1 = tex2D(ColoredTextureSampler, texCoord2);
float4 color2 = tex2D(ColoredTextureSampler, input.textureCoordinates.xy);
float4 color3 = tex2D(ColoredTextureSampler, texCoord3);
return float4(color1.r, color2.g, color3.b, color1.a);
}
technique Technique1
{
pass Pass1
{
// TODO: set renderstates here.
//VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment