Prim flicker

From Second Life Wiki
(Redirected from Z-fighting)
Jump to navigation Jump to search

Prim flicker, also known as Z-fighting (see technical definition), is a common graphical annoyance which affects, but is by no means limited to Second Life. It appears when two faces share the same surface space — in other words, they're fighting for what appears, and as a result, look ragged and almost crosshatched. You can easily reproduce this:

  1. Rez a cube.
  2. Shift ⇧-drag the cube to copy it in one direction, and leave them somewhat overlapping.
  3. Give each cube a distinct color.
  4. Move your camera to see the flicker in action.

This video shows you more:

<videoflash type="vimeo">7574860|640|480</videoflash>

How do I work around Z-fighting in Second Life?

Avoid it by design in the first place if you can. If you don't need to overlap prims, adjust them in fine increments (0.001 m is the minimum) so they're touching edge-to-edge, but not intersecting the same space. If you're trying to build a continuous surface out of several prims such as a wall or road, zoom in closely and ensure that textures are aligned. There are texture alignment tools on Xstreet made by fellow Residents that can help.

If avoiding prim overlap isn't an option, usually, as shown in the above video, you can simply offset one prim slightly by 0.010-0.100 m, such that it appears almost level with an adjacent prim, yet is distant enough to avoid Z-fighting. This video shows how that applies in the context of building a bridge across Region boundaries:

<videoflash type="vimeo">4168689|640|480</videoflash>

This can also be used when you have an object with a faux ("baked") shadow on its bottom, yet it clashes with the floor. What you want to do is have the shadow close to the floor plane so that it appears almost at the same level, but not quite.

Why don't I see Z-fighting in other 3D experiences, like games?

We'd need to look at a specific case to detail why. Generally, some game engines are designed with workarounds to minimize or avoid the visible effects of Z-fighting. That may mean that Z-fighting is still present, it's just obscured. In addition, professional computer artists know how to deal with Z-fighting when they see it.

In Second Life, much content is created by enthusiasts who aren't necessarily graphic programmers. This is a tradeoff to give you freedom in exchange for being to see and fine-tune "rough edges". In response to other titles used as examples for "Why can't Second Life do this?" BigPapi Linden wrote:

Everything else you mentioned is a perfect example of the things that you can do when you have professional artists working in a structured environment on art. We have an open system where close to all of our content is created by amateurs in the public at large and where we don't place many limits on the efficiency of the content they create. So yes, of course a modern AAA videogame looks better than the average SL scene. Professional game artists (which Bethesda's most certainly are) are simply that good and their engine has been created to perform well and look beautiful, not to allow anyone to dynamically create any content that they want with few limits.

That's why it's beneficial to educate Residents about what Z-fighting is and fixing it isn't straightforward, but requires more insight how computer graphics work.

See also