ArmorPaint shaders are written in Kong, a custom shading language that compiles to platform-specific GPU code at build time. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/armory3d/armorpaint/llms.txt
Use this file to discover all available pages before exploring further.
ashader component of amake invokes the embedded minikong compiler to translate each .kong file into HLSL (for Direct3D 12), MSL (for Metal), or SPIRV (for Vulkan). At runtime, the engine loads the pre-compiled binary shader for the active graphics API — no shader compilation happens at startup.
Kong is a custom shading language developed for the ArmorPaint / iron engine project. It is not standard GLSL, HLSL, or MSL. The minikong compiler embedded in
base/sources/kong/ is based on Kongruent by RobDangerous.Kong Language Overview
Kong shader files use a.kong extension and describe vertex and fragment (pixel) shader programs as typed functions. The language features:
- Strongly typed scalars and vectors:
float,float2,float3,float4 - Struct definitions for vertex input/output layouts
funkeyword for shader function declarations#[set(everything)]attribute for binding constant buffers, samplers, and textures#[pipe]struct to wire vertex and fragment stages into a pipeline objectsample()built-in for texture sampling
ashader Compilation Pipeline
ashader.c (part of amake) drives shader compilation during the build. For each .kong file it produces one output per enabled target:
- Direct3D 12 (Windows)
- Metal (macOS/iOS)
- Vulkan (Linux/Android)
- WebGPU (WASM)
- minikong compiles
.kong→.hlslsource - The DirectX Shader Compiler (
dxc) compiles.hlsl→.csoD3D bytecode - The
.csofile is bundled into thedata/output directory
IRON_DIRECT3D12Base Shaders
The UI renderer shaders live inbase/shaders/ and are shared across all platforms:
| File | Purpose |
|---|---|
draw_image.kong | Render a textured quad with per-vertex color tinting |
draw_rect.kong | Render a solid-color rectangle |
draw_text.kong | Render text glyphs from an atlas texture |
draw_tris.kong | Render colored triangles |
line.kong | Render 2D lines |
line_overlay.kong | Render lines drawn on top of the 3D scene |
Example: draw_rect.kong
This is the simplest engine shader — it renders a colored rectangle with no texture lookup:Example: draw_image.kong
The textured quad shader samples a 2D texture and multiplies by per-vertex color. Note the pre-multiplied alpha output:Paint Shaders
The paint-specific shaders live inpaint/shaders/ and handle all 3D viewport and painting operations:
| File | Purpose |
|---|---|
cursor.kong / cursor_decal.kong | Brush cursor rendering in the viewport |
mesh_posnortex.kong | Mesh rendering with position, normal, and UV |
mesh_posnor.kong | Mesh rendering with position and normal |
mesh_poscol.kong | Mesh rendering with per-vertex color |
layer_copy.kong / layer_copy_bgra.kong | Layer buffer copy operations |
layer_merge.kong | Layer compositing |
layer_invert.kong | Layer color inversion |
dilate_pass.kong / dilate_map.kong | UV dilation for seam removal |
deferred_light.kong | Deferred lighting pass |
ssao_pass.kong / ssao_blur_pass.kong | Screen-space ambient occlusion |
taa_pass.kong | Temporal anti-aliasing |
compositor_pass.kong | Final image compositing |
prefilter_envmap.kong | Environment map pre-filtering |
world_pass.kong | World/background rendering |
histogram_pass.kong | Histogram computation for the color analyzer |
bloom_downsample_pass.kong / bloom_upsample_pass.kong | Bloom effect |
Material Shader Generation
ArmorPaint’s procedural material system does not use pre-written.kong files for material outputs. Instead, parser_material.c traverses the live material node graph at runtime and generates shader source code dynamically. This generated code is then compiled on-the-fly by the embedded Kong compiler (enabled via the with_kong build flag) and uploaded to the GPU.
This means every change to the material node graph produces a freshly compiled shader, allowing fully procedural, node-driven materials without a fixed set of pre-authored shader permutations.
Raytrace Shaders
Hardware ray-tracing shaders live inbase/shaders/raytrace/. Unlike the Kong-based UI and paint shaders, these are written directly in API-native source languages and pre-compiled to binary:
| File | Backends |
|---|---|
raytrace_brute_core.* | .cso (D3D12), .spirv (Vulkan), .metal (Metal) |
raytrace_brute_full.* | .cso (D3D12), .spirv (Vulkan), .metal (Metal) |
raytrace_bake_ao.* | .cso, .spirv, .metal |
raytrace_bake_light.* | .cso, .spirv, .metal |
raytrace_bake_bent.* | .cso, .spirv, .metal |
raytrace_bake_thick.* | .cso, .spirv, .metal |
raytrace_brute.hlsl, raytrace_brute.comp, raytrace_brute_core.metal, etc.) are in base/shaders/raytrace/src/ along with build scripts (build_dxr.bat, build_metal.sh, build_vkrt.sh). These shaders power the Brute Pathtracer — ArmorPaint’s hardware-accelerated path-tracing engine — which supports Direct3D 12 DXR, Vulkan ray tracing, and Metal ray tracing.