I created a shader quine, a fragment shader without input (textures or models) that produces a copy of its own source code as its output, on Shadertoy.
You can find (the full source of) the fragment shader here: https://www.shadertoy.com/view/MlGcRz.
The ‘trick’ of this shader is contained in the data of array c. The shader can decode array c to get font-data and display characters, decode a part of the data that contains the shader code itself, and finally, the shader is also able to display the data of the array as the data itself.
If you like this post, you may also like one of my other posts:
- Rendering a planet with two triangles
- Abandoned base
- Human Document
- Ray Tracing – Primitives
- Raytracing in one weekend