Weird splatting alpha problems [SOLVED]

Hi, I'm currently trying to implement terrain splatting using some code from the TestTerrainSplatting example, and I got some weird effect with blending.



It's like transparency is boolean (either fully transparent / opaque).



The alphastate / texturestate used are the same as in TestTerrainSplatting.



Code for Alphastate :


final AlphaState as = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();
as.setBlendEnabled(true);
as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
as.setTestEnabled(true);
as.setTestFunction(AlphaState.TF_GREATER);
as.setEnabled(true);



Code for TextureState of alpha map


Texture t1 = TextureManager.loadTexture(HeightmapAsset.class.getClassLoader().getResource("jmetest/data/texture/terrain/darkrockalpha.png"), Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR);
t1.setWrap(Texture.WM_WRAP_S_WRAP_T);
t1.setApply(Texture.AM_COMBINE);
t1.setCombineFuncRGB(Texture.ACF_REPLACE);
t1.setCombineSrc0RGB(Texture.ACS_PREVIOUS);
t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
t1.setCombineFuncAlpha(Texture.ACF_REPLACE);
t1.setFilter(Texture.FM_LINEAR);
ts.setTexture(t1, ts.getNumberOfSetTextures());


The grey area on the shots correspond to full transparency (grey quad below terrain), and the darker area shall be semi transparent, but they are opaque. I think I'm missing something rather trivial here.

Code for applying states in a PassNode :


PassNodeState passNodeState = new PassNodeState();
passNodeState.setPassState(ts);
passNodeState.setPassState(as);
splattingPassNode.addPass(passNodeState);






Thanks in advance.
Adrien ASESIO.

Hi again,



I found the solution, it was a ZBuffer write/test problem and had nothing to do with the used alpha states.



I managed to get things to work fine.

Great, nice work solving it. :slight_smile: