all-is-cubes
all-is-cubes copied to clipboard
Block LoDs
Allow an EvaluatedBlock to provide a series of levels of detail (LoDs) — voxel data of lower resolution than the original/full resolution. This will serve several purposes:
Modifier::Inventorywants to draw inventory items without potentially greatly increasing the resolution, so LoDs for icons are needed.- In rendering, reducing aliasing and mesh complexity in distant portions of the scene and excessively complex chunks.
- Preview icons of large multiblock structures (this is a case where it will really have to be well-cached to be useful).
- In some cases of exceeding the block evaluation budget, a lower maximum LoD might enable evaluation to succeed in an acceptable fashion.
How it should work:
- Block evaluation requests (
EvalFilter) should specify the max LoD they are interested in, and whether they want smaller LoDs. EvaluatedBlockshould store a list of LoDs rather than just the single voxel array (note there are only at most 7 possible).- Evaluation will automatically generate requested LoDs by downsampling 2×2×2 groups to single voxels.
- Blocks may have a LoD hint attribute which specifies the downsampling filter. For example, in most cases the filter should not introduce partial transparency that was not already present, and therefore there is a choice to be made about whether to tie-break towards opaque voxels or invisible voxels.
- Perhaps there can be a modifier to add manually-defined LoDs. This means throwing out all consistency guarantees, though.
- We may find it necessary to introduce anisotropic voxels which have a different material per face. Note that
EvaluatedBlockessentially already has this for LoD resolution = 1, but the renderers do not use it because it doesn't fit into the current assumptions of isotropic voxels (see #421).
Related: Modifier::Zoom would greatly benefit from being able to ask for only a portion of the voxel data. That's a bit like LoDs in how it influences evaluation. But, see #442 before doing anything about that.