Download Game! Currently 82 players and visitors. Last logged in:SolvikGlaurungDescadGileon

Blitzer's Blog >> 72152

Back to blogs index
Posted: 06 Sep 2026 13:56 [ permalink ]
Path A is definitely the right choice. Without face culling, rendering a solid
8x8x8 chunk would generate 18,432 vertices, the vast majority of which are
completely hidden inside the cube. By culling hidden faces, we will reduce the
GPU payload by over 90% for solid volumes.
To do this, the worker needs to check the 6 adjacent neighbors (Top, Bottom,
Left, Right, Front, Back) for every solid voxel. If a neighbor is solid, we
skip drawing the face between them.
Here is the exact delegation prompt for your code-generation session.
Phase 4: Delegation Package (Face Culling)
Copy and paste the following into your code-generation session:
> System Context: We are building a WebGL port of a voxel engine. I have a Web
Worker (mesh_worker.ts) that currently generates 36 raw vertices for every
solid block in a flat array, without checking neighbors.
> Task: Optimize the generateCubeMesh function in the worker by implementing
basic Face Culling.
> Technical Requirements:
>  * Neighbor Checking: For every solid voxel (chunkData[idx] === 1), check
its 6 adjacent neighbors in the 1D flat array (x-1, x+1, y-1, y+1, z-1, z+1).
>  * Boundary Conditions: If a neighbor is outside the chunk boundaries (e.g.,
x < 0 or x >= chunkSize), treat it as empty (air) so the outer boundary faces
are drawn.
>  * Conditional Generation: Only push the vertices for a specific face (Left,
Right, Bottom, Top, Back, Front) if the neighbor in that direction is not
solid.
>  * Output Requirement: Provide the updated generateCubeMesh function for
mesh_worker.ts that includes this neighbor-checking logic and face mapping.
> 
Expected Deliverables
Once the session provides the updated generateCubeMesh function, replace the
old function in /mnt/mesh_shared/3d/3D-TS/mesh_worker.ts with the new one.
To verify it works, you can click your UI button 3 times to spawn a 1x3 column
of blocks. If face culling is successful, the worker will generate fewer than
108 vertices (3 blocks * 36 vertices), because the faces touching each other
inside the column will be skipped.
Let me know when you've pasted the code in, and tell me how many vertices the
worker logs for 3 blocks!