Z-fighting-like issue around corners of voxel-based models

Hi all, just joined this forum :slight_smile:

I’m working on a game with voxel-based models and I’m having a problem that looks like z-fighting, but isn’t really. Please see the following image explaining it (might need to show full size for details):

Basically I have one voxel-based model rendered on top of another, and around the corners connections the internal model is seen through the parent, even though it shouldn’t happen (mathematically speaking, none of the internal vertices overlaps the external model - there’s just an edge aligning together).

I tried all the regular techniques to resolve z-fighting (playing with camera depth, polygons offset in materials, sorting order, even slightly enlarging the external model) - but none of it worked.

Any idea how to fight these artifacts? They look very bad while animating models.


Bump - please someone :confused:

Can you please use the following fiddle as a basis in order to reproduce your issue?


@Mugen87 cool it doesn’t happen in your fiddle! That’s a great idea I’ll start from there, try to break it, and report back what was the problem for whoever may be interested.
Thanks :slight_smile:


Update: I found the problem, I was misusing the polygon offset feature in materials :frowning:
It’s a great feature, but if you mess it up and forget about setting it someplace in your code it causes real havoc. Thanks @Mugen87, your fiddle helped me a lot!

1 Like