So I noticed in one of my videos that, when using NCHLShader2, materials that are hidden with sliders will sometimes cut out characters behind them.

In the image the model stack is the stage, front Miku, back Miku. So we see the skirt and jacket of front Miku keeps parts of back Miku from rendering but the Stage renders behind that.

This next part is just me talking about how smart I am so if you want to just get to the fix skip down to the part I have labelled THE FIX. You might notice that this is behavior similar to how semitransparent textures will act when drawn in a certain order. So I came to the conclusion that the shader knew that the Material was transparent when drawing it but wasn't passing that information to subsequent material draws. So when back Miku gets drawn MMD thinks there is something blocking that part and so doesn't draw those pixels. The fix I came up with is for the shader to check if the alpha of the Materials diffuse property (In PMXE it is labelled opaque). If the value is zero it copies that alpha to the color that the shader returns. Then later material draws will know that the pixel is transparent and they'll need to put something in there.

1. Go into your NCHLShader2 folder.
2. Find NCHLShader2.fx which should be in the folder and Main.fxh in the presets folder (The presets folder might be in japanese but it is the one with files like Skin.fx and Hair.fx)
3. Open the files in a text editor like notepad or sublime text.
4. Find the line "//if( transp ) Color.a = 0.5f;" in both files
5. Beneath that line add "if(MaterialDiffuse.a == 0) Color.a = MaterialDiffuse.a;" without the quotes
6. Save the files and reload your MMD project.

It should now be fixed. I'm not sure if this might break something else but so far it seems to work for me. The second picture shows it with the fix.

If you find this breaks something or you can't get the fix to work leave a comment and I'll try to help.

NCHLShader2 by nil

Model by JustLooking, Ƹ̵̡Ӝ̵̨̄Ʒ, kumagoro, つみだんご

Stage by Maddoktor 2