Usage & Examples

Concepts

The basic idea behind Trilinear Mesh Interpolation is this: enclose your mesh in a box (typically referred to here as the Lattice). The default state of the box essentially matches the mesh's bounding box. When the corners of the box are moved, the mesh deforms to move with it, with vertices close to the moved corner moving about the same as the corner and vertices far from the moved corner not being affected at all. Vertices will always move to maintain their position within the lattice, relative to each corner.

Lattice values are treated as offsets. If the lattice corners all have the value (0,0,0), then the mesh will be untransformed and will appear in its original state.

Two Approaches to Interpolation

This plugin provides two approaches to trilinear interpolation. Visually, they will produce the same results, but which approach you should prefer to use may depend on your use case.

WPO-Based Material Shader

The trilinear interpolation can be performed entirely in a shader, allowing for the effect to be performed on the GPU.

This is very fast, and can be used on meshes with a high vertex count and can support a large number of meshes all deforming together in a scene at real-time. However, the effect is purely visual, the collision geometry of the mesh, etc., is unchanged.

If you need to animate the effect, particularly if you need a LOT of objects all bouncing and twisting around in a scene together, this is the recommended approach.

If you just need to apply the effect once, for example in-editor or during a procedural level generation step, or if you need collision geometry to match the deformed mesh, then you should use the DynamicMesh-based approach.

DynamicMesh

In this approach, the trilinear interpolation is performed on the CPU to modify a given mesh. The underlying C++ code has been optimized to parallelize this work where possible, so you can still use this to perform real-time deformation on detailed meshes or on a number of simple meshes in a scene, but performance will be limited by the total number of vertices you need to process in a given frame.

But, because we are processing the mesh data on the CPU we can also process a mesh's collision data, so you can use this to tweak the angle of a slope and then have your character walk on it.

This approach is best used sparingly or on meshes which only need to be deformed once (e.g. in-editor or as part of a procedural level generation step).

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Trilinear Interpolation Materials

Setup

The interpolation functionality is encapsulated in a single Material Function, which can be found under NB - Interpolation > Trilinear Interpolation

The Inputs are: A point or position you wish to transform (usually just the absolute world position), 8 Cube_XX values, which define the lattice offsets, and the original (untransformed, scaled, or otherwise modified) bounds of the mesh you wish to transform.

It will output a float3, which can be directly used to drive the World Position Offset in your material.

The Cube_XX values refer to the corners of the lattice used to deform the mesh, with the first four values (X0) defining the bottom four corners of the lattice and the last four (X1) defining the top four corners:

A complete example in which all interpolation values are driven by parameters (e.g. so you can manually adjust them in a blueprint):

Because we are using the Absolute World Position as the position to transform, we need to ensure that MinBound and MaxBound values are also in world coordinates. This can be done easily using Get Actor Bounds in the blueprint passing this information to the material:

This is usually the most straightforward approach, but if for some reason you are not working in world coordinates it is important to remember that the bounds and the point passed in for transformation must be in the same coordinate frame.

If you just intend to use the interpolation to make your object a little jiggly or bounce in response to some other material parameter, though, it's not necessary to expose these values as parameters, you can drive them entirely within your material.

For example, the following material will move only the top of the lattice over time, causing the mesh to stretch up and down vertically. Because the bottom of the lattice is not being changed, the base of the mesh will remain fixed in place, allowing for a bouncy animation without the mesh moving off of the ground. This allows you a lot of freedom to stretch and twist the mesh as you want, while still being able to constrain it to keep one side fixed in place.

Tips

Bounds Scale

If you use World Position Offset to create a large deformation in an object, this can lead to some very ugly shadow artifacts:

This can be fixed by increasing the bounds scale:

But, depending on how you are computing the original mesh bounds you may notice that this changes the effect of the Trilinear interpolation! (notice the bottom corners of the cube above are no longer correctly aligned with the ground)

If you are NOT passing the original (unscaled) object bounds as a material parameter but are relying on one of the Object Bounds or Object Local Bounds nodes, then you will need to compensate for the bounds scale in the material. If you know you will always use a constant bounds scale you can use a constant value in the material, or you can use a paramter to allow it to be set by an actor blueprint any time the bounds scale is changed or set to a fixed value in different material instances:

