Posted: Wed Jun 24, 2009 11:44 am
Here is edited "depth.cg" to "handle" transparent nodes (fences, tree leaves...).
I have not tried it because i am not using Irrlicht long time now
(i choped it from my "game engine"), but i am still lurking thru this forums.
Sorry for my bad english.
Is there someone with solution for light "bleeding" problem?
I have not tried it because i am not using Irrlicht long time now
(i choped it from my "game engine"), but i am still lurking thru this forums.
Sorry for my bad english.
Code: Select all
sampler2D samp; // your tex with alpha info
void main_v(
in float3 inPosition : POSITION,
in float2 inTexCoord0 : TEXCOORD0,
out float4 outPosition : POSITION,
out float outTexCoord0 : TEXCOORD0,
out float outDepthColor : TEXCOORD1,
uniform float4x4 WVP,
uniform float4x4 WV)
{
outPosition = mul(WVP, float4(inPosition, 1.0f));
outTexCoord0 = inTexCoord0;
outDepthColor = outPosition.z;
}
void main_f( in float2 inTexCoord0 : TEXCOORD0,
in float inDepthColor : TEXCOORD1,
out float4 outColor : COLOR)
{
float tAlpha = tex2D(samp, inTexCoord0).a; // sample from alpha
float alphaRef = 0.8f; // alphaRef value
clip(tAlpha - alphaRef); // discard current pixel that is below alphaRef
outColor = inDepthColor;
}