hello!
I have a problem with a material. I created a hlsl shader material based on the material EMT_TRANSPARENT_ALPHA_CHANNEL. Within the shader I set the alpha value of the output color to a static value between 0 and 1. The problem is that sometimes you can see through the surface rendered with the shader and sometimes it isn't transparent. It seems that this problem depends on the rotation of the camera. Can you help me?
alpha channel problem
-
- Posts: 2
- Joined: Thu Apr 23, 2009 12:03 pm
I add the shader material:
gpu->addHighLevelShaderMaterialFromFiles(
G_XFXBASE, "VS", video::EVST_VS_2_0,
G_XFXBASE, "PS", video::EPST_PS_2_0,
baseShaderAlphaInst, video::EMT_TRANSPARENT_ALPHA_CHANNEL);
Code in the shader to set the alpha value:
struct VSOut
{
float4 pos : POSITION0;
float4 diff : COLOR0;
float2 texColor : TEXCOORD0;
};
...
...
PSOut PS(VSOut In)
{
PSOut Out;
...
...
Out.color.a = 0.7f;
return Out;
}
gpu->addHighLevelShaderMaterialFromFiles(
G_XFXBASE, "VS", video::EVST_VS_2_0,
G_XFXBASE, "PS", video::EPST_PS_2_0,
baseShaderAlphaInst, video::EMT_TRANSPARENT_ALPHA_CHANNEL);
Code in the shader to set the alpha value:
struct VSOut
{
float4 pos : POSITION0;
float4 diff : COLOR0;
float2 texColor : TEXCOORD0;
};
...
...
PSOut PS(VSOut In)
{
PSOut Out;
...
...
Out.color.a = 0.7f;
return Out;
}