Difference between revisions of "Prim flicker"

From Second Life Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{KBmaster}}
'''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:
'''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:


Line 14: Line 12:
== 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, 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:
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''.
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''.
==Tips to solve "Prim flicker"==
[[Image:Primflicker- 001.png|thumb|200px|Prim flicker option 1 - Select 'Use Grid']]
[[Image:Primflicker 002.png|thumb|200px|Prim flicker option 1 - Rezzed green prim]]
[[Image:Primflicker 003.png|thumb|200px|Prim flicker option 1 - Cloned Prim]]
[[Image:Primflicker 004.png|thumb|200px|Prim flicker option 1 - End result]]
This can be solved in 2 options, both options work but please do read the notes carefully!
Option 1
This is the most common used option to fix this problem
* 1. Open the build menu and check "Use Grid" option, this allows "snap-to-grid" and most likely will solve your problem!
* 2. Now rezz a cube, lets give it a green color to see it easier
* 3. Make sure you keep the green-prim you made selected, now go back to the rezz prim menu on your build menu
* 4. Now move the mouse to the green prim and create a new prim by left clicking on one of it's 'faces' (sides). You will notice it will rezz a prim directly adjoined to the green one, also in same color, shape and size. For short a clone (NOTE: this feature does NOT work always perfectly, you may need to redo this if you are in a laggy SIM. Also shapes like orbs, rings, torus, cylinders (round side), tetrahedron, piramid and prism will NOT always do this perfectly. Due to their shape it can not be done propperly. So know you do have to use the X,Y,Z possitions to place them on their possitions instead of using this option. Also modified cubes will have this problem. Basic rule is that almost everything that is horizontal, vertical and most of all flat will usually not behave in this way)
* 5. Now make the second prim you just created pink, makes it easier to see if it worked.
Option 2
In case you want to downside the prim count, for lets say a arch in a wall, you can apply this little trick.
* 1. Create a prim and make it this size: 0.500 x 3.000 x 3.000 meters (make it green as well)
* 2. Now use option 1 to make a identical call next to it and next to that second prim as well. Now you should have 3 prims of same size, make the middle one pink
* 3. Now we will work on a arch, we will use the pink prim in the middle. Select it and let's give it the next propperties: "path cutt begin and end" B = 0.375 - E = 0.875
* 4. Make it also 50.0 hollow and set hollow shape to 'circle'
* 5. You may notice now this is not looking good yet, you need to use the grid to set the arch propperly so you can walk under it.
* 6. You will notice now that the pink arch prim is half of what a regular prim is, you can either make the prim longer, add 2 extra prims to make it a propper arch, or final make it hide partially in the walls next to it. We will do the last option. Set it's size to: 4.000 x 3.000 x 0.500
* 7. As you can see now it's flickering trough the green wall prims. Now to solve this you can make it thicker or thinner. Making it thicker will not solve it without adding more prims, so we go for thinner. Now change 0.500 to 0.495
* 8. You see now it's working now, however, this may not work on prims with alpha textures! (alpha textures are based on a 100% transparant texture, so it will show basicly what is inside as well).
NOTE: basic idea of this option is to resize the prim flickering trough your main prim with -0.05 Any smaller then this and this thick will NOT work
[[Image:Primflicker_005.png|thumb|200px|Prim flicker option 2 - Create a green wall]]
[[Image:Primflicker_006.png|thumb|200px|Prim flicker option 2 - Create 2 more walls]]
[[Image:Primflicker_007.png|thumb|200px|Prim flicker option 2 - Middle wall to arch and 'prim flickering']]
[[Image:Primflicker 008.png|thumb|200px|Prim flicker option 2 - Resize arch and finish]]
Although these are probably not the only options, but most common options to solve this 'prim flickering' problem.
The 'prim flicker' can also be solved by making prims slope slightly and other possible options.


== 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? ==
Line 77: Line 28:
{{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.}}
{{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]''' - A related prim flicker involving textures using the alpha channel. Picture examples and 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 11: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