Sorry for very frequent asking here, but it really doesn't work for an obscure reason although it really should do. I bound an own shader to my material which belongs to a mesh scene node and enabled the blend operation EBO_ADD since this material is intended to be transparent (that shader calculates pbr lighting, shadows and then output to gl_FragColor the final color RGB and alpha component is just taken from its color texture), then I defined the blend factors:
Code: Select all
n_mat_copy.BlendOperation = video::EBO_ADD;
n_mat_copy.BlendFactor = video::pack_textureBlendFunc(video::EBF_SRC_ALPHA, video::EBF_ONE_MINUS_SRC_ALPHA,
video::EMFN_MODULATE_1X, video::EAS_TEXTURE | video::EAS_VERTEX_COLOR);
The fragment shader:
Code: Select all
uniform sampler2D mBaseTex;
//<some uniforms>
vec4 baseColor = texture2D(mBaseTex, gl_TexCoord[0].st);
//<lighting and shadows calculations>
gl_FragColor = vec4(color, baseColor.a);
However, this just renders nothing. The last two parameters (in pack_textureBlendFunc), especially penultimate, are not entirely clear for me what they do, they are bad documented. I can say all my shaders work fine, at least output correct colors, but when I set those blend factors like how above, it stops rendering. If I omit this property (what is identical to setting it as "0.0f"), it renders, however the z-fighting problem is caused and isTransparent() returns false.