Blender To Unreal Engine 4



Creating a destructible object in Unreal Engine 4 & Blender

While Chaos physics engine is on the way. We were testing approaches to make destroyables in Unreal Engine 4. Here you can find how we did it.

Learn the basics of getting your assets from Blender to Unreal Engine 4 in just 5 minutes! If you run into problems or have questions, please ask in the comm.

【Blender】Blender to Unreal Engine 4 - 育碧大神教你制作UE4游戏房屋场景全流程. How to Build Unreal Engine 4 on Ubuntu with Blender Assets The original Unreal game Although the source code for Unreal Engine has been made freely available in more recent times, creating and editing levels using the engine is nothing new.

Requirements

As always we start by pointing out what we would like to reach:

  • Artistic Control. We want our graphics artist to be able to create destructible as they wish,
  • Don’t break gameplay. They should be only visual representation not breaking any gameplay-related stuff,
  • Optimized. We want to have full control of performance and don’t break CPU performance,
  • Easy to setup. They will be configured by graphics artists so we want them to be easy to configure without too many steps,

We were searching for best references that fit our needs and we found that destructible from Dark Souls 3 and Bloodborne fit perfectly for us.

Basic Idea

The basic idea is easy:

  • Have base mesh which is visible,
  • Add mesh parts which are hidden,
  • On break: hide base -> show parts -> enable physics,

Preparing assets

We are using Blender for object preparation, we recommend using it too.

To create fracture mesh we use Blender Addon called Cell Fracture.

Enable Addon

Blender To Unreal Engine 4

First you would need to enable the addon as it’s not enabled by default.

Blender to unreal engine 4 tutorial

Search for Addon (F3)

Then enable addon on selected mesh.

Configure Settings

Run addon

Check out our settings from video. Amazon prime download for mac.

Select by Material to unwrap the cut parts

Then just create UVs for parts.

Engine

Add Edge Split

Edge Split will correct shading.

Link Modifiers

This will apply Edge Split modifier to all selected parts.

Final

This is how it looks in Blender. Basically we don’t need to model all parts.

Implementation

Base class

Our destroyable is an Actor who has a couple of components:

  • Root scene,
  • Static Mesh which is our base mesh,
  • Box for collision,
  • Another Box for overlaps,
  • Radial Force,

We are configuring some things in the constructor:

  • Disabling tick, (basically always remember to distable tick on actors that don’t need it)
  • Set mobility to static for all components,
  • Disabling affecting navigation,
  • Setup collision profiles,

In Begin Play we are gathering some data and configure them:

  • Search for all parts using “dest” tag,
  • Setup collision for all of them so artist doesn’t need to think about this step,
  • Set mobility to static,
  • Hide all parts,

Destroying part

There are three places which will trigger break:

OnOverlap
For example: when you want to break if someone is dashing or using the specific thing like rolling ball 😉

OnTakeDamage
When destroyable is receiving damage.

OnOverlapWithNearDestroyable
This one is important. When you put one destroyable on another one. In our case, they both break as we don’t want to have too many specific physics issues to handle.

Breaking Part Flow

Handle sleep

When a part is going to sleep (from sleep physics event or forced sleep by delay) we are disabling physics/collision and set mobility to static. Thanks to that performance will increase.

Sometimes your physics asset won’t go to sleep and will still update even if you don’t see any movement. We are forcing all parts to go to sleep after 15 seconds if they still simulate physics:

Handle destroy

After breaking we are trying to check if we can destroy the actor (eg. player is far) if not – check again in some time.

On Part hit callback

Blender To Unreal Engine 4 Tutorial

We decided that Blueprints are responsible for audio-visual part of the game so we are adding Blueprints events where we can.

End Play and clearing out

Our game can be played in editor and custom editors created by us. That’s why we need to clear out everything we can on EndPlay.

Configuration in Blueprints

Unreal

The configuration is simple. You just put parts attached to the base mesh and tag them as “dest”. That is it.

Graphics artists don’t need to do anything else in the engine.

