float4x4 WVPMatrix;
float refractionDisplacement;
float colorStrength;
struct VS_OUTPUT
{
float4 Pos : POSITION;
float2 texCoord : TEXCOORD0;
float3 eyeLinear : TEXCOORD1;
};
VS_OUTPUT vertexMain(float4 Pos : POSITION,
float2 texCoord : TEXCOORD0)
{
VS_OUTPUT Out;
float4 sPos = mul(float4(Pos.xzy, 1), WVPMatrix);
Out.Pos = sPos;
Out.eyeLinear.x = 0.5 * (sPos.z + sPos.x);
Out.eyeLinear.y = 0.5 * (sPos.z - sPos.y);
Out.eyeLinear.z = sPos.z;
Out.texCoord = texCoord;
return Out;
}
sampler renderTexture;
sampler bump;
sampler diffuse;
float4 pixelMain(float3 texCoord: TEXCOORD0,
float3 eyeLinear: TEXCOORD1) : COLOR
{
float4 normal = 2.0 * tex2D(bump, texCoord) - 1.0;
float2 coord = eyeLinear.xy / eyeLinear.z;
float4 refr = tex2D(renderTexture, 0.1+0.8*(coord + refractionDisplacement * normal.xy));
float4 diff = tex2D(diffuse, texCoord) * colorStrength;
return (refr * diff) + refr;
}
Can someone please convert it to GLSL?
Thank you