public sealed class LodRenderFeaturePicks one level of detail per group per view, and hides the rest.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A LOD group is several render objects, not one object with several meshes. Each level is an ordinary renderable with its own mesh, material and sort key, and this feature does nothing but decide which of them a view gets to see. The alternative — one object that swaps its mesh — would have to pick one sort key for meshes that resolve to different pipelines, which is the same argument that makes a three-material mesh three render objects.
Selection happens after culling and before sorting, in preparation. It cannot happen earlier: an object outside the frustum has no screen size to measure, and asking for one would mean measuring every object in the scene rather than every visible one. It cannot happen later, because sorting is what builds the list a level would have to be absent from. Doc 06's frame structure puts LOD selection in exactly this gap.
Per view, because screen size is. The same tree is level 0 to the camera and level 3 to a distant reflection probe, so the decision is a bit cleared in one view's set rather than a field on the object — which is also what makes it free for the views that do not care: a shadow cascade leaves ScreenHeightScale at zero and every level stays visible for it, because a shadow drawn from a different mesh than its caster stops matching it.
Fields and properties (8)
public override string NameThe sub-feature's name, for logging and profiling.
public float CrossFadeDurationHow long a level change takes, in seconds. Zero swaps instantly.
public float DeltaTimeHow long the last frame took, in seconds. Set by the host before the frame.
public ShaderStage StagesWhich stages see the fade weight.
public int OffsetWhere the fade weight goes in the push-constant block.
public RenderDataKey<LodMembership> MembershipWhich group and level each object is.
public IReadOnlyList<LodGroup> GroupsThe groups registered so far.
public float HysteresisHow much a threshold must be crossed by before the level changes.
Methods (8)
protected internal override void Initialize(RenderSystem system)Registers this sub-feature's per-object data. Called once.
public int Add(ReadOnlySpan<float> thresholds)Registers a group and returns its index.
public void Assign(RenderSystem system, RenderObjectId id, int group, int level)Puts an object in a group as one of its levels.
public int LevelOf(int group, int viewIndex)Which level a group is showing in a view, or -1 if it has not been decided.
public int FadingFrom(int group, int viewIndex)Which level a group is fading out of in a view, or -1 when it is not fading.
public float FadeOf(int group, int viewIndex, int level)How visible one level of a group is in a view: 1 outside a transition, and the two levels of a transition summing to 1 during one.
public void Draw(RenderSystem system, RenderDrawContext context, in RenderNode node)protected internal override void Prepare(RenderSystem system)Fills this sub-feature's data for the visible objects.
Used by (2)
- HarnessVixen.Rendering.Tests
- LodTestsVixen.Rendering.Tests