Very simple framework for making generic 4klang + fullscreen fragment shader 4k intros. Written in pure assembly and does not require Visual Studio installed.
Just add 4klang.inc and shader.frag files and run build-slow.bat to build a release binary of your intro.
- Make music in 4klang
- Export it into
4klang.inc, replacing existing file here
- Make a full screen GLSL fragment shader somewhere, e.g. in Shadertoy or Bonzomatic
- We plan to provide a more convenient tool for editing shader in sync with music, see issue #4
- Copy shader source to
shader.fragfile - "Port" shader from your tool, e.g. (it may require more editing):
- This tool will create OpenGL 2.1 context, so GL is limited to
#version 130 - add
uniform float t;, this is the uniform that will get current time in BPM-dependent music ticks, not seconds. - make
void main()andgl_FragColorandgl_FragCoordinstead of whatever your tools have - replace Shadertoy's:
iTimewithtfResolutionwithvec2(1920., 1080.)
- Bonzomatic's:
fGlobalTimewitht
- This tool will create OpenGL 2.1 context, so GL is limited to
- Run
build-fast.batto buildintro-fast.exe
Use build-debug.bat when first porting your shader. It will build a debug configuration that won't have music, will be windowed, will check all gl calls and MessageBox in your face about shader compilation errors.
Use build-fast.bat when iterating and estimating intro size. It will build your intro in seconds.
Use build-slow.bat when crunching for final. It will be 50-100 bytes less than fast variant, but will take several minutes to build.
- Shader Minifier is ran against
shader.fragfile to generateshader.incwith minified shader file. - NASM compiles
intro.asmintointro.obj; it includesshader.incand4klang.incfor metadata. - NASM compiles
4klang.asminto4klang.obj; in includes4klang.incfor music data. - Crinkler links and compresses these object files into a final binary.
If you understand Russian, you can watch a somewhat more in-depth explanation here:
- Как сделать 4к интро своими руками из песка и слюны, часть 1
- Как сделать 4к интро своими руками из песка и слюны, часть 2
This framework uses:
- 4klang for music synthesis
- Shader Minifier.exe for shader minification
- NASM for compiling assembly
- Crinkler for compressing and linking the final binary
Kudos to all these projects authors! Without them modern size-coding scene would not be the same!
All these dependencies are downloaded automatically whenever you run any of the build scripts for the first time.
WTFPL for this repo itself (or Public Domain if you're boring).
Dependencies have their own respective licenses, consult them.