Our base blueprint class is only doing audio-visual things from events that we provided in C++.

Begin play – load necessary assets. Basically, in our case each asset is soft object pointer and you should use it as well even when creating prototypes. Hardcoded assets reference will increase editor/game load times and memory usage.

On Break Event – spawn effects and sounds. Here you can find some Niagara parameters which are described later.

On Part Hit Event – spawn hit effects and sounds.

Basically we are always trying to implement logic in C ++ and use the Blueprint to configure parameters and do audio-visual things.

Utility to Quickly Add Collisions

You can create Utility Blueprint for Asset Type Actions to generate collisions for all the parts. Much faster than creating it by yourself.

Particle effects in Niagara

Niagara is life changer now. Here you can find how we created this simple effect.

Material

Erosion, color and alpha comes from Niagara.

As you can see most of the effect is coming from the texture. We could use B channel here to add more details but currently, it’s not needed in our case.

Niagara System Params

We use two Niagara Systems: one for break effect (which is using base mesh to spawn particles) and the other one when a part is colliding. (without static mesh location)

Niagara Spawn Burst

Niagara Particle Spawn

  • We sample static mesh which comes from the destroyable,
  • Pick random Lifetime, Mass and Size,
  • Chose color from user color parameter, (which is set by the destroyable actor)
  • Spawn particles at mesh verticles location,
  • Add random velocity and rotation rate,

Sampling Static Mesh

To be able to sample static mesh in Niagara your mesh need to have AllowCPU checked.

TIP: In current (4.24) version of the engine if you reimport your mesh this value will reset to default. And in shipping build when you try to run such Niagara System with a mesh that doesn’t have CPU Access enabled you will have a crash.

That’s why we have added simple code to check if mesh have this value checked.

Which is used in Blueprints before spawning Niagara.

What is cool you can create an editor widget to find Destroyables, and set their Base Mesh AllowCPUAccess variable.

Here’s the python code which is searching for all destroyables and set CPU access on the base mesh.

You can run it directly using py command, or create buton to run this code in Utility Widget.

Niagara Particle Update