In this example, we are using a parameter which is expected to be the inverse of the bounds scale, so if the bounds scale is set to 2.0 this parameter should be set to 0.5. This avoids the possibility of dividing by zero by mistake, but it would also work to use the bounds scale directly and replace the multiply node with a divide.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Trilinear Interpolation With DynamicMesh

Most of the functionality for deforming DynamicMeshes is contained within the UTrilerpMeshComponent.

Details:

However, it's not strictly necessary to use this component, you can implement your own components or logic using trilinear interpolation:

Details:

Basic Usage

The easiest way to get up and running is to use the TrilerpMeshComponent. In the plugin's Examples directory, you will find a blueprint called BP_NBDynamicTrilerpMesh, just set the Source Mesh property to the mesh you want to deform.

You can then either manipulate the lattice points directly:

or use one of the provided functions for manipulating sets of lattice points:

TranslateFace, RotateFace, and ScaleFace will all call UpdateMesh automatically. If you are manually updating individual lattice points, you should call UpdateMesh yourself when you are finished to re-transform the mesh according to the new lattice points.

TrilerpMeshComponent Editor Tooling

If you select a TrilerpMeshCompnent in the editor, you will see a visualization of the current lattice state.

The green points represent the lattice points themselves, while the blue lines are just visual guides to help you see the shape of the lattice.

Selecting one of the green points allows you to drag it around and directly modify the lattice:

If you select one of the grey points, this will select all of the points which make up one side of the lattice. This allows you not only to drag those points together, but also allows you to use rotation and scaling tools on them:

Handling Collision Data

When initializing the TrilerpMeshComponent from a static mesh you have the option to copy both the visual mesh data as well as the collision data. This allows us to automatically keep the collision data up-to-date with the mesh deformation.

Simple Collision

If you enable Simple collision, then any time the mesh is updated we will automatically generate a new convex hull around the result.

If you find that this automatic convex hull doesn't fit your object well and do not wish to enable complex collision, then you can generate your own custom collision shapes using the Set Dynamic Mesh Collision from Mesh node in a blueprint, or UGeometryScriptLibrary_CollisionFunctions::SetDynamicMeshCollisionFromMesh (defined in GeometryScript/CollisionFunctions.h) in C++.

In this case, when initializing the TrilerpMeshComponent you should set Include Collision to NONE, otherwise every time you call UpdateMesh we will waste some CPU time processing unused collision geometry.

Complex Collision

If you enable Complex collision, then the collision mesh, itself, will be deformed in the same way as the visual mesh. This means that any changes you make to the mesh will be exactly reflected in the collision, although of course at added cost.

If this proves too expensive by default, an alternative approach would be to apply trilinear interpolation separately to two meshes, one detailed mesh for visuals with no collision enabled, and one simple mesh with complex collision enabled that is not set to render. This can even be done without using multiple TrilerpMeshComponents by transforming the extra mesh manually:

NOTE

In order for complex collision to work correctly, make sure that it is enabled on the component:

A Note on DynamicMeshActor

The DynamicMeshActor provides a lot of additional functionality which is useful for working with DynamicMeshes. This functionality isn't required to use the TrilerpMeshComponent, but if you are doing some of your own mesh modification/generation you may want to use them together.

Fortunately, it is possible to replace the DynamicMeshComponent on a DynamicMeshActor with a TrilerpMeshComponent. You can find the Component Class dropdown in the DynamicMeshActor details panel:

You then just need to cast to TrilerpMeshComponent in your actor blueprint:

The example blueprints are all configured this way.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Blueprint API Documentation

An overview and explanation of all included Blueprint nodes

Functions

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Class: TrilerpMeshComponent


A DynamicMeshComponent which supports trilinear interpolation of the underlying mesh.


Properties

  • Lattice

    Array of Vectors

    Offsets from interpolation lattice corners. Do not modify length.

    First four values represent the bottom four corners, second four the top four corners.

    Because this is a list of offsets, if all vectors are zero the trilinear interpolation will not modify the mesh, it will just return the original vertex positions.

  • Source Bounds

    BoxSphereBounds

    The original (untransformed) bounds of the source mesh this component was initialized with.


Functions






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Blueprint Functions

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Trilinear Interpolation (Mesh)

