Shadow Occlusion Culling
Colorwheel 1.3 implements a new backend: the indirect backend. Compared to the instancing backend, the new one is able to cull geometry on the GPU. This can increase FPS by +30% in large Create factories.
The indirect backend supports frustum and occlusion culling for both gbuffers and shadow passes.
By default, Colorwheel respects Iris’ frustum.culling, occlusion.culling and shadow.culling. If required, those properties can be redefined in colorwheel.properties to apply different rules on Colorwheel rendering.
However, it’s very common for shaderpacks to distort the shadowmap. Because of that, shadow occlusion culling requires that the shaderpack provide its shadow distortion function.
To do so, we need to add a new program: clrwl_shadow_distort.csh.
This program will be included into an internal Colorwheel, so it should not contain a main() function. You also cannot access any textures or SSBOs.
This program should contain two functions: clrwl_distortShadowClipXY and clrwl_distortShadowClipZ.
#include "/lib/distort.glsl"
vec2 clrwl_distortShadowClipXY(vec2 vertexClipXY) { return distortShadowClipPos(vec3(vertexClipXY, 0.0)).xy;}
float clrwl_distortShadowClipZ(float vertexClipZ) { return distortShadowClipPos(vec3(0.0, 0.0, vertexClipZ)).z;}To activate the culling, shadow.occlusion.culling must be enabled in the colorwheel.properties file.
oit = true
oit.gbuffers.coefficientRanks = 3
oit.gbuffers.colortex0 = 0
oit.gbuffers.colortex1 = frontmostoit.gbuffers.colortex1.format = RGBA8
oit.gbuffers.colortex2 = frontmostoit.gbuffers.colortex2.format = RGBA8
oit.shadow.shadowcolor0 = frontmostoit.shadow.shadowcolor0.format = RGBA8
shadow.occlusion.culling = trueYou can test if the culling works correctly using the /colorwheel debug cull shadow_debug on command.
Here’s a list of command you can use to setup a test environment:
/time set day/fill ~ ~ ~1 ~ ~17 ~19 minecraft:stone/fill ~-1 ~ ~2 ~-17 ~16 ~18 create:cogwheel/flywheel backend colorwheel:indirect/colorwheel debug cull shadow_debug on
Without occlusion culling

With occlusion culling