Skip to content

fix(render): honour ignore_lighting and one-sided entity materials - #67

Merged
notchyves merged 2 commits into
theselauraproject:mainfrom
NaySurGithub:fix/entity-ignore-lighting
Nov 6, 2026
Merged

notchyves merged 2 commits into
theselauraproject:mainfrom
NaySurGithub:fix/entity-ignore-lighting

Conversation

@NaySurGithub

@NaySurGithub NaySurGithub commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On The Hive hub, the hivehub:logo entity (the big "HIVE" title) renders as a solid black / dark box instead of the green letters. Once that is fixed, dark slivers still stick out past the letters on one side.

Before After
before after
before, at an angle after, at an angle

The "before, at an angle" shot already includes the first two fixes below: the slivers on the right are the third bug.

All shots come from Perlin's offline preview with the server's resource pack mounted (PERLIN_TEST_SERVER_PACKS, PERLIN_PREVIEW_ENTITIES=hivehub/logo).

How the pack builds the logo

  • entity/hive/hub/logo.json: material entity_alphatest_one_sided, texture textures/entity/hive/hub/logo (a 127×36 palette PNG);
  • render_controllers/hive/hub/logo.json: "ignore_lighting": true, "light_color_multiplier": 1.0;
  • models/entity/hive/hub/logo.json: the H / I / V / E letters, plus a border bone. That bone is a box of six zero-thickness planes around the letters, each with one face, all facing inward: south at z = -7, north at z = 17, up at y = -1, down at y = 38, west at x = -64, east at x = 65. Seen from outside, only the far walls show, as a dark frame behind the letters.

Causes and fixes

1. ignore_lighting was not read (black logo).

  • EntityAssets now parses ignore_lighting and light_color_multiplier.
  • Layers whose controller ignores lighting use full brightness (scaled by the multiplier) and block/sky light 15, as fullbright already did.

2. Entities were always drawn with face culling off (the front background plane covered the logo).

  • UiDraw::cull now follows the entity material: materials without DisableCulling cull back faces.
  • The world matrix mirrors model z (determinant −1/4096 for every world entity), so the culled side is swapped when the determinant is negative.

3. A lone east or west face was built on the wrong side (slivers past the letters).

  • Bedrock geometry is mirrored in x relative to the face names: Blockbench exports origin.x = -(from.x + size.x) and keeps the face names. In geometry space, east is therefore the −x side and west the +x side.
  • Geometry.cpp already undoes this for entity cubes by taking a side's UV from the opposite face (fi = 1 - i). But it checked face presence with the unswapped index c.faces[i].present. A cube listing only east (or only west) got its single quad on the opposite side, facing outward. Both side walls of the logo's box then faced the viewer as dark slivers.
  • The presence check now uses fi. Box-UV cubes are unaffected, since they always have all six faces.

Culling now applies to every entity with a one-sided material, not only pack entities. Vanilla mobs using entity (cow, pig, creeper, …) were checked up close:

vanilla mobs

Testing

  • macOS arm64 Release build, rebased on main (653959d).
  • Offline preview with the Hive pack, front and at an angle: green letters in a uniform dark frame, no slivers (shots above).
  • Offline preview of vanilla mobs with one-sided materials: faces correct, no inside-out models.
  • Not done yet: a live check on the Hive hub, and resource packs with unusual one-sided models.

Pack entities drawn by a render controller with ignore_lighting were lit by
the world light where they stand, so a logo anchored in an unlit spot came
out black. They now draw at full brightness, scaled by
light_color_multiplier.

Entities were also always drawn without face culling. Materials without
DisableCulling (entity, entity_alphatest_one_sided, ...) now cull back
faces, so inward-facing background planes no longer cover the model in
front of them. The world matrix mirrors model z, so the culled side is
swapped when the model matrix has a negative determinant.
Entity cubes take east/west UVs from the opposite face to undo Bedrock's
mirrored x, but the per-face presence check still used the unswapped index.
A cube listing only east (or only west) got its quad on the wrong side,
facing outward: the Hive logo's inward background walls showed as dark
slivers past the letters.
@NaySurGithub
NaySurGithub force-pushed the fix/entity-ignore-lighting branch from 2eea051 to e7549ab Compare November 6, 2026 21:56
@notchyves
notchyves merged commit 1ce9476 into theselauraproject:main Nov 6, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants