Wolfenstein's original rendering engine as 450 line shader with no external data
The aliasing in this was driving me insane, fortunately it&#x27;s really easy to implement anti aliasing.<p>Change the function signature of the current main function to<p><pre><code>    vec3 getColor(in vec2 fragCoord ) {
</code></pre>
And the last line to<p><pre><code>    return col
</code></pre>
Then just call it a bunch of times with nearby points in a new main function<p><pre><code>    void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
        vec3 c1 = getColor(fragCoord + vec2( 0.25,  0.25));
        vec3 c2 = getColor(fragCoord + vec2( 0.25, -0.25));
        vec3 c3 = getColor(fragCoord + vec2(-0.25,  0.25));
        vec3 c4 = getColor(fragCoord + vec2(-0.25, -0.25));
        
        fragColor = vec4((c1 + c2 + c3 + c4) &#x2F; 4., 1.0);
    }
</code></pre>
Obviously this does 4x the amount of work as without antialiasing, but with modern hardware you don&#x27;t notice it and it looks <i>way</i> better.