[Solved] Z-fighting The Quest

Thanks Aaron, I’ll have a look at that.

Hi Aaron,

Thank you for your links. I incorporated the code into my own project.

Although the z buffer flickering was eliminated, other artifacts arose like “floating” terrain and gaps in the terrain.

I’m using alpha mapping to merge in 3 different terrain textures, as in the JME3 “TerrainLighting” material.

Can you suggest any reasons why these problems would arise ?

thanks
steveh

PS, I think that the Lords and Masters of JME should incorporate the Logarithmic depth buffer as standard in JMonkey. It would solve a lot of hassles.

I should also mention that I use a terrain quad with a Terrain Lod Control . Would this produce the artifacts described with a logarithmic depth buffer ?

Thanks
steveh

Hard to say with out taking the time to look through what you’ve done. I
will say you have to use a logryhtmic buffer in all materials in your scene
or you’ll have problems like you mentioned.

I eventually gave up in this approach and used a dual viewport setup. This
allowed me to use built in materials and take advantage of shadows and fog
effects. This code is also in the same project.

Aaron

The multi viewport approach seems to be the bee’s knees (Aussie expression meaning excellent !).

Rock solid graphics with little detriment to performance. Thank you very much for that. I think this technique should be written into the “Beginner’s Guide” as the Z-fighting issue is going to arise when people start to use realistic terrain.

Well done.

I’m having some trouble attaching a SkyBox to the viewports. Any hints on how to do this ?

Don’t worry, I’ve sorted it.