Log inGet started
Package

EcsMeshLevels.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

ecs.MeshLevels

Spec for the MeshLevels component, which maps to the native MeshLevels. Cheaper meshes that stand in for the entity's ecs.Mesh once its subject covers less of a view's height, chosen by every view for itself: the viewport, a camera rendering into a texture and a capture camera each draw the level their own camera's distance and lens call for, from the first frame that camera stands somewhere new.

Fields

  • lod1, lod2, lod3: the cheaper meshes, as mesh handles (meshRef:handle()). An empty level ends the chain.
  • screen1, screen2, screen3: the span of a view's height below which each level takes over from the one before it. The span is the full-detail mesh's radius (half its bounds' diagonal, scaled by the entity's largest scale axis) over the half-height the view sees at the subject's distance: 1.0 is a subject filling the view's height.

Every level draws with the entity's transform, material, render layers and render flags. Shadows, rays and picks meet the full-detail level. rendering.getCullStats() counts the levels each view leaves out under instancesCulled.detail.

Usage

local far = asset.resolve("@builtin::meshes.sphere", "mesh"):handle()
ecs.insertSync(id, ecs.MeshLevels{ lod1 = far, screen1 = 0.25 })
ecs.set(id, ecs.MeshLevels{ screen1 = 0.1 })