Trilinear Interpolation (Mesh) Node


Performs trilinear interpolation on a given Dynamic Mesh.

The mesh will be directly modified.

If the required inputs are invalid, the original mesh will be returned.


Inputs

  • TargetMesh

    Dynamic Mesh

    The mesh to transform.

  • Lattice

    Array of Vector

    List of offsets for the corners of the lattics cube. A value of 0 will result in no change. MUST contain 8 entries!

  • MinBound

    Vector

    The minimum corner of the bounding box for the (original, untransformed) mesh.

  • MaxBound

    Vector

    The maximum corner of the bounding box for the (original, untransformed) mesh.

  • Origin

    Vector

    Location that the bounds and mesh vertices are relative to.

Outputs






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Trilinear Interpolation (Point)

Trilinear Interpolation (Point) Node


Performs trilinear interpolation on an individual point/vertex location.

This is mostly only useful if you are extending the plugin's capabilities or using the interpolation for something very specific to your project.

If the required inputs are invalid, the original mesh will be returned.


Inputs

  • Point

    Vector

    The point to transform.

  • Lattice

    Array of Vector

    List of offsets for the corners of the lattics cube. A value of 0 will result in no change. MUST contain 8 entries!

  • MinBound

    Vector

    The minimum corner of the bounding box for whatever the point came from.

  • MaxBound

    Vector

    The maximum corner of the bounding box for whatever the point came from.

Outputs






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Trilinear Interpolation (Vertices)

Trilinear Interpolation (Vertices) Node


Performs trilinear interpolation on a given GeometryScriptVectorList.

The list will be directly modified, you may wish to create a copy beforehand.

If the required inputs are invalid, the original list will be returned unchanged.


Inputs

Outputs






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Enum: EIncludeCollisionType


Which type of collision mesh to use/generate when updating a deformed mesh.


Values

ValueDescription
None
Simple
Complex






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Enum: ELatticeFace

C++ ImplELatticeFace

Represents the faces of a deformation lattice.


Values

ValueDescription
Bottom-Z
Top+Z
South-Y
North+Y
West+X
East-X






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

C++ API Reference

Enums

Structs

Classes






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Enums






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Enum: EIncludeCollisionType

//  TrilerpMeshComponent.h : 29

enum class EIncludeCollisionType : uint8 {
    NONE    = 0 UMETA(DisplayName = "None"),
    SIMPLE  = 1 UMETA(DisplayName = "Simple"),
    COMPLEX = 2 UMETA(DisplayName = "Complex")
};

Reflection-enabled

Specifiers:

  • BlueprintType

Which type of collision mesh to use/generate when updating a deformed mesh.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Enum: ELatticeFace

//  TrilerpMeshComponent.h : 15

enum class ELatticeFace : uint8 {
    BOTTOM = 0 UMETA(DisplayName = "Bottom"),
    TOP    = 1 UMETA(DisplayName = "Top"),
    SOUTH  = 2 UMETA(DisplayName = "South"),
    NORTH  = 3 UMETA(DisplayName = "North"),
    WEST   = 4 UMETA(DisplayName = "West"),
    EAST   = 5 UMETA(DisplayName = "East"),
    NONE   = 6
};

Reflection-enabled

Specifiers:

  • BlueprintType

Represents the faces of a deformation lattice.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Structs






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Struct: HNBLatticeCornerProxy

//  NBTrilinearVisualizer.h : 30

struct HNBLatticeCornerProxy
    : public HComponentVisProxy;

Hit proxy for handling input on lattice corners


Properties


Constructors






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Struct: HNBLatticeFaceProxy

//  NBTrilinearVisualizer.h : 17

struct HNBLatticeFaceProxy
    : public HComponentVisProxy;

Hit proxy for handling input on lattice faces


Properties

  • FaceID

    public:
    ELatticeFace FaceID;
    


Constructors

  • HNBLatticeFaceProxy

    //  NBTrilinearVisualizer.h : 22
    
    public:
    HNBLatticeFaceProxy(
        const UActorComponent* InComponent,
        ELatticeFace FaceID
    );
    

    Arguments






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Classes






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: FNBTrilerpEditorModule

//  NBTrilerpEditorModule.h : 14

class FNBTrilerpEditorModule
    : public IModuleInterface;

