Here what Irrlicht is running on:
Here is a pic:Irrlicht Engine version 1.8.0
Microsoft Windows 7 Home Premium Edition Service Pack 1 (Build 7601)
Using renderer: OpenGL 4.2.0
GeForce GTX 460/PCIe/SSE2: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
GLSL version: 4.2
Resizing window (1280 720)
irrKlang sound library version 1.4.0
Loaded plugin: ikpflac.dll
Loaded plugin: ikpmp3.dll
Using DirectSound8 driver
The terrain is made of tiles, and one of the tile has it's alpha failing (it become full opaque, and the foliage of the tree was affected)
This only happen at certain camera angles. If I move|rotate the camera, it come back normal.
This is the rendering of a GLSL shader. Here is what I have now, I forced it to use a specific alpha now to be sure (0.5 value)
Just look at the last line...
Code: Select all
uniform sampler2D oceanNormalMap;
uniform sampler2D oceanReflection;
uniform float waterTime;
uniform vec4 AmbientLight;
varying float posY;
uniform int terrainScale;
void main()
{
float scale = terrainScale * 0.145;
vec2 texCoord = vec2(gl_TexCoord[0]);
vec4 tex0 = texture2D( oceanNormalMap, vec2(texCoord.x*5.0 + waterTime,texCoord.y*3.0));
vec4 tex1 = texture2D( oceanReflection, texCoord.xy*2.0 + tex0.r*0.5 );
tex1.a = (-posY/scale)-(0.1)*3.0;
vec4 finalColor = tex1 * AmbientLight;
float pAlpha = finalColor.a;
float fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale;
finalColor = mix(gl_Fog.color,finalColor, fog);
//gl_FragColor = vec4(finalColor.r,finalColor.g,finalColor.b,pAlpha);
gl_FragColor = vec4(finalColor.r,finalColor.g,finalColor.b,0.5);
}
In case you would like to see the vertex shader:
Code: Select all
varying float posY;
uniform int terrainScale;
void main(void)
{
float scale = (terrainScale * 0.05);
posY = gl_Vertex.y;
//gl_Vertex.y = -scale;
gl_TexCoord[0] = gl_MultiTexCoord0;
//gl_Position = ftransform();
vec4 vertex = gl_Vertex;
vertex.y = -scale;
gl_Position = gl_ModelViewProjectionMatrix * vertex;
gl_FogFragCoord = gl_Position.z;
}