KatsBits Community

What are 'Sparklies' and why do they happen

kat · 1 · 24566

0 Members and 1 Guest are viewing this topic.

Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 3140
    • KatsBits
Problem
When running through a level various spots seems to 'sparkle' or 'twinkle' as the camera moves past or around them. Often there are no obvious reasons for their appearance as the area looks perfectly fine.

Solution
The white lines that can sometimes appear are commonly called "sparklies" by level designers. They are caused by almost imperceptible tiny gaps or cracks in surfaces, typically where polygons touch. The 'sparkle' aspect of the problem is essentially just the 'Void' outside the structure shining through; because the Void is often a lighter colour, and due to the way rendering shuffles pixels around as the camera moves, the net effect is a faux 'twinkle' - the effect is not specifically related to 'illumination' (although it does happen if the hairlines cracks expose lights or other effects).

There are number of reasons why 'sparklies' happen;
  • An unintentional oversight by the level designer where a gap or misalignment has been left between brush volumes - typically the result of manipulating brush volumes of too small a grid-scale, or the result of misjudging a two or three-point clip operation.
  • A "rounding off" error caused by an incomplete math calculations of coordinate data related to the position of vertex points in space; minute discrepancies co-locating vertices can extrapolate out to result in gaps and hairline cracks.
  • A 'bad' or 'corrupted' brush volume that's the result of manipulating a brush too much, or doing so at odd angles of orientation (making a terrain for example), or from cutting or otherwise clipping a volume poorly. All can cause brush volume data to be corrupt leading to miscalculations at compile.
  • A gap caused by improper brush optimisation when Patch Mesh objects are used; essentially brush volumes should be split where they meet patch mesh object so BSP can properly structure the layout of polygons in a given area. Where this is not done the compiler makes a 'best guess' and cuts, leading to gaps and cracks when this is misjudged.
How to determine what's causing sparklies

Simple Gaps
Generally speaking because the error tends to be of a fixed location - sparklies always tend to appear in the same place - it should be possible to fix the problem by opening the level in Radiant or other editor and thoroughly inspecting the offending area to see if an actual gaps exists. If they do delete the offending volumes and reconstruct before re-compiling the level.



Duplicate Planes/Bad Brush
If there are no gaps then it's likely the result of a rounding off error, a bad or corrupt brush volume, in which case run bobToolz "Brush Cleanup" ("Plugins » bobToolz » Brush Cleanup") to remove the malformed volume or data (this may remove the actual brush from the level). In some instances this won't fix the problem so the area will need to be deleted and rebuilt.



Patch Mesh Sparklies (T-Junctions)
If the appearance of 'sparklies' are near a curve or other patch mesh structure it means the point where brush and patch meet[1] needs to be better optimised to prevent errant splits (or T-Junctions). In Radiant inspect the area and cut the brush so its the same size and angle relative to the patch mesh and move or cut brush structures to match edge-for-edge or more typically edge-to-corner[2].



Graphics Card Drivers
If none of the above fixes the problem then it means the appearance of sparklies could be down to a graphics card rendering error. Although this is rare for modern cards, some older models for which drivers are no longer available can still exhibit the problem. Sparklies can also occur as a result of over-clocking or over-heating hardware.