Editor module for supporting improved visualization and editor tools related to Trilinear Mesh Interpoloation


Methods

  • ShutdownModule

    //  NBTrilerpEditorModule.h : 18
    
    public:
    virtual void ShutdownModule() override;
    
  • StartupModule

    //  NBTrilerpEditorModule.h : 17
    
    public:
    virtual void StartupModule() override;
    






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: FNBTrilinearInterpolationModule

//  NBTrilinearInterpolationModule.h : 10

class FNBTrilinearInterpolationModule
    : public IModuleInterface;

Runtime module for Trilinear Interpolation support


Methods

  • ShutdownModule

    //  NBTrilinearInterpolationModule.h : 15
    
    public:
    virtual void ShutdownModule() override;
    
  • StartupModule

    //  NBTrilinearInterpolationModule.h : 14
    
    public:
    virtual void StartupModule() override;
    






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: NBTrilinearVisualizer

//  NBTrilinearVisualizer.h : 47

class NBTrilinearVisualizer
    : public FComponentVisualizer;

Responsible for showing the lattice configuration and editing widgets on a UTrilinearInterpolatedMeshComponent when it's selected in-editor.

Allows the user to freely edit the lattice through regular translation/rotation/scale controls rather than needing to enter corner offsets manually.


Methods

  • DrawVisualization

    //  NBTrilinearVisualizer.h : 51
    
    public:
    virtual void DrawVisualization(
        const UActorComponent* Component,
        const FSceneView* View,
        FPrimitiveDrawInterface* PDI
    ) override;
    

    Arguments

    • Component

      const UActorComponent* Component
      
    • View

      const FSceneView* View
      
    • PDI

      FPrimitiveDrawInterface* PDI
      
  • EndEditing

    //  NBTrilinearVisualizer.h : 55
    
    public:
    virtual void EndEditing() override;
    
  • GetWidgetLocation

    //  NBTrilinearVisualizer.h : 53
    
    public:
    virtual bool GetWidgetLocation(
        const FEditorViewportClient* ViewportClient,
        FVector& OutLocation
    ) const override;
    

    Arguments


    Returns

    • bool
      
  • HandleInputDelta

    //  NBTrilinearVisualizer.h : 54
    
    public:
    virtual bool HandleInputDelta(
        FEditorViewportClient* ViewportClient,
        FViewport* Viewport,
        FVector& DeltaTranslate,
        FRotator& DeltaRotate,
        FVector& DeltaScale
    ) override;
    

    Arguments


    Returns

    • bool
      
  • VisProxyHandleClick

    //  NBTrilinearVisualizer.h : 52
    
    public:
    virtual bool VisProxyHandleClick(
        FEditorViewportClient* InViewportClient,
        HComponentVisProxy* VisProxy,
        const FViewportClick& Click
    ) override;
    

    Arguments


    Returns

    • bool
      






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: UNBTrilinearInterpolation

//  NBTrilinearInterpolation.h : 13

class UNBTrilinearInterpolation;

Contains the main implementation of Trilinear Interpolation.


Methods

  • TInterp

    //  NBTrilinearInterpolation.h : 48
    
    public:
    static FVector TInterp(
        FVector Point,
        TArray<FVector> Lattice,
        FVector MinBound,
        FVector MaxBound
    );
    

    Performs trilinear interpolation on a single point


    Arguments

    • Point

      FVector Point
      

      Point to transform

    • Lattice

      TArray<FVector> Lattice
      

      The corners of the lattice to use for deformation. Should have length 8.

    • MinBound

      FVector MinBound
      

      Minimum X,Y,Z of the target mesh's bounding box

    • MaxBound

      FVector MaxBound
      

      Maximum X,Y,Z of the target mesh's bounding box


    Returns

    • FVector
      

      Transformed point

  • TrilinearInterpolation

    //  NBTrilinearInterpolation.h : 26
    
    public:
    static UDynamicMesh* TrilinearInterpolation(
        UDynamicMesh* TargetMesh,
        TArray<FVector> Lattice,
        FVector MinBound,
        FVector MaxBound,
        FVector origin
    );
    

    Performs trilinear interpolation on the given DynamicMesh. The mesh should be in its original, undeformed state.


    Arguments

    • TargetMesh

      UDynamicMesh* TargetMesh
      

      Mesh to deform

    • Lattice

      TArray<FVector> Lattice
      

      The corners of the lattice to use for deformation. Should have length 8.

    • MinBound

      FVector MinBound
      

      Minimum X,Y,Z of the target mesh's bounding box

    • MaxBound

      FVector MaxBound
      

      Maximum X,Y,Z of the target mesh's bounding box

    • origin

      FVector origin
      

      Origin the mesh's vertices are relative to


    Returns

    • UDynamicMesh*
      

      The transformed mesh

  • TrilinearInterpolation

    //  NBTrilinearInterpolation.h : 38
    
    public:
    static FGeometryScriptVectorList TrilinearInterpolation(
        FGeometryScriptVectorList Vertices,
        TArray<FVector> Lattice,
        FVector MinBound,
        FVector MaxBound,
        FVector origin
    );
    

    Performs trilinear interpolation on a set of vertices. The vertices should be in their original, undeformed state.


    Arguments

    • Vertices

      FGeometryScriptVectorList Vertices
      

      Vertices to transform

    • Lattice

      TArray<FVector> Lattice
      

      The corners of the lattice to use for deformation. Should have length 8.

    • MinBound

      FVector MinBound
      

      Minimum X,Y,Z of the target mesh's bounding box

    • MaxBound

      FVector MaxBound
      

      Maximum X,Y,Z of the target mesh's bounding box

    • origin

      FVector origin
      

      Origin the mesh's vertices are relative to


    Returns

    • FGeometryScriptVectorList
      

      The transformed vertices






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: UNBTrilinearInterpolationBPLibrary

//  NBTrilinearInterpolationBPLibrary.h : 16

class UNBTrilinearInterpolationBPLibrary
    : public UBlueprintFunctionLibrary;

Reflection-enabled


Provides blueprint support for Trilinear Interpolation methods.


