Platform Requirement:  This script works on  PC only  (Tested in Windows, macOS and  Linux I have no idea but it should work). 


How to Install

  1. Install a Userscript Manager:  Open Google Chrome and install the  Tampermonkey  extension from the Chrome Web Store.

  2. Create a New Script:

    • Click the Tampermonkey icon in your browser toolbar.

    • Select  Create a new script .

  3. Paste the Code:

    • Delete any default text in the editor.

    • Copy the entire script code provided below.

    • Paste it into the Tampermonkey editor.

  4. Save:  Press  Ctrl + S  or go to  File > Save  within the Tampermonkey editor.


// ==UserScript==
// @name         Angeldust Color in Ambient Occlusion - A CIAO
// @namespace    http://tampermonkey.net/
// @version      6.9
// @description  Changes the hue of the ao map based on the vertex colors to aura farm. ALso called tinted AO, but CIAO is funny in my head.
// @author       Ripie and a select number of artificial hate generators.
// @match        https://angeldu.st/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    let aoEnabled = true, activeProgram = null;

    // Minimal UI
    window.addEventListener('load', () => {
        const btn = document.createElement('button');
        btn.style.cssText = "position:fixed;top:10px;left:10px;z-index:99999;padding:4px 8px;background:#111;color:#0ff;border:1px solid #0ff;font-family:monospace;font-size:11px;cursor:pointer;border-radius:4px;font-weight:bold;";
        btn.innerText = "AO: ON";
        btn.onclick = () => {
            aoEnabled = !aoEnabled;
            btn.innerText = "AO: " + (aoEnabled ? "ON" : "OFF");
            btn.style.borderColor = btn.style.color = aoEnabled ? "#0ff" : "#ccc";
        };
        document.body.appendChild(btn);
    });

    // WebGL Hooks
    const P = WebGLRenderingContext.prototype;
    const _src = P.shaderSource, _use = P.useProgram, _draw = P.drawElements;

    P.shaderSource = function(shader, source) {
        let mod = source;
        const target = "vec3 local_LightColorAmbient = (0.25 * (uniform_LightColorSkyHorizon + uniform_LightColorSkyZenith));";

        if (source.includes(target)) {
            mod = mod.replace("void main() {", "uniform float u_AO_Blend;\nvoid main() {");
            mod = mod.replace(target, `
                vec3 local_LightColorAmbient = (0.25 * (uniform_LightColorSkyHorizon + uniform_LightColorSkyZenith)); // so it looks cool and not gray like obis hair
                #ifdef AD_SHADER_ENABLE_COLOR
                vec3 C = vertex_Color.rgb;
                float mx = max(C.r, max(C.g, C.b)), mn = min(C.r, min(C.g, C.b));
                vec3 tint = mix(vec3(0.65, 0.82, 1.0), C / max(mx, 0.001), clamp((mx - mn) * 3.0, 0.0, 1.0));
                local_LightColorAmbient = mix(local_LightColorAmbient, local_LightColorAmbient * tint, vertex_LightEnvironment.y * u_AO_Blend);
                #endif
            `);
        }
        return _src.call(this, shader, mod);
    };

    P.useProgram = function(prog) {
        _use.call(this, prog);
        activeProgram = prog;
        if (prog && !prog._ao) {
            prog._ao = true;
            prog._uAO = this.getUniformLocation(prog, "u_AO_Blend");
        }
    };

    P.drawElements = function(mode, count, type, offset) {
        if (activeProgram && activeProgram._uAO) {
            this.uniform1f(activeProgram._uAO, aoEnabled ? 1.0 : 0.0);
        }
        return _draw.call(this, mode, count, type, offset);
    };
})();