Line Glitch

From Jak Speedruns Wiki
Jump to navigation Jump to search
Line glitch occurring at the entrance of Lava Tube.

Line glitch is a glitch that occurs in the Jak and Daxter series when one of the DMA buffers in a PlayStation 2 gets corrupted and stops rendering in-game visuals. It will continue to display the last frame before the corruption occurred, causing an image burn-in effect on screen. The glitch can be fixed by power cycling the PlayStation 2 console or by corrupting the DMA buffer again in a way where it fixes itself.

Recreation

DMA buffer corruptions can be easily recreated in Jak and Daxter: The Precursor Legacy, Lava Tube being the best known location for doing so. One method is to simply look towards the Red Sage hut from the entrance of Lava Tube. Another method is to use Free Cam while in Cheat Mode and look towards the zoomer from the second Lava Tube Skip cold spot. Both methods require precise camera angles to cause the DMA buffer to crash. Results are not guaranteed and vary heavily in results.

Discovery

It is unknown who first discovered line glitch since it can happen during casual play.

Technical

The Vector Unit 1 (VU1) and Graphics Synthesizer (GS) handle visual rendering for the PlayStation 2. The VU1 does calculations that are turned into display lists. The DMA Controller (DMAC) manages the data transfer between all processing elements in the system. In terms of the graphics pipeline, the DMAC is able to automatically feed the VU1 with data from main system DRAM with no CPU intervention allowing the VU1 to get maximum parallel operation. If the DMA Controller gets corrupted, the data it sends to the VU1, if any, results in either Line Glitch, Dark Glitch, Texture Corruption, or a mixed variant of the three.

Source: Inside the Playstation 2:Architecture, Graphics Rendering, and Programming

Breakdown by Water111:

Jak has two "framebuffers", which store the image to be displayed on the screen. You should have one framebuffer displayed on screen while the other is being generated by the engine. In interlaced video, used on the PS2, the odd numbered frames draw the odd numbered horizontal lines on the screen, and the even frames draw even lines. This means that the PS2 has to generate a video signal that "shakes up and down 1 pixel every frame" to make the video steady on your TV. One of the frame buffers is the odd frame buffer, and one is the even frame buffer. When the game is running happily at 60 fps, the odd frame buffer is being drawn on the screen while the engine is outputting to the even frame buffer and vice versa. Now imagine that the game cannot achieve 60 fps. It will begin drawing to the odd frame buffer while the even frame buffer is being displayed as normal. However, when it comes time to display the odd frame buffer, it is not yet ready. There is not much you can do in this situation (the odd frame buffer we want to display is not ready, and may be full of garbage), other than to display the even frame buffer on the odd lines of your TV. So the game gives up on shaking the output up and down at 60 Hz, and instead delivers the same data to both the even and odd lines, making the video appear choppy and low resolution in the vertical direction. (It may also try its best to do the shake at < 60 fps, but I am not sure - either way the resulting video on your screen will be very bad)

To trigger <60 fps on console, you can go to forbidden jungle near the spikey swinging thing next to the last mirror in the jungle. If you face toward the temple/river, there will be a huge amount of polygons on screen (around 130k), which will drop the framerate pretty reliably. Because a computer monitor works using different technology, this looks very different in PCSX2. To trigger in PCSX2, disable all interlacing settings in GSDX (screen shouldn't shake), then go to the forbidden jungle spot, and set EE cyclerate to -2 and max VU cycle stealing. You should see the screen shake up and down by one pixel.

Once the speed reaches above 60 fps again, the game will go back to shaking the image up and down at 60 Hz. However, it needs to decide which frame should be the "up 1 pixel" frame and which should be the "down 1 pixel" frame. (If it gets it backward, it will make the image shake up and down violently on your TV) It does this by asking the PS2's graphics timing hardware what it's currently on. If the timing is very unlucky, it will accidently determine that both frames should be the down-1-pixel frame. This causes the upper frame to never be drawn, leaving lines on the screen. I suspect that this glitch can be cleared by going to forbidden jungle and causing a frame rate drop again. Is there a reliable way to cause this glitch? If it can be fixed by a frame rate drop, it is caused by this unlucky timing. If not, it is probably caused by one of the even/odd dma-buffers/dma-context getting corrupted, in which case you'd need to restart. I have no idea how you could cause this though.