Methods

  • TInterp

    //  NBTrilinearInterpolationBPLibrary.h : 61
    
    public:
    static FVector TInterp(
        FVector Point,
        TArray<FVector> Lattice,
        FVector MinBound,
        FVector MaxBound
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBMeshTools

    Meta Specifiers:

    • DisplayName = Trilinear Interpolation (point)
    • Keywords = Trilinear Interpolation

    Performs trilinear interpolation on a single point.

    This may be useful if instead of transforming a mesh you are transforming something like a color.


    Arguments

    • Point

      FVector Point
      
    • Lattice

      TArray<FVector> Lattice
      

      List of offsets for the corners of the lattice cube. A value of 0 will result in no change. MUST contain 8 entries!

    • MinBound

      FVector MinBound
      

      The minimum corner of the bounding box for the provided vertices (i.e. the mesh bounds the vertices came from)

    • MaxBound

      FVector MaxBound
      

      The maximum corner of the bounding box for the provided vertices (i.e. the mesh bounds the vertices came from)


    Returns

    • FVector
      

      The transformed point

  • TrilinearInterpolation

    //  NBTrilinearInterpolationBPLibrary.h : 34
    
    public:
    static FGeometryScriptVectorList TrilinearInterpolation(
        FGeometryScriptVectorList Vertices,
        TArray<FVector> Lattice,
        FVector MinBound,
        FVector MaxBound,
        FVector Origin
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBMeshTools

    Meta Specifiers:

    • DisplayName = Trilinear Interpolation (vertices)
    • Keywords = Trilinear Interpolation

    Performs trilinear interpolation on the provided list of vertices.

    If the required inputs are invalid, the original list of vertices will be returned unmodified.


    Arguments

    • Vertices

      FGeometryScriptVectorList Vertices
      

      List of vertices to transform.

    • Lattice

      TArray<FVector> Lattice
      

      List of offsets for the corners of the lattice cube. A value of 0 will result in no change. MUST contain 8 entries!

    • MinBound

      FVector MinBound
      

      The minimum corner of the bounding box for the provided vertices (i.e. the mesh bounds the vertices came from)

    • MaxBound

      FVector MaxBound
      

      The maximum corner of the bounding box for the provided vertices (i.e. the mesh bounds the vertices came from)

    • Origin

      FVector Origin
      

      The origin of the mesh the vertices are from. Many meshes may have an origin which is not the same as their pivot.


    Returns

    • FGeometryScriptVectorList
      

      Transformed vertices. If the inputs are invalid (e.g., Latice is empty) then the original given vertices will be returned unmodified.

  • TrilinearInterpolation2

    //  NBTrilinearInterpolationBPLibrary.h : 48
    
    public:
    static UDynamicMesh* TrilinearInterpolation2(
        UDynamicMesh* TargetMesh,
        TArray<FVector> Lattice,
        FVector MinBound,
        FVector MaxBound,
        FVector origin
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBMeshTools

    Meta Specifiers:

    • DisplayName = Trilinear Interpolation (mesh)
    • Keywords = Trilinear Interpolation

    Performs trilinear interpolation on the provided dynamic mesh.

    If the required inputs are invalid, the original mesh will be returned unmodified.


    Arguments

    • TargetMesh

      UDynamicMesh* TargetMesh
      

      Mesh to transform.

    • Lattice

      TArray<FVector> Lattice
      

      List of offsets for the corners of the lattice cube. A value of 0 will result in no change. MUST contain 8 entries!

    • MinBound

      FVector MinBound
      

      The minimum corner of the bounding box for the provided vertices (i.e. the mesh bounds the vertices came from)

    • MaxBound

      FVector MaxBound
      

      The maximum corner of the bounding box for the provided vertices (i.e. the mesh bounds the vertices came from)

    • origin

      FVector origin
      

    Returns

    • UDynamicMesh*
      

      The transformed mesh. If the inputs are invalid (e.g., Lattice is empty) then the original mesh will be returned unmodified.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: UTrilerpMeshComponent

//  TrilerpMeshComponent.h : 41

class NBTRILINEARINTERPOLATION_API UTrilerpMeshComponent
    : public UDynamicMeshComponent;

Reflection-enabled

Specifiers:

  • ClassGroup = Rendering

Meta Specifiers:

  • BlueprintSpawnableComponent

A DynamicMeshComponent which supports trilinear interpolation of the underlying mesh.


Properties

  • Lattice

    public:
    TArray<FVector> Lattice;
    

    Reflection-enabled

    Specifiers:

    • BlueprintReadWrite
    • EditAnywhere
    • EditFixedSize
    • Category = NBTrilinearInterpolation

    Offsets from interpolation lattice corners. Do not modify length.

    First four values represent the bottom four corners, second four the top four corners.

    Because this is a list of offsets, if all vectors are zero the trilinear interpolation will not modify the mesh, it will just return the original vertex positions.

  • SourceBounds

    public:
    FBoxSphereBounds SourceBounds;
    

    Reflection-enabled

    Specifiers:

    • BlueprintReadOnly
    • Category = NBTrilinearInterpolation

    The bounds of the source mesh this component was initialized with.

Constructors


Methods

  • Centroid

    //  TrilerpMeshComponent.h : 166
    
    protected:
    FVector Centroid(
        FVector a,
        FVector b,
        FVector c,
        FVector d
    ) const;
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Computes the centroid of four points.

    All four points are assumed to be in the same coordinate frame.


    Arguments

    • a

      FVector a
      
    • b

      FVector b
      
    • c

      FVector c
      
    • d

      FVector d
      

    Returns

    • FVector
      
  • DebugDrawLattice

    //  TrilerpMeshComponent.h : 157
    
    public:
    void DebugDrawLattice(
        float Lifetime
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Visualizes the current lattice configuration.


    Arguments

  • GetCentroid

    //  TrilerpMeshComponent.h : 112
    
    public:
    FVector GetCentroid(
        const ELatticeFace Face
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Computes the centroid (in world-space) of the specified lattice face.


    Arguments

    • Face

      const ELatticeFace Face
      

    Returns

    • FVector
      
  • GetCornersWS

    //  TrilerpMeshComponent.h : 99
    
    public:
    TArray<FVector> GetCornersWS() const;
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Gets the world-space positions of the Lattice corners (including offsets)


    Returns

    • TArray<FVector>
      
  • GetSourceCornersWS

    //  TrilerpMeshComponent.h : 106
    
    public:
    TArray<FVector> GetSourceCornersWS() const;
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Gets the world-space positions of the untransformed Lattice corners. i.e. the original/base position based on the input mesh bounds.


    Returns

    • TArray<FVector>
      
  • InitFromDynamicMesh

    //  TrilerpMeshComponent.h : 78
    
    public:
    bool InitFromDynamicMesh(
        UDynamicMesh* Mesh
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Initializes the dynamic mesh from another given dynamic mesh.


    Arguments

    • Mesh

      UDynamicMesh* Mesh
      

      Mesh to copy


    Returns

    • bool
      

      True if copying the mesh data was successful, otherwise false

  • InitFromSkeletalMesh

    //  TrilerpMeshComponent.h : 70
    
    public:
    bool InitFromSkeletalMesh(
        USkeletalMesh* Mesh
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Initializes the dynamic mesh from a given skeletal mesh.


    Arguments

    • Mesh

      USkeletalMesh* Mesh
      

      Mesh to copy


    Returns

    • bool
      

      True if copying the mesh data was successful, otherwise false

  • InitFromStaticMesh

    //  TrilerpMeshComponent.h : 62
    
    public:
    bool InitFromStaticMesh(
        UStaticMesh* Mesh,
        EIncludeCollisionType IncludeCollision = EIncludeCollisionType::NONE
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Initializes the dynamic mesh from a given static mesh.


    Arguments

    • Mesh

      UStaticMesh* Mesh
      

      Mesh to copy

    • IncludeCollision

      EIncludeCollisionType IncludeCollision = EIncludeCollisionType::NONE
      

      Whether to copy and process the mesh's collision data as well


    Returns

    • bool
      

      True if copying the mesh data was successful, otherwise false

  • OnRegister

    //  TrilerpMeshComponent.h : 49
    
    public:
    virtual void OnRegister() override;
    
  • PostEditChangeChainProperty

    //  TrilerpMeshComponent.h : 52
    
    public:
    virtual void PostEditChangeChainProperty(
        FPropertyChangedChainEvent& PropertyChangedEvent
    ) override;
    

    Arguments

  • PostEditUndo

    //  TrilerpMeshComponent.h : 53
    
    public:
    virtual void PostEditUndo() override;
    
  • RotateFace

    //  TrilerpMeshComponent.h : 150
    
    public:
    void RotateFace(
        const ELatticeFace Face,
        const FRotator& Rotation
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Applies a rotation to one whole side of the lattice, relative to its current orientatoin, around the centroid of the face vertices.

    Calls UpdateMesh.


    Arguments

    • Face

      const ELatticeFace Face
      
    • Rotation

      const FRotator& Rotation
      
  • ScaleFace

    //  TrilerpMeshComponent.h : 141
    
    public:
    void ScaleFace(
        const ELatticeFace Face,
        const FVector& Scale
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Scales a face by moving its corners relative to their centroid.

    Calls UpdateMesh.


    Arguments

    • Face

      const ELatticeFace Face
      
    • Scale

      const FVector& Scale
      
  • SetFaceTranslation

    //  TrilerpMeshComponent.h : 133
    
    public:
    void SetFaceTranslation(
        const ELatticeFace Face,
        const FVector& Translation
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Sets the translation (absolute movement) of one whole side of the lattice, relative to the base position of the vertices on that face.

    Given translation is expected to be in world space.

    Calls UpdateMesh.


    Arguments

  • SetLatticeWS

    //  TrilerpMeshComponent.h : 93
    
    public:
    void SetLatticeWS(
        TArray<FVector> WSLattice
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Sets the lattice corners to the given world-space coordinates.


    Arguments

    • WSLattice

      TArray<FVector> WSLattice
      

      New lattice points, in world-space. Should have length 8.

  • TranslateFace

    //  TrilerpMeshComponent.h : 122
    
    public:
    void TranslateFace(
        const ELatticeFace Face,
        const FVector& DeltaTranslation
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Applies a translation (relative movement) to one whole side of the lattice.

    Given translation is expected to be in world space.

    Calls UpdateMesh.


    Arguments

  • UpdateMesh

    //  TrilerpMeshComponent.h : 86
    
    public:
    void UpdateMesh();
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBTrilinearInterpolation

    Updates the underlying mesh data to match the current Lattice configuration.

    Should be called whenever Lattice has been modified to keep the mesh up-to-date.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com