Skip to content
Joshua Miller edited this page Oct 14, 2025 · 5 revisions

Voxy.JSON

For Voxy to support your shader a new "program" is required voxy.json (it goes alongside your other gbuffer programs etc and is per dimension), this program is a json file, know is not optimal sorry about that. You can find more information in the Voxy.json page.

Here is a minimal* voxy.json example json file

{
  "version": 1,
  "uniforms": [],
  "opaqueDrawBuffers": [0],
  "translucentDrawBuffers": [0],
  "opaquePatchData": "void voxy_emitFragment(VoxyFragmentParameters parameters) {discard;}",
  "translucentPatchData": "void voxy_emitFragment(VoxyFragmentParameters parameters) {discard;}"
}

* This will not render any lods as it is immediately discarding every fragment for opaque and translucent.

Patching

Your patching code is quite literally a patch, it is copied and pasted as-is into Voxy's own shader at the end of the fragment shader. Voxy will invoke your fragment shader for each fragment it deems ok todo so. See Notes & Limitations for restrictions.

voxy_emitFragment() is called with a struct VoxyFragmentParameters which is as follows

struct VoxyFragmentParameters {
    vec4 sampledColour;
    vec2 tile;
    vec2 uv;
    uint face;
    uint modelId;
    vec2 lightMap;
    vec4 tinting;
    uint customId;//Same as iris's modelId
};

Your patch data must describe the output buffers (as you normally do in shaders) and write to them. the buffers used must be put in opaqueDrawBuffers and translucentDrawBuffers, and you index them as you describe them. You are not allowed to put uniforms, ssbos, image samplers, etc in your patch; these declarations will be automatically injected by Voxy before your patch data. The reason for doing this is layout in Voxy's internal code to avoid conflicting binding locations.

Your patch data may either do it in the json file using opaquePatchData and translucentPatchData, or you may use the following programs voxy_opaque.glsl, voxy_translucent.glsl and voxy_taa.glsl (which will get into later). these programs will be used if they are available instead of requiring to be described in the json file.

Uniforms

The uniforms that are added to iris are as follows:

uniform int vxRenderDistance; // in chunks
uniform mat4 vxViewProj;
uniform mat4 vxViewProjInv;
uniform mat4 vxViewProjPrev;
uniform mat4 vxModelView;
uniform mat4 vxModelViewInv;
uniform mat4 vxModelViewPrev;
uniform mat4 vxProj;
uniform mat4 vxProjInv;
uniform mat4 vxProjPrev;

Notes & Limitations

  • Fragment shader discarding and derivatives are currently not supported, and result in undefined behavior. This is because voxy discards helper threads and other non valid threads before your code is called.

  • All programs (including voxy.json) are preprocessed like in iris (this is unavoidable without very painful mixins), meaning that you can use #define, #ifdef, etc directly inside the voxy.json file. #include is supported as well.

  • Voxy JSON is parsed in LENIENT mode with gson, which means that it will try its best to parse the file; including ignoring entries that dont belong in the file. For example importing settings can be done like:

"unusedThing": "
  #include "/lib/settings.glsl"
"

Clone this wiki locally