rusteria 0.9.7

Rusteria is a fast shader-like programming language.
Documentation

// Marble
fn shade() {
    // Animated marble using fBm Perlin turbulence to warp periodic bands.
    // We only read the x component from textures for speed (our VM uses x as the value).
    let t = 1;

    // Scale the domain (bigger = larger veins)
    let uv2 = uv * 1.0;

    // Two octaves of precomputed fBm Perlin, phase-shifted to avoid locking patterns
    let n1 = sample(uv2 + vec2(t, 0.0), "fbm_perlin");
    let n2 = sample(uv2 * 2.0 + vec2(0.0, t), "fbm_perlin");
    let turb = 0.6 * n1 + 0.4 * n2; // [0,1]

    // Periodic bands along x, warped by turbulence
    let bands = uv2.x + turb * 0.6;
    let s = sin(bands * 8.0);               // number of veins
    let veins = pow(1.0 - abs(s), 3.0);     // sharpen sin valleys into thin veins

    // Base marble color (slightly bluish-white) and vein color
    let base_col = vec3(0.92, 0.93, 0.96);
    let vein_col = vec3(0.18, 0.20, 0.24);

    // Mix base and veins
    color = mix(base_col, vein_col, veins);

    // Subtle mottling using value noise
    let m = sample(uv2 * 0.5 + vec2(0.0), "value"); // [0,1]
    color *= (0.9 + 0.1 * m);    
}