First of all, if there is a sorting issue between the first pass and the second pass, you can try to apply a depth bias to it:
Code: Select all
getTechnique(x)->getPass(y)->setDepthBias(1.0f); // You can make the value higher of course
https://ogrecave.github.io/ogre/api/13/ ... otoc_md130
I just do this to create a new pass on a material that should have a texture that supports transparency on it:
Code: Select all
Pass* tmpNewPass = tmpTechnique->createPass();
TextureUnitState* tmpNewTextureUnitState = tmpNewPass->createTextureUnitState(tmpDiffuseTextureName);
So I don't do the last line that you do (I don't even find a single search result for "LBX_BLEND_TEXTURE_ALPHA" in my huge game code-base, so it is never needed it seems like?).
It seems their technique is a fullscreen effect (compositor, which are expensive), since it bleeds outside of the original mesh.
To do that in Ogre, you need to create a new technique and a pass for that in the material, then set that new techniques Material Scheme.
Then you need to render only that material scheme in a compositor and handle its appearance through a shader.
Or, you can just skip the special effects and bleeding away from the original mesh and skip the compositor route.
I would then just do a new pass like you are doing, set the depth bias and then apply a special shader to the pass.
Then that shader should have a texture input which is a texturemap of the mesh (in your case, the character) where the effect should actually happen (the same kind of a map like how it is normally textured with UV:s).
Then the shader checks if the current pixel is actually in the area where the effect can happen (read the pixel and see if it is not black for example) and then it should either use "discard;" if it fails or it should handle the greenish appearance if it succeeds.
The greenish appearance can be made by another texture that is the green pattern, or the texturemap above that handles where the effect is shown can just be the greenish pattern, which will be much simpler since you just have to add it to the base diffusemap texture, but then you can't do fancy effects such as texture scrolling and such.
If you did not mean the greenish pattern, but the outline, there are a billion articles on how to do an outline shader online (some expensive, some not).