Skip to Content
RecipesEnchant effects

Enchant effects

Target API: 5 · Target build: bbb6l5 (verified in production and preprod 2026-11-20) · Status: Analyzed (restored from the live header)

v5 opened the enchant pipeline on both inputs and outputs. Recipes for controlling the glint of enchanted items and armour while preserving the engine’s math.

Inputs & outputs

Inputs (BloxdSurfaceIn / BloxdLightIn — enchanted items and armour only, all 0 otherwise):

enchantTier: u32, // 1-5 for Tier 1-5. enchantColour: vec4f, // RGB enchant colour, and its animated alpha. enchantSpeed: f32, // How fast the pattern moves, faster at higher tiers.

Output (BloxdSurface):

enchantColour: vec4f, // Enchant output, mixed in by bloxdLitColour.

The engine mixes it inside bloxdLitColour() — right after shading, before world light. bloxdDefaultSurface passes the input through unchanged, so the default look matches v4’s engine-internal behavior.

Understanding the defaults

Input enchantColour.a is an animated alpha — the engine animates the glint sweep, so reading .a per fragment yields a moving pattern for free. enchantTier and enchantSpeed are consistent by construction («faster at higher tiers»).

Unenchanted faces carry enchantTier == 0, enchantColour == vec4f(0.0), enchantSpeed == 0.0.

Recipe 1: no-glint realism (two lines)

fn bloxdModelSurface(surface: BloxdSurfaceIn) -> BloxdSurface { var out = bloxdDefaultSurface(surface); out.enchantColour = vec4f(0.0); return out; }

Recipe 2: stronger glint by tier

enchantTier gives the classic “tier-scaled glint” without parsing colors:

fn bloxdModelSurface(surface: BloxdSurfaceIn) -> BloxdSurface { var out = bloxdDefaultSurface(surface); if (surface.enchantTier > 0u) { let tierBoost = 1.0 + f32(surface.enchantTier) * 0.12; out.enchantColour.a = clamp(surface.enchantColour.a * tierBoost, 0.0, 1.0); out.enchantColour.rgb = surface.enchantColour.rgb; } return out; }

Recipe 3: recoloring the glint

fn bloxdModelSurface(surface: BloxdSurfaceIn) -> BloxdSurface { var out = bloxdDefaultSurface(surface); if (surface.enchantTier > 0u) { var e = surface.enchantColour; e.rgb = mix(vec3f(0.35, 0.8, 1.0), vec3f(0.9, 0.5, 1.0), f32(surface.enchantTier) / 5.0); // low tiers blue, high purple out.enchantColour = e; } return out; }

Recipe 4: enchantSpeed-driven sweep

Turn enchantSpeed into a phase for a custom sweep:

fn bloxdModelSurface(surface: BloxdSurfaceIn) -> BloxdSurface { var out = bloxdDefaultSurface(surface); if (surface.enchantTier > 0u) { let band = 0.5 + 0.5 * sin(surface.localPosition.y * 6.0 - bloxdSeconds() * surface.enchantSpeed * 2.0); var e = surface.enchantColour; e.a = clamp(e.a * (0.4 + 0.6 * band), 0.0, 1.0); out.enchantColour = e; } return out; }

Recipe 5: amplifying the hurt flash (overlayColour)

overlayColour (players/mobs only; hurt flash etc.) mixes before lighting in bloxdLitColour:

fn bloxdModelSurface(surface: BloxdSurfaceIn) -> BloxdSurface { var out = bloxdDefaultSurface(surface); out.overlayColour.a = clamp(surface.overlayColour.a * 1.6, 0.0, 1.0); return out; }

Harmless on non-entities (overlayColour is 0 there).

Combining with custom lighting

Using bloxdLitColour() keeps the enchant/overlay mixing automatic:

fn bloxdModelLight(surface: BloxdSurface, light: BloxdLightIn) -> BloxdLight { if (!bloxdLit()) { return bloxdDefaultLight(surface, light); } let lit = bloxdLitColour(surface, light); return BloxdLight(bloxdApplyFog(lit + surface.emission, light)); }

Notes

  • Enchant inputs arrive only on enchanted items and armour — all 0 on terrain, water and unenchanted faces
  • Changing the enchantColour output never touches colour directly — mixing happens in bloxdLitColour / bloxdDefaultLight
  • Outside the model pipeline the enchant inputs are always 0