Difference between revisions of "Prim flicker"

From Second Life Wiki
Jump to navigation Jump to search
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Prim flicker, also known as Z-fighting ([http://en.wikipedia.org/wiki/Z-fighting see technical definition)], is a common graphical annoyance in 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:
'''Prim flicker, also known as Z-fighting ([http://en.wikipedia.org/wiki/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:


# Rezzing two cubes next to each other such that their edges along two coordinates are the same.
# Rez a cube.
# Give each one a distinct color.
# {{K|Shift}}-drag the cube to copy it in one direction, and leave them somewhat overlapping.
# Intersect them slightly and move your camera.
# Give each cube a distinct color.
# Move your camera to see the flicker in action.
 
This video shows you more:
 
{{KBvideo|7574860}}


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


There are several ways to approach this, depending on what you're doing. Usually, you can simply offset one prim slightly,, 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:
Avoid it by design in the first place if you can. If you don't need to overlap prims, adjust them in fine increments (<code>0.001</code> 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, [[Camera|zoom in closely]] and ensure that textures are aligned. There are [http://bit.ly/t5X9y 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 <code>0.010</code>-<code>0.100</code> 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:


{{KBvideo|4168689}}
{{KBvideo|4168689}}
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? ==
== 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. In some cases, 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.
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. In response to other games used as examples for "Why can't Second Life do this?" [https://jira.secondlife.com/browse/VWR-27?focusedCommentId=100511&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_100511 BigPapi Linden wrote]:
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?" [https://jira.secondlife.com/browse/VWR-27?focusedCommentId=100511&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_100511 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.
{{Quote|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 why it isn't a straightforward fix, but requires more insight.
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 ==
== See also ==


* '''[https://jira.secondlife.com/browse/VWR-27 Prim textures overlap strangely when transparent textures applied]''' - Lots of related discussion towards furthering understanding in the comments.
* '''[https://blogs.secondlife.com/community/community/tnt/blog/2009/11/18/building-unraveling-the-mysteries-of-prim-flicker Helpful Tips from Residents]''' - On blogs.secondlife.com.
* '''[https://jira.secondlife.com/browse/VWR-27 Prim textures overlap strangely when transparent textures applied]''' - A related prim flicker involving textures using the alpha channel, also called "alpha sorting". Picture examples and lots of related discussion towards furthering understanding in the comments.
 
[[Category:Content creation]]

Latest revision as of 12:02, 27 December 2011

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