Unreal Engine 5 Tutorial - Instance Importer - Reading Files With Blueprints [3/4]

preview_player
Показать описание
In this multi-part video we take a look at how to load our exported files from Blender & Maya into Unreal by writing a File Loader/Parser with Blueprints.

*Small correction from the video, make sure if your exporting from Maya you also plug the SZ into Scale Y and the SY into Scale Z. I didn't do that in this video here and it technically would result in incorrect scaling.

*If you are exporting from Blender, you do not need to swap any of the Z/Y values because in Blender Z axis is also facing up like in Unreal.

Patreon:

Discord:
Рекомендации по теме
Комментарии
Автор

You should be WAY UP IN THE YOUTUBE LADDER, these videos were crazy high quality and professional, thank you so much!

espen
Автор

I ran into an issue where the instances didn't seem to rotate at all, and in the data table I noticed the angles were apparently very tiny. This was because Blender was exporting the angles as radians. I fixed this by adding three "Radians to Degrees" nodes between the "break" node and the "make transform" node in the UE construction script. Thank you so much for an incredibly helpful video!

espen
Автор

Here is how to make it work with blender :

1. You first need to modify the exporter. Add a field for "w" (I will use quaternion but no worry it's easy)

col = ['', 'id', 'tx', 'ty', 'tz', 'rw', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz']

2. As most of you know, when you work in blender with the x axis toward you, the z axis up and the Y axis to your left, the equivalent in Unreal is the same except the y axis is to your right. So add a minus sign in front of "y" location. Also Blender and Unreal doesn't have the same units, if you Use "Apply unit" when you export, add something to scale it :

BlenderToUnrealScale = 100;

data.append(obj.location.x * BlenderToUnrealScale)
data.append(-(obj.location.y * BlenderToUnrealScale))
data.append(obj.location.z * BlenderToUnrealScale)

4. Instead of the 3 lines with data.append(obj.rotation_euler.x), here it what we'll need :

Quaternion =
data.append(Quaternion.w)
data.append(-Quaternion.x)
data.append(Quaternion.y)
data.append(-Quaternion.z)

5. Now you need to modify the unreal blue print structure (F_ISMImport). Add a field "rw" which is a float just as rx, ry and rz. Put this field before rx to make it the same position than in the csv file we wrotte with blender.

6. Finally modify the construction script of the blueprint :
- The Break F_ISMData now contain a new field rw. Add a "Make Quat" node. Put the rw, rx, ry and rz component into the "Make Quat" node.
- Drag the return value of the "Make Quat" node and put it into a "ToRotator" node.
- Drag the return of the "ToRotator" node and put it into a "Break Rotator" node.
- Drag the X, Y and Z of this node "Break Rotator" into the "Make Transform Node" Rotation X, Rotation Y and Rotation Z.

7 . Tips in the case you have issues if, like me, you have a separate blender file for your construction :
* Export the object you're planing to use with x as forward axis and z as up axis.
* If you have rotation issues after all this, right after importing the mesh you're planing to place many times, select it > ctrl + a > all transforms. It will cancel all the blender adaptation which are usefull in some cas but can completely f up your construct.

And voilà !

Thanks to @renderBucket, appart those little adjustement for blender this tuto was very usefull to me and it improved my workflow a lot ! :)

koromire
Автор

if you're like me and tried to write the .csv file manually in c++, be aware that ue5 requires a name as the first column of every row for some reason.

something like this:
writeFile << "---, x, y, z" << std::endl;
for (size_t a = 0; a < cubeNum; ++a) {
writeFile << a << ", ";
writeFile << cube[a].x << ", ";
writeFile << cube[a].y << ", ";
writeFile << cube[a].z << std::endl;
}

ice_queen
Автор

I am trying to get this to work with importing from blender, but when doing a straight x, y, z to x, y, z mapping, although the positions look correct, rotations are not. I have tried swapping axes, but end up with a bigger mess, and I am struggling with the maths. What transform exactly do I need to do to convert from blender coordinate system to Unreal when importing? I tried mapping -X val in Blender to Y val in Unreal, and y val in blender to -X in Unreal (leaving Z the same) for both position and rotation components, but it hasn't helped.

viviancrompton
Автор

Thank you for this it's such an awesome way to do instances, how could I use the same method to instance several meshes to construct something like the building in part 4?

shawnbecker
Автор

is it possible to have multiple ISM in a single csv file and to the same process? I have around 5-6 different meshes that i used to create a building, I would like to follow the same process in the video series, I would assume I need to specify in BP which ISM to instance and I would need a index specifying that, how can I export that information from maya ? would I need to create a specifc index telling which mesh is where ? if i use mesh instance in maya already can i get that information to the data.csv? thanks for the video, very clear and concise!

gaguto
Автор

I am curious, how did you create the hand scene in maya/blender? Having to put manually so 12 000 bricks/cubes one after another in 3D modelling software is also not efficient. So did you use some tools to create that, could you share more about that under my comment?

sytix
Автор

Great video.
Would it be better to just merge all the instances into one mesh?

LastIberianLynx_GameDev
Автор

One note is that the way Blender units are meters and Unreal units are centimeters will cause everything to be all bunched together unless the Tx, Ty, and Tz are all multiplied by 100 using a Multiply node between the Break node and the Make Transform node. Some people might instead choose to change the Blender unit to 0.01, but I don't want to do that because I am using Send to Unreal to import most things, and it converts the units nicely to all be the same. Also it turned out I had to multiply Ty by -100, and Rz by -1.
This is really a big help to me. I'll need to use it a bunch of times. I did my test as a Hierarchical ISM as that is what I'll mostly use it for - I suppose it doesn't need any adjusting in that case, right?

kimholder
Автор

Is there a way to do this with animated objects as well?
Like export the data for each frame and also import it for each frame?

hanneswerner
Автор

I had problems with the location of the objects when using blender. They all appeared together. Multiplying the location by one hundred solved it. I guess it's because blender normally scales the static mesh. We have to do that step manually here. In case it helps someone.

sinonimos
Автор

Why you didn't make with "Editor Utility Widget"??

fafatogames
Автор

Hi, are there any steps to get collision to work on the instances? It works on the static mesh itself (and also when they are batched together) I've tried a number of things in settings on the ISM and the generating BP. Thanks

keithstark
Автор

I'm also having issues with the orientation. The weird thing is, some instances are correct, and others are not. There doesn't seem to be a clear pattern to the orientation issues. The Import Into Level is not a real alternative because it is only meant for loading an entire scene which is not practical if the scene is large. So there is a need to be able to export just chunks of the level at a time. The problem with Import into Level tool is that it creates duplicates of each static mesh each time you do it. And the reimport feature apparently does not work at all. Perhaps I am using it wrong. It would be great to get this importer working correctly with the orientation though, because it is a very simple and effective workflow.

agj
Автор

I do enjoy your videos.... as per your request: how can I get the dimensions (sizes) of a static mesh in UE? I know what my mesh dimensions are, but I want to get it procedurally, if I have to make changes to my mesh, for some reason. If you want to make a video of this, go for it, but a simple reply to this message to which node(s) to consider will be greatly appreciated.

GSProjects
Автор

Works for the most part but I'm getting weird rotations in maya despite flipping them the same way as the video

Vode