I need to use texture transparency (PNG with alpha) on an object, using a material with shaders.
If I don't use shadersk, I can just use:
Code: Select all
node->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
But I need shaders (in particular vertex), and then I use:
Code: Select all
objectMaterial = gpu->addHighLevelShaderMaterialFromFiles(
"objects.hlsl", "vertexMain", video::EVST_VS_3_0,
"objects.hlsl", "pixelMain", video::EPST_PS_3_0,
mc, video::EMT_TRANSPARENT_ALPHA_CHANNEL, 0, shadingLanguage);
...
u32 mcount = node->getMaterialCount();
for(u32 i = 0; i < mcount - 1; i++)
{
node->getMaterial(i).BackfaceCulling = false;
}
The texture is a kind of grid.
The node is like a watermelon slice, a thick piece of sphere. From "inside", it appears correctly, I see every part of the grid on every faces. From "outside", I can only see the outside, just like it was only a piece of sphere without thickness.
So, from outside, all the object is like hidden by the external faces, even if I can see the rest of the scene through it.
Note I set backface culling to false.
So my question is:
What am I supposed to do if I want the same result with shaders than using setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL) without shaders ?
Thanks,
K.