Strong sunlight and water are not good for photogrammetry, so we try to do it during a cloudy and dry day. Once we found the subject, let’s say a rock or a wall, we will first put the Colorchecker (we use Xrite Colorchecker Passport) near the subject and take a good big photo of it, that photo will be used for calibrating color and white balance later.
Then we take many photos of the subject from every side, overview and details too. We use fixed 50mm lens or a zoom lens but not changing the zoom during shooting. We are taking pictures in RAW format. If you use jpeg then make sure your white balance is not changing during shooting (not Auto). The subject should be sharp, so you may want to adjust the aperture accordingly. More photos is better, with too few photos the program may fail to work or make a blurry scan. Typically you want to see every point of the subject in many photos. So like 100 pictures is not too much, some people are even making 1000s of pictures! Anyway once your scan is complete you can delete them all.
That’s the last step of our photogrammetry workflow. At this point we have the mesh to import SM_Mesh.fbx and either its base color texture T_Mesh_D.tga or it’s color-roughness combined texture and the normal map (T_Mesh_DR.tga and T_Mesh_N.tga).
First we’ll import the mesh. Don’t forget to check the Build Nanite and uncheck Build Lightmap UVs.
Mesh import dialog
We will then use Modeling Tools plugin to modify the pivot and sometimes the scale, but remember, the Nanite mesh should be pretty big. If your mesh is too small it will become partly black because the Unreal couldn’t correctly calculate the normals for the micro triangles.
Next step is to import the textures, this is pretty straight forward, just drag them into the content browser. Check if Unreal recognized the normal map correctly.
Final step is to create the material. We have a master material (inspired by Epic’s examples) which allows us to manipulate color, normals and roughness. We’ll create a new instance, setup it with our imported textures and modify various parameters. Then we set that material as default material of the mesh and voila, it’s done!
“De-lighting” actually means removing shadows from the texture, making a good base color texture to use in Unreal. We use free Agisoft De-Lighter tool (official tutorial).
You start by importing the fbx produced by Metashape (or other program but there should by a texture).
On the right side of the UI there are 2 main tools to remove shadows: “remove cast shadows” and “remove shading”. Remove shading is an automatic tool suitable for simple situations. We try it first and if it works use the result.
“Remove cast shadows” requires manual markup of lit and shadowed areas. You basically show the examples of lit areas and shadowed areas in your picture then the program tries to remove shading. To start we paint some yellow strokes in lit areas and blue strokes in the shadows (you don’t need to paint them all, just try to cover all materials, like here we try to show all different stone colors)
If the brushes (2) are grayed out then double-click on the “Illumination map” (1) to activate them. That also works with processed models. Check the other icons on the toolbar, you can erase the marks, hide them and change the size of the brush. Space bar switches between paint and rotate modes.
Once it’s been annotated, use “Remove cast shadows” button to run the algorithm. Preview button use 1/4 resolution to speed things up. The process can create some unnatural color and light variation, it that case try to use different Highlight and Color suppression parameters to see which works better.
The delighting process can remove some dark colors that are not actually shadows (like dark spots on the rocks or paint etc.) To fix that you need to create another mask called “Shadow scale map” and annotate those places with third color (light blue). To create this mask right click on the model on the left and choose “Add shadow scale mask”. Then paint with light blue color lit areas where you want to preserve dark details. To return to the illumination mask or another mask double click on it.
Run the preview again and once you are satisfied run the “remove cast shadows” at full res.
Sometimes this first step will not remove all shadows. In this case you can repeat the procedure on the Processed texture. First double click on the Illumination map of the Processed texture to activate it. Your original light/shadow markup from previous step will be copied here. What we did for this wall is to leave all yellow marks and but remove the blue ones (using blue cross on the toolbar) then repaint them in places that remain too dark (between stones). Finally, we will also create a new Shadow scale Map and protect the lit areas using it
When it’s done use “Remove cast shadows” button again and if it works well export the final result by right clicking on it and choosing Export model. It will export a new fbx (which we don’t use) and a texture, which we’ll use in the next step. We usually export in tiff of tga format.
Read more: check the official tutorial, in the end there are links to downloadable examples.
In this step we will prepare textures to import in Unreal. Right now we have the original photo scanned mesh, lets’ call it Mesh.fbx, it’s de-lit base color texture Mesh_delit.tif and the re-topologized mesh SM_Mesh.fbx with new UVs prepared for import in Unreal. We will first create the base color texture that matches the new mesh (bake), then, optionally, create a Normal and Roughness textures.
But before the baking begins we will open our 2 meshes in Maya together and check two things: they should be in the same place in the world (otherwise the bake will fail of course), and they should be at least 1m large or more. If the meshes are too small (few centimeters large), the tiny high-poly triangles become microscopic and that will cause issues with normals both for baking and for Unreal. Even if the mesh is small IRL you need to scale it bigger. (you can scale it back in your level in Unreal). Finally we will freeze the transforms so rotation is 0 and scale is 1.
For baking the base color texture to the new mesh and its UVs we use xNormal. Specify Mesh.fbx as “High definition mesh”, Mesh_delit.tif as its “base texture to bake” and SM_Mesh.fbx as “Low definition mesh”. Then in the Baking options tab specify the output file, here we will call it Mesh_xn.tga, check “Bake base texture” and hit Generate maps button. This will give you the base color texture you can import in Unreal, usually we rename it in something like T_Mesh_D.tga (D for Difuse).
For creating optional roughness and normal maps we use Substance Alchemist. Simply drag the T_Mesh_D.tga into that program and it will generate various textures using its AI based algorithms. We will export roughness and normal maps, then for our Unreal material, we will add the roughness as alfa channel of the base color texture in Photoshop. In this case we will save the combined texture as a new file called T_Mesh_DR.tga (R for Roughness). We will call the normal map T_Mesh_N.tga
Alchemist also allows you to do the de-lighting, but it doesn’t take the mesh shape into account. It’s totally possible to use it for simple cases, for example when the mesh is very flat. But with more complex meshes and lighting scenarios the Agisoft De-Lighter works better. In case when we want to use Alchemist for de-lighting we will skip the De-Lighter step, using xNormal to bake the original photo scanned texture, then give it to the Alchemist and produce also the base color in there.
Bone driven controller rotation source around Y is limited to -90°..90° interval, which can be a problem. For example, if you have an elbow rotating around Y and you have a morph that should be applied between 110° and 135°, the default bone driven controller is useless. This node solves the problem by allowing you to specify custom rotation order that will be used for transforming quaternion to euler.
Just a quick post about making looping animations in Maya Time Editor, mostly for myself. Suppose you have a walk mocap fbx and you want to make it loop so you can use it in UE4, here the way I found to make it. (I’m not an anim pro, if you know better please leave a comment)