Image: Valve

Over the last four months, the fan creator James Lambert has been documenting the development of his spectacular Portal demake, Portal 64, over on YouTube. However, it was during his most video, that he finally answered our most pressing question about the project: how does it all work?

In the video, he explains how he was able to render the portal effect on "real Nintendo 64 hardware", despite Portal releasing eleven years after the Nintendo 64 originally came out.

According to his explanation, the effect is achieved using the same technique that is behind rendering split-screen in multiplayer games, except that here the two screens overlap as opposed to being positioned one on top of the other. This can create some issues with objects from the two views leaking into one another, but Lambert luckily has a fix for that. He uses the Z-Buffer (a chunk of memory that keeps track of how far away pixels are from the camera) to prevent faraway items from being drawn over those that are meant to be closer, by rendering the portal view in the second half of the buffer range.

Portal 64
Image: James Lambert

This is only half of a solution, however, as this means that the portal view can't appear at all. So from here, he creates a hole in the wall and places a transparent overlay over the top of it, to prevent objects behind the wall from rendering over the top of the portal view. Then, for the finishing touch, he makes sure to check whether the portal cover is intercepting with the front plane, and corrects it, if necessary, to prevent any polygons from being removed.

You can watch the full video below to see how this works in practice and also to see a short explanation of how Lambert has recreated the emancipation grid, from the end of the companion cube levels. So far, the demake looks remarkably impressive, with this latest explanation doing nothing to blunt our amazement of what Lambert has been able to achieve.

[source youtu.be]