http://www.filefactory.com/file/ca16d77 ... latGUI.rar
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Code: Select all
float4x4 matViewProjection : ViewProjection;
sampler2D splatMap = sampler_state
{
ADDRESSU = WRAP;
ADDRESSV = WRAP;
ADDRESSW = WRAP;
};
sampler2D layer_red = sampler_state
{
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
ADDRESSW = WRAP;
};
sampler2D layer_green = sampler_state
{
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
ADDRESSW = WRAP;
};
sampler2D layer_blue = sampler_state
{
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
ADDRESSW = WRAP;
};
struct VS_INPUT
{
float4 Position : POSITION0;
float2 alphamap : TEXCOORD0;
float2 tex : TEXCOORD1;
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
float2 alphamap : TEXCOORD0;
float2 tex : TEXCOORD1;
};
struct PS_OUTPUT
{
float4 diffuse : COLOR0;
};
VS_OUTPUT vs_main(in VS_INPUT Input)
{
VS_OUTPUT Output;
Output.Position = mul( Input.Position, matViewProjection );
Output.alphamap = Input.alphamap;
Output.tex = Input.tex;
return( Output );
}
PS_OUTPUT ps_main(in VS_OUTPUT input)
{
float texScale = 10.0f;
PS_OUTPUT output = (PS_OUTPUT)0;
float4 a = tex2D(splatMap, input.alphamap);
float4 i = tex2D(layer_red, input.tex*texScale);
float4 j = tex2D(layer_green, input.tex*texScale);
float4 k = tex2D(layer_blue, input.tex*texScale);
output.diffuse = float4(a.r*i+a.g*j+a.b*k)*float4(1,1,1,a.a);
return output;
}
technique Default_DirectX_Effect
{
pass Pass_0
{
VertexShader = compile vs_2_0 vs_main();
PixelShader = compile ps_2_0 ps_main();
}
Code: Select all
const c8 *vertShader = "void main()\
{\
gl_TexCoord[0] = gl_MultiTexCoord0;\
gl_Position = ftransform();\
}\
";
//Fragment Shader
const c8 *fragShader = "uniform sampler2D splatMap;\
uniform sampler2D layer_red;\
uniform sampler2D layer_green;\
uniform sampler2D layer_blue;\
\
void main(){\
float factor = 20;\
vec4 SplatCol=texture2D(splatMap,gl_TexCoord[0].xy);\
vec4 RedCol=texture2D(layer_red,gl_TexCoord[0].xy*factor);\
vec4 GreenCol=texture2D(layer_green,gl_TexCoord[0].xy*factor);\
vec4 BlueCol=texture2D(layer_blue,gl_TexCoord[0].xy*factor);\
gl_FragColor=(vec4(SplatCol.r*RedCol+SplatCol.g*GreenCol+SplatCol.b*BlueCol))*vec4(1,1,1,SplatCol.a);\
}\
";
Thank youby roelor » Tue Jun 08, 2010 12:05 am
this doesnt work well on my intel gma 4500. framerate is low, (thats to be expected) but the terrain is transparant in the distance. (you can look through the terrain).
by freetimecoder » Wed Jun 09, 2010 9:03 am
Hi,
Is it transparent only in the distance or everywhere? Only in the distance. Does it look like on the screenshot, ecxept the transparency? Looks like on the screenshots. What OpenGL/GLSL version do you have? OpenGL 2.1 Does it give any errors in the console? Dont think so.
greetings