On update we are doing couple of things:

  • Scaling alpha over life,
  • Adding some curl noise,
  • Change rotation rate using a custom expression
    (Particles.RotRate * (0.8 – Particles.NormalizedAge)
    Sometimes it’s easier to do custom expression than a curve.
  • Scaling particle size over life,
  • Update material erode parameter,
  • Add some vector noise,

Niagara Learning References

You should definitely watch some presentations about Niagara. We will be doing more Niagara focused tutorials over time.

Why we are using such an old-school approach

We could use the current destroyable system from UE4 but we want to have better control over performance and visuals. You should ask yourself if you need a big system for your needs. In our case, we don’t. As for Chaos, we are waiting when it will be production-ready.

One Response

  1. […] Source : https://kidswithsticks.com/creating-a-destructible-object-in-unreal-engine-4-blender/ […]

The project profile series of Blender 3D Architect is a collection of articles with the aim of feature projects related to architectural visualization. We invite talented artists to share additional details about each project to demonstrate how they approach each stage of the process. And also allow each author to publicize their work among our readers.

How does it work? It is like an interview, where we sent a couple of questions about a project for the artist.

If you want to check previous project profiles, visit this link.

Today we have an apartment interior from digital artist Wessel Huizenga, which uses Unreal Engine 4 as the primary render engine for models created with Blender. Since the artist shared a lot of details on this project, we divided the profile into two parts.


(Click to enlarge)

What is unique about this project? Unlike many of the projects that start with Blender for a render with either Cycles or Eevee, you find an architectural project using real-time renders with the Unreal Engine. In this detailed profile, the artist shares a lot of his workflow and shows how he manages to get an architectural scene ready for rendering in the UE4.

The use of tools such as the Unreal Engine 4 for architecture is something new for a lot of artists because it involves handling and adjusting a game engine. It is a different workflow from Blender, which could give some impressive results if you know how to set up lights and materials. With the benefit of having a fully interactive 3D space to present your ideas and projects.


(Click to enlarge)

Let me thank Wessel Huizenga for sharing the details about the project with Blender 3D Architect readers.

Blender To Unreal Engine 4 Animation

Was it a commercial project? What can you tell us about the motivation for this project?

”Top Floor” is a personal project of mine. It is part of a series that I did for my ArtStation portfolio. Adobe cc free download for mac. In this series, I took existing architectural renders made using “traditional methods” as a reference. I built those scenes up from the ground inside Blender and recreated them (in my style) entirely inside the Unreal Engine 4.

The point of these series is to use them as a connection or conversation starter. Before I started doing archviz around a year ago, I did some research on what programs to use. I quickly found out that UE4 was a big upcoming game changer within the archviz industry.

Knowing that I wanted to create two or three scenes that look identical in quality but are made using very different programs. Whenever I get invited to a company to do a speech about my work, I can convince them that it is more than possible to achieve a similar result using UE4 than you can with the “traditional method.” Remaking a scene gives a fantastic way to compare both scenes, and makes it really interesting for companies that are looking to dive into UE4.

Did you use any references for modeling, like technical drawings?

For the project ”Top Floor” I aimed to recreate an existing scene. I used the renders of a scene called Not So Small as my reference and my experience in 3D evaluate dimensions and scale. The blueprint that came with this project helped me get the overall layout of the scene.


(Click to enlarge)

(Click to enlarge)

How long did it take from start to finish?

It’s hard to give a precise estimate of the time as it was a side project. It took me around two full work weeks (80 hours) to get a finished product. I could have done it way faster because I have a fully developed pipeline developed for such types of projects.

But because I am still studying, I was also looking to take some time to learn new things during this project. With the pipeline I have, it is more than possible to set up the scene within a week (working with a 3d library that I created over time).


(Click to enlarge)

Do you convert only the architectural elements (walls, windows,) or the entire project, including furniture?

Personally, I’m a fan of exporting my assets as custom FBX files. Exporting everything myself gives me more control. When I export, I make sure that I create my scene using the right groups. I have a group for all the walls, furniture, and small props. Selecting everything in one group makes it easy to import to UE4.

I simply have to drag and drop and put the values on 0 for all the objects to be in the same position as they are in Blender.

Blender to unreal engine 4

What hardware did you use to render? Can you share some render times?

With a mid-range PC, it is always a challenge when it comes to baking times. For this reason, I always optimize my 3D Assets by making them as low poly as possible and using a custom UV that helps to improve the quality of the lightmap. A good lightmap really helps to decrease building times. I make sure that the assets I export aren’t too big so that I can keep the resolution of the lightmap pretty low.

When separating bigger objects into smaller ones, I have to be smart to choose where I would cut them up. Having weird cuts in the wall might result in bad artifacts (shading errors).

Keeping everything in mind and optimizing as much as I can result in good overall quality and a baking time around 2–3 hours on CPU. Because I can keep my building times quite low on CPU, I never felt the need to switch to GPU baking on my personal PC.

I believe resolving the issue of long baking times in UE4 really helps improve the overall scene rather than switching to GPU. In the future, I would love to see the power of GPU rendering inside UE4.

My specs → Intel Core i5 8400 – 2.80GHz Hex Core (Coffee Lake) Processor, GeForce GTX 1060 6GB, and 24GB of RAM.

This concludes the first part of our project profile. Later this week, we will post the second part with details on the lighting process for this project. Keep reading the rest of this profile in part II.

Thanks again to Wessel Huizenga for sharing details about his work. Visit his portfolio page if you want to reach him or see more of his architectural visualization projects.

You can also reach him on LinkedIn.

Using Blender for architecture

Do you want to use Blender for architecture or render your projects using Cycles or Eevee? We have three books available that could help you!

They cover the use of Blender for producing architectural content and also all information you need to render projects in real-time:

Import From Blender To Unreal Engine 4

You can get them in both digital and paperback formats. By ordering those books, you will not only improve your skills with Blender for architecture but also support Blender 3D Architect.