How to make underground objects visible through terrain

Hello again!

I was wondering how it would be possible to make certain spatial’s underneath a terrain visible?

I have a some spatial’s placed on top of the terrain which I would like to still be occluded when, for example, they are behind a hill, but other objects which are sub-surface, like a water pipe, visible through the terrain.

Currently I can’t get any spatials (above or below) to show through the terrain. I’ve tried
but with no effect, and can’t find how to set the Z Buffer as suggested in an old post (2010).

All terrain patches are using the Lighting.j3md material, but swapping to Terrain.j3md also has no effect.

Does anyone have any pointers?
Many thanks.

you’d want the objects you want to see through the terrain in the translucent bucket (don’t put the terrain node in it), and also set depth read to false on them

Sorry @wezrule where/ how do I set the depth buffer read?

Okay, think I’ve got it, although un-tested on the above ground features hiding behind hills…

if (heightOffset < 0 && (obj instanceof com.jme3.scene.Geometry) ) {
((com.jme3.scene.Geometry) obj).getMaterial().getAdditionalRenderState().setDepthTest(false);