Free Download Meshes For Unreal Engine 4 UPDATED

Free Download Meshes For Unreal Engine 4

Mesh painting is the ability for players to paint on objects in-game. Examples of mesh painting are the goop in Super Mario Sunshine, the gels in Portal 2 and the ink in Splatoon. It can be used as a gameplay element or information technology can be purely for visuals. Either manner, mesh painting opens up a lot of possibilities for gameplay designers and artists.

Although the previous examples are all pretty much the same effect, you can use mesh painting for many other effects too. For example, you can use it to spray pigment objects, render wounds on characters or even allow players draw their ain grapheme's confront!

In this tutorial, you will learn how to paint onto a skeletal mesh. To practise this you lot will:

  • Unwrap a mesh into its UV form
  • Apply the striking location from a line trace to sphere mask the mesh
  • Render the unwrapped mesh and sphere mask to a render target using a scene capture
  • Use the mask to blend between textures in the character fabric

Note that this is not a tutorial on vertex painting. Vertex painting is dependent on mesh resolution and can not be inverse in-game. On the other hand, the method in this tutorial works independently from mesh resolution and too works in-game.

Notation: This tutorial assumes y'all already know the basics of using Unreal Engine. If you are new to Unreal Engine, bank check out our x-part Unreal Engine for Beginners tutorial serial.

Getting Started

Start by downloading the materials for this tutorial (you can find a link at the elevation or lesser of this tutorial). Unzip it and navigate to MeshPainterStarter and open up MeshPainter.uproject. If you printing Play, you volition see the graphic symbol that you lot will be painting on.

unreal engine mesh paint

Just like the snow and grass trails tutorials, this method also requires a scene capture. To save fourth dimension, I have already created a scene capture Blueprint for you. If you'd like to learn more than nearly the capture settings, check out our tutorial on creating snowfall trails.

First, let's look at how you can paint on a mesh.

Mesh Painting

In most cases, the mesh you're working with is already UV mapped. And then the obvious matter to do would exist to create a mask using a render target and and so apply it to the mesh. Withal, generating a mask directly on the render target (using Draw Material to Render Target) will unremarkably result in discontinuities across UV shells.

Here'south an example of a cube'southward UV map and a sphere mask texture:

unreal engine mesh paint

And here is the mask practical to the cube:

unreal engine mesh paint

As you lot can see, a 2nd sphere mask does not wrap around corners since it doesn't take the geometry into business relationship. To generate a correct mask, the sphere mask needs to sample the globe positions of the mesh instead. Merely how do y'all access world positions when using the Depict Material to Return Target node?

If y'all've been looking at methods on mesh painting, you lot may take come across Ryan Bruck's video on grapheme impairment using render targets (the method in this tutorial is based on his method). In the video, he successfully generates 3D sphere masks and accumulates them into a return target. He is able to practise this considering he creates a return target to store the mesh's globe positions which he can and so sample using a sphere mask. Permit's have a closer look.

Ryan'south Method

There are four steps to this method. The first stride is to "unwrap" the mesh in question. This is merely moving all of the vertices so that yous get the mesh in its UV form. For case, here are the character'due south UVs:

unreal engine mesh paint

Here is the character afterwards unwrapping in Unreal:

unreal engine mesh paint

You tin unwrap a mesh by applying some simple Earth Position Offset math (which you'll run into after).

After unwrapping, the second step is to encode the world positions of the mesh into a render target. Y'all tin practice this by setting the unwrap material'south colour to Absolute Earth Position and then using a scene capture to capture the unwrap. Here is what the render target would await like:

unreal engine mesh paint

Notation: The render target changes color because the character is blithe. This causes the world positions to constantly change.

The third step is to create the sphere masks. At present that y'all tin admission the mesh's world positions, you can sample them in a sphere mask. You tin can then depict the sphere mask direct to a second return target.

The final step is to use the mask in the grapheme's cloth to blend between colors, textures or materials. Here are steps 3 and iv visualized:

unreal engine mesh paint

Now, let'south look at the proposed method.

Proposed Method

While Ryan'southward method works, information technology requires:

  • Two return target draws. The first is capturing the unwrapped mesh. The second is accumulating the sphere masks.
  • One render target to store the world positions
  • A render target to accumulate the sphere masks. You volition need a separate render target for each role player you desire to pigment on.

The method in this tutorial discards the second depict and globe position render target. Information technology does this past combining the unwrap and sphere masks into one material (the unwrap fabric). It so captures the unwrap using an additive composite mode to accumulate the sphere masks.

One thing to note is that both methods work all-time when the mesh does not accept overlapping UVs. Overlapping UVs will cause pixels sharing the same UV space to as well share the same mask information. For example, you have both hands UV mapped to the same space. If 1 hand becomes masked, the other hand will become masked too.

Now that you know the method, let'southward outset with creating the unwrap material.

Creating the Unwrap Fabric

Navigate to the Materials binder and create a new material. Name it M_Unwrap and then open up it.

Next, change the following settings:

  • Shading Model: Unlit. This is to make sure the scene capture doesn't capture any lighting information.
  • Two Sided: Enabled. Sometimes unwrapped faces can exist facing the other style depending on how the mesh is UV mapped. Two Sided will brand sure you tin still meet any flipped faces.
  • Usage\Used with Skeletal Mesh: Enabled. This will compile the shaders necessary for the fabric to piece of work on skeletal meshes.

unreal engine mesh paint

Up next is to unwrap the mesh. To practice this, create the setup beneath. Annotation that I have already created the CaptureSize and UnwrapLocation parameters within the MPC_Global asset.

unreal engine mesh paint

This volition UV unwrap the mesh to the specified location at the specified size. Note that if your mesh'due south unique UV map is on a separate channel, you lot will need to modify the Coordinate Index of the TextureCoordinate node. For example, if the unique UVs is on channel 1, you would gear up Coordinate Alphabetize to 1.

The side by side step is to create the sphere mask. For this, you volition need ii parameters: the hit location and sphere radius. Create the highlighted nodes:

unreal engine mesh paint

This will return white for pixels inside the sphere mask and black for pixels outside. Don't worry well-nigh setting a value for the parameters since you will practice that later in Blueprints.

It is important that you lot set the Absolute World Position node to Absolute Globe Position (Excluding Material Shader Offsets). This is because the pixel's globe position volition modify due to the unwrapping. Excluding material shader offsets volition give you the original world position earlier unwrapping.

That'due south all y'all need for the unwrap fabric. Click Use and and then close the material. Up next is to employ the material to the character to unwrap it.

Unwrapping the Character

For this tutorial, the capture Blueprint will handle the unwrapping and capturing. First, you lot will need a dynamic instance of the unwrap fabric. Navigate to the Blueprints binder and open BP_Capture. Later on, add the highlighted nodes to Event BeginPlay. Make sure you gear up Parent to M_Unwrap.

unreal engine mesh paint

Next, yous need a function to perform the unwrap and capture. Create a new function named PaintActor. Afterwards, create the post-obit inputs:

  • ActorToPaint: Type is Actor. The histrion to unwrap and capture.
  • HitLocation: Blazon is Vector. This volition be the eye point of the sphere mask.
  • BrushRadius: Type is Float. The radius of the sphere mask in earth units.

unreal engine mesh paint

Although this painting method can work with any actor, we will only check if the incoming actor inherits from the Character class. And for lawmaking simplicity, we'll store the character'southward skeletal mesh component into a variable since yous will need to reference it a few times. To do this, add together the highlighted nodes:

unreal engine mesh paint

Now it's time to do the unwrapping and sphere masking. To do this, add the higlighted nodes to the terminate of the node chain:

unreal engine mesh paint

Here's what each line does:

  1. Kickoff, this will salvage the mesh'south original material so yous tin reapply it later. Afterwards, it volition apply the unwrap material.
  2. This line will pass in the hit location and brush radius to the unwrap material for sphere masking

Before you can examination the unwrapping out, you will demand to do a line trace from the role player to get a striking location.

Getting the Hit Location

Click Compile and so go dorsum to the principal editor. Afterwards, open BP_Player. Open the Shoot part and add the highlighted nodes. For this tutorial, gear up Castor Radius to ten.

unreal engine mesh paint

Click Compile and so close BP_Player. Printing Play and then left-click on the character to exercise an unwrap and sphere mask.

unreal engine mesh paint

If you're wondering why the mask keeps moving, it is considering parts are moving in and out of the sphere mask. This is non a trouble though because you volition merely capture the unwrap at the time of the hitting.

Now that y'all have unwrapped the mesh, you need to capture it.

Capturing the Unwrap

First, it'due south a skillful idea to add an unlit black aeroplane behind the unwrapped mesh. This will help prevent seams at the border of UV shells. Open BP_Capture and then add a Airplane component named BackgroundPlane. To salve fourth dimension, I accept already created the black cloth for you. Set the fabric to M_Background.

unreal engine mesh paint

For this tutorial, the unwrap and capture size are 500×500 units and then the background plane will need to be at least that large. Set the Scale to (v.0, 5.0, ane.0).

unreal engine mesh paint

Since the plane's location and unwrap location are the same, it is besides a good thought to start the plane downward to prevent any z-fighting. To do this, set Location to (0.0, 0.0, -i.0).

unreal engine mesh paint

Next, y'all need to perform the capture. Go back to the PaintActor office and add together the highlighted nodes:

unreal engine mesh paint

This will capture the unwrapped mesh. Afterwards, information technology volition reapply the mesh's original material.

Currently, the scene capture will overwrite the previous contents of the render target. To brand sure the sphere masks accumulate, you need to make sure the scene capture adds to the previous contents instead. To do this, select the SceneCapture component and set Scene Capture\Blended Mode to Additive.

unreal engine mesh paint

Click Compile and then close the Pattern. Next, y'all demand to use the render target in the character'south material.

Using the Mask

Navigate to Characters\Mannequin\Materials and open up M_Mannequin. Afterwards, add the highlighted nodes. Make sure to set the Texture Sample to RT_Capture.

unreal engine mesh paint

This will display red wherever the mask is white and orangish wherever the mask is black. If you wanted to though, you could blend between textures or material layers instead.

Click Apply and then close the material. Press Play and left-click on the grapheme to start painting.

unreal engine mesh paint

Where to Go From Hither?

Yous can download the completed project using the link at the top or lesser of this tutorial.

While you lot've just used sphere masks in this tutorial, they are not the only shapes you lot can utilise. There are boxes, cylinders, cones and more than! To learn more about these shapes and how to implement them, check out these two posts:

  • Modelling with Altitude Functions by Inigo Quilez
  • Volumetric Rendering: Signed Distance Functions past Alan Zucconi

If you lot'd like to bank check out another method of mesh painting, check out Tom Looman's Rendering Wounds on Characters. Instead of accumulating sphere masks, he sets a fixed number of sphere masks. The advantage of this method is that information technology'due south cheap (depending on how many sphere masks you have) and it is relatively easy to animate the masks. The disadvantage is that there is a hard limit on how many sphere masks you can do.

If there are any effects you lot'd like to me cover, let me know in the comments below!

DOWNLOAD HERE

Posted by: caballeroeved1962.blogspot.com

Post a Comment

Previous Post Next Post