Diagram in the hidden room in "Laying the Foundation"

I entered the hidden room from "Laying the Foundation" and found this diagram: enter image description here Full-resolution version: http://i.stack.imgur.com/1828H.png

It seems to be some logic flow-chart which depicts something from the games programming. Do you have any idea what it could be?


It is indeed a shader; in particular, the layout is that of UDK, which was used to create the game, as this is built using UnrealEngine. This particular one would be read right to left, with the blocks taking their results from the right connections, and outputting to the left connections.

As for what the shader does, it's a matter of analyzing it. First, it's taking a screen position of the pixel being operated on. Second, it's ensuring that it is dealing only with the x,y coordinates (that's what the mask does). Now things get fun.

It then gets values offset from that pixel by a little bit. So it's some of the neighboring pixels; 4 of them, offset in the +x, +y, -x, and -y directions. Next step, it finds the depth value for all 5 points (4 offsets and the original). Next it uses those to find the change in depth gradient in the x and y directions, and takes the absolute value of that. It also takes the depth of the pixel and multiplies it by a small value. Second to last column now; this one compares that small percentage of depth to the change in depth gradient, outputting a value of 1 if the small value is less than the change in depth gradient. Finally, they are added together to get the equivalent of an OR operation.

So at this point you may be wondering what it actually does; unless you're a programmer, in which case it's obvious. This is the shader effect responsible for the outline effect seen on the gun and other objects throughout the game. The engine basically does it's rendering stuff, then this shader is run, and if it outputs a value of 1 or 2, you draw over the pixel with black.

The comparison with the small percentage of depth allows it to have a less pronounced effect at longer distances, drawing thin outlines, while being more bold when things are closer.


I've asked my friend, and here's his (transalted) reply (I did NOT provide him any more information than that screenshot and the suspicion that it might be shader-related).

"Most likely this is a postprocessing algorithm or a procedural texture in some strange visual editor. Theoretically a shader, but one created using a GUI instead of programmed."

He also provided me with these two links:

Shader editor 1Shader editor 2... also, BOOBIES! --sorry, couldn't resist--

As to what precisely that shader does? I've no clue. :P I have this weird feeling that it's the background grid (which would mean it's a procedurally generated texture?) used in the game (it's used as a glass pane in the main chamber room to separate the chamber from the "exit" corridor as well as other places).

I'd like to point out that the glass pane has an interesting property! Namely, it makes invisible things visible...

EDIT: Than again, the diagram might be for the shader used through the entire game (black edges, elements far away from the player lack focus giving the illusion of depth perception).