Skip to main content

Crate bevy_mod_outline

Crate bevy_mod_outline 

Source
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§

AsyncWorldInheritOutline
Automatically inherits outlines for the entities in a world instance.
AutoGenerateOutlineNormalsPlugin
Automatically runs generate_outline_normals on every mesh.
ComputedOutline
A component for storing the computed depth at which the outline lies.
GenerateOutlineNormalsSettings
Settings for generating mesh outline normals.
GlobalOutlineMode
A resource which controls the default OutlineMode used when an entity does not have an OutlineMode component and does not inherit one from a parent.
InheritOutline
A component for inheriting outlines from the parent entity.
OutlineAlphaMask
A component for specifying an alpha mask texture.
OutlinePlaneDepth
A component which controls the depth sorting of flat outlines and stencils.
OutlinePlugin
Adds support for rendering outlines.
OutlineRenderLayers
A component for specifying what layer(s) the outline should be rendered for.
OutlineStencil
A component for stenciling meshes during outline rendering.
OutlineVolume
A component for rendering outlines around meshes.
OutlineWarmUp
A component for warming up different specialisations of the outline pipeline.
PropagateOutline
A component for propagating InheritOutline to all descendants of this entity.
StopPropagateOutline
A component for halting propagation below this entity.

Enums§

GenerateOutlineNormalsError
Failed to generate outline normals for the mesh.
GenerateOutlineNormalsFrom
Source from which outline normals are derived.
OutlineFace
A component which controls which faces of an outline are rendered.
OutlineMode
A component which specifies how the outline should be rendered.
OutlineMsaa
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.
OutlineStencilEnabled
Specifies when a stencil should be rendered.
TextureChannel
The channel of a texture.

Constants§

ATTRIBUTE_OUTLINE_NORMAL
The direction to extrude the vertex when rendering the outline.

Traits§

OutlineMeshExt
Extension methods for Mesh.