BlueRose
文章92
标签23
分类7
MultiDraw Document

MultiDraw Document

Introduction

This plugin uses UnrealEngine’s MeshDraw framework to achieve a multi-Pass effect looks like Unity’s, with no post-processing required to achieve strokes and cutoff.

MultiDraw ExampleProject
Usage:Download this project,and put MultiDraw plugin into plugins folder.
Notice:This project only UE5.0 and higher can run.

中文文档

Update Log

2022.12.19

  1. Update UE5.1 version.
  2. Support UE5.1 OverlayMaterial.
  3. Outline and MultiDraw now support Translucent material.

2022.10.30

  1. Add real-time material change function.

QuickStart

Outline Example:

  1. Create a new Actor Blueprint class and attach a OutlineComponent.
  2. Config OutlineComponent’s Mesh and Material.
  3. Create Outline Material and push in OutlinePassMaterialSet.
  4. Put actor in current scene.

MultiPass Example:

  1. Create a new Actor Blueprint class and attach a MultiDrawComponent.
  2. Config MultiDrawComponent’s Mesh and Material.
  3. Put the materials and parameters to be drawn into the PerPassDrawSettingses as required.
  4. Set the material’s PixelOffset as required to allow the material to be rendered in the desired order.
  5. Put actor in current scene.

Cutoff Example:

  1. Enter Simulation mode.
  2. Rotate Plant mesh.

Reference

OutlineComponent

Component name is OutlineSkeletalMeshComponent and OutlineStaticMeshComponent.Outline materials are in one-to-one mode,This means that the Material Element Slot Index in the Mesh is the same as in the OutlinePassMaterialSet.If you don’t want to draw, you just need to set the corresponding material in the OutlinePassMaterialSet to empty.

Option:

  • CullingMode:all Outline materials’s CullingMode.Have FrontCulling,BackCulling,Double Side three options.
  • bCastShadow:all Outline materials’s CastShadow.It’s mean whether shadows can be cast on other mesh.
  • OutlinePassMaterialSet:Specify the array of Outline materials.

MultiDrawComponent

Component name is MultiDrawSkeletalMeshComponent and MultiDrawStaticMeshComponent.Materials are in one-to-many mode,The specified materials will be rendered per material slot.But because of depth culling,it is necessary to use depth offsets to control rendering order.

Option:

  • CullingMode:Materials’s CullingMode.Have FrontCulling,BackCulling,Double Side three options.
  • bCastShadow:Materials’s CastShadow.It’s mean whether shadows can be cast on other mesh.
  • bDraw:Control whether need rendering.
  • MaterialInterface:Specify the material to be used for rendering.

Character Class

For your convenience, this plugin implements the ThirdPersonChracter class that replaces the Mesh component: AOutlineCharacter and MultiDrawCharacter.

The code is as follows:

class AOutlineCharacter : public ACharacter
{
    GENERATED_BODY()
public:
    AOutlineCharacter(const FObjectInitializer& ObjectInitializer);
};

AOutlineCharacter::AOutlineCharacter(const FObjectInitializer& ObjectInitializer)
    : Super(ObjectInitializer.SetDefaultSubobjectClass<UOutlineSkeletalMeshComponent>(ACharacter::MeshComponentName))
{}

Outline Material Instructions

This plug-in provides two outline materials.

  • ExampleContent\Materials\Outline\M_FixedOffsetOutline:Outline material with fixed WorldPositionOffset,for demonstration purposes only.
  • ExampleContent\Materials\Outline\M_ViewFixOffsetOutline:Adjusts the material of the Outline width according to the camera distance. At closer distances, however, the outline becomes very thin.
  • ExampleContent\Materials\Outline\M_PerfectionViewFixOffsetOutline:Fix the material in question above.

The component does not restrict the material type, so you can also use other ShaderModel’s materials to create the effect you want.

Runtime Material Change

Get component and call function.For SkeletalMesh make sure that Use for SkeletalMesh and Use for cloth are checked for the material.

Other Platform Effect

Only test in Editor.