Expand description
This crate provides a Bevy plugin, OutlinePlugin, and associated
components for rendering outlines around meshes using the vertex extrusion
and jump flood methods.
Outlines are rendered in a seperate pass following the main 3D pass and using a separate depth buffer. This ensures that outlines are not clipped by non-outline geometry.
An outline consists of two parts, a volume and a stencil. The volume
will, by itself, cover the original object entirely with the outline
colour. The stencil prevents the body of an object from being filled in.
Stencils also allows other entities to occlude outlines, otherwise the
outline will be drawn on top of them. These parts are controlled by the
OutlineVolume and OutlineStencil components respectively.
The OutlineMode component specifies the rendering method. Outlines may
be flattened into a plane in order to further avoid clipping, or left in
real space. The depth of flat outlines can be controlled using the
OutlinePlaneDepth component.
Outlines can be inherited from the parent via the InheritOutline
component. To inherit an outline across an entire subtree without marking
each entity individually, add PropagateOutline to the root of the
subtree. StopPropagateOutline halts propagation below a given entity.
There are two methods available for rendering outlines: vertex extrusion
and jump flood. The default method is selected by adding either
OutlinePlugin::EXTRUDE_VERTEX or OutlinePlugin::JUMP_FLOOD, and
can be overridden for individual entities via the OutlineMode
component.
Vertex extrusion is generally more performant, but is sensitive to the
fidelity of meshes and requires smooth outline normals to avoid visual
artefacts. See the OutlineMeshExt::generate_outline_normals function
and the AutoGenerateOutlineNormalsPlugin for help generating these.
Jump flood, as a screen-space technique, is more robust especially with
thicker outlines. However, it requires log2(n) shader passes over the
outline’s bounding box where n is the thickness in screen pixels.
Structs§
- Async
World Inherit Outline - Automatically inherits outlines for the entities in a world instance.
- Auto
Generate Outline Normals Plugin - Automatically runs
generate_outline_normalson every mesh. - Computed
Outline - A component for storing the computed depth at which the outline lies.
- Generate
Outline Normals Settings - Settings for generating mesh outline normals.
- Global
Outline Mode - A resource which controls the default
OutlineModeused when an entity does not have anOutlineModecomponent and does not inherit one from a parent. - Inherit
Outline - A component for inheriting outlines from the parent entity.
- Outline
Alpha Mask - A component for specifying an alpha mask texture.
- Outline
Plane Depth - A component which controls the depth sorting of flat outlines and stencils.
- Outline
Plugin - Adds support for rendering outlines.
- Outline
Render Layers - A component for specifying what layer(s) the outline should be rendered for.
- Outline
Stencil - A component for stenciling meshes during outline rendering.
- Outline
Volume - A component for rendering outlines around meshes.
- Outline
Warm Up - A component for warming up different specialisations of the outline pipeline.
- Propagate
Outline - A component for propagating
InheritOutlineto all descendants of this entity. - Stop
Propagate Outline - A component for halting propagation below this entity.
Enums§
- Generate
Outline Normals Error - Failed to generate outline normals for the mesh.
- Generate
Outline Normals From - Source from which outline normals are derived.
- Outline
Face - A component which controls which faces of an outline are rendered.
- Outline
Mode - A component which specifies how the outline should be rendered.
- Outline
Msaa - A view-level component which controls the MSAA setting used when rendering outlines, independently of the MSAA setting used for the rest of the scene.
- Outline
Stencil Enabled - Specifies when a stencil should be rendered.
- Texture
Channel - The channel of a texture.
Constants§
- ATTRIBUTE_
OUTLINE_ NORMAL - The direction to extrude the vertex when rendering the outline.
Traits§
- Outline
Mesh Ext - Extension methods for
Mesh.