Solved

Place Datasmith mesh location not in origin?

  • 6 September 2021
  • 11 replies
  • 35 views

Hi,

When exporting to Datasmith all the meshes origin is located in 0,0,0. This courses some problems for us in Unreal, especially when we are working in large worlds.

0 locationIs there a way to make the change in FME so that the meshes have a pivot point in the center point instead?

CorrectPivot 

(There was once a time that adding the CsmapReprojector from same to same coordinatsystem worked, but not in FME 2021)

icon

Best answer by daveatsafe 22 September 2021, 00:53

View original

11 replies

Userlevel 2
Badge +17

Hi @Samuel Engström​,

Currently, using the CsmapReprojector is the easiest way to apply the internal transformation on 3D features. It will still work in FME 2021 if you use the same coordinate system under two different names (ie. name and EPSG code). The best to use are most likely WGS84.Geocentric_FME and EPSG:4978. These are the same coordinate system, but the different names will trigger the CsmapReprojector to apply the transformation.

Userlevel 2
Badge +17

Hi @Samuel Engström​,

We are working on a new transformer to resolve internal transformations, but I was notified that you can also use the CoordinateRounder to do this.

Hi @Samuel Engström​,

We are working on a new transformer to resolve internal transformations, but I was notified that you can also use the CoordinateRounder to do this.

Hi, it is good to know that you are working on the new transformer.

But don't seem to get the internal transformation to work as it should, I have tried all the different settings i can think of with the CsmapReprojector and CoordinateRounder. And my written models still has its origin in 0,0,0.

 

Is it something you see that I might be doing wrong?

 

2021-09-21 19_05_02-Ue4Project - Unreal Editor2021-09-21 19_09_38-_NONE → NONE (C__Perforce_sae_RV_SignalReview_FME_3DViewer_3DViewer_DWGProjectMo2021-09-21 19_10_22-_NONE → NONE (C__Perforce_sae_RV_SignalReview_FME_3DViewer_3DViewer_DWGProjectMo

Userlevel 2
Badge +17

Hi, it is good to know that you are working on the new transformer.

But don't seem to get the internal transformation to work as it should, I have tried all the different settings i can think of with the CsmapReprojector and CoordinateRounder. And my written models still has its origin in 0,0,0.

 

Is it something you see that I might be doing wrong?

 

2021-09-21 19_05_02-Ue4Project - Unreal Editor2021-09-21 19_09_38-_NONE → NONE (C__Perforce_sae_RV_SignalReview_FME_3DViewer_3DViewer_DWGProjectMo2021-09-21 19_10_22-_NONE → NONE (C__Perforce_sae_RV_SignalReview_FME_3DViewer_3DViewer_DWGProjectMo

Hi @Samuel Engström​,

Would you mind attaching your workspace, so that I can check out the writer settings? The Reprojector workaround was used to resolve the transformation matrix on the 3D features, but it looks like you would prefer that the matrix be kept and supplied on the output. I would like to see if there are any other settings that would resolve the matrix.

Hi, it is good to know that you are working on the new transformer.

But don't seem to get the internal transformation to work as it should, I have tried all the different settings i can think of with the CsmapReprojector and CoordinateRounder. And my written models still has its origin in 0,0,0.

 

Is it something you see that I might be doing wrong?

 

2021-09-21 19_05_02-Ue4Project - Unreal Editor2021-09-21 19_09_38-_NONE → NONE (C__Perforce_sae_RV_SignalReview_FME_3DViewer_3DViewer_DWGProjectMo2021-09-21 19_10_22-_NONE → NONE (C__Perforce_sae_RV_SignalReview_FME_3DViewer_3DViewer_DWGProjectMo

Yes sure, ill attach a simple version of what I want to do In this message.

To clarify, I want the pivot point on all 3D geometries to be placed in the center of the mesh, while the datasmithSceneActor may be placed in 0,0,0. The image below show a representation of how I want to have the scene.2021-09-21 21_10_11-Ue4Project - Unreal Editor 

We want this because we are working with very large worlds, hundreds of kilometers in length. And If the 3DFeature has its pivot point in origo we get a lot of floating point precision errors.

Hi, it is good to know that you are working on the new transformer.

But don't seem to get the internal transformation to work as it should, I have tried all the different settings i can think of with the CsmapReprojector and CoordinateRounder. And my written models still has its origin in 0,0,0.

 

Is it something you see that I might be doing wrong?

 

2021-09-21 19_05_02-Ue4Project - Unreal Editor2021-09-21 19_09_38-_NONE → NONE (C__Perforce_sae_RV_SignalReview_FME_3DViewer_3DViewer_DWGProjectMo2021-09-21 19_10_22-_NONE → NONE (C__Perforce_sae_RV_SignalReview_FME_3DViewer_3DViewer_DWGProjectMo

Also test data if you need it.

 

Userlevel 2
Badge +17

Hi @Samuel Engström​,

I have a technique I think will work, but I don't have a strong enough video card to test out in UE. The attached workspace will:

  • get the center point of the mesh
  • move the mesh so that its center point is at 0,0,0
  • apply the transformation
  • move the mesh back to its original location, creating a new transform from local origin

Please try it and see if it gets you the results you want.

Hi @Samuel Engström​,

I have a technique I think will work, but I don't have a strong enough video card to test out in UE. The attached workspace will:

  • get the center point of the mesh
  • move the mesh so that its center point is at 0,0,0
  • apply the transformation
  • move the mesh back to its original location, creating a new transform from local origin

Please try it and see if it gets you the results you want.

That worked perfectly.

Thank you so much!

Badge +2

Hi @Samuel Engström​,

Currently, using the CsmapReprojector is the easiest way to apply the internal transformation on 3D features. It will still work in FME 2021 if you use the same coordinate system under two different names (ie. name and EPSG code). The best to use are most likely WGS84.Geocentric_FME and EPSG:4978. These are the same coordinate system, but the different names will trigger the CsmapReprojector to apply the transformation.

Hi @daveatsafe​,

Is it possible to change the pivot point to be on each object when exporting multiple features to Datasmith? The use case would be to export ~3000 tree locations, then replace those with realistic trees in Unreal/Twinmotion. At the moment the pivot point will be at 0,0 so replacing the objects will not retain the true locations. https://www.youtube.com/watch?v=R6rsATORnu4 This video describes the desired workflow - others in the comments experience the same pivot point issue when exporting from other software. I can't find many guides or case studies from Safe for this workflow at the moment.

Userlevel 2
Badge +17

Hi @daveatsafe​,

Is it possible to change the pivot point to be on each object when exporting multiple features to Datasmith? The use case would be to export ~3000 tree locations, then replace those with realistic trees in Unreal/Twinmotion. At the moment the pivot point will be at 0,0 so replacing the objects will not retain the true locations. https://www.youtube.com/watch?v=R6rsATORnu4 This video describes the desired workflow - others in the comments experience the same pivot point issue when exporting from other software. I can't find many guides or case studies from Safe for this workflow at the moment.

Hi @James Singleton​,

I think the same technique I posted earlier, using the Offsetters and CoordinateRounder, will work, but you will need to save each feature to a separate output file. You can do this by setting the Layer Name in the output feature type to an attribute on the feature instead of a fixed value. The attribute chosen should be unique for each feature.

Screen Shot 2022-02-22 at 11.25.53 AM

Badge +2

Hi @daveatsafe​,

Is it possible to change the pivot point to be on each object when exporting multiple features to Datasmith? The use case would be to export ~3000 tree locations, then replace those with realistic trees in Unreal/Twinmotion. At the moment the pivot point will be at 0,0 so replacing the objects will not retain the true locations. https://www.youtube.com/watch?v=R6rsATORnu4 This video describes the desired workflow - others in the comments experience the same pivot point issue when exporting from other software. I can't find many guides or case studies from Safe for this workflow at the moment.

Hi @daveatsafe​ ,

Saving each feature to a separate output file isn't going to be the best workflow unfortunately. In the original video I linked, they use a .fbx file containing multiple cubes all with their individual pivot points on the object which allow a direct replacement for Unreal/Twinmotion objects (trees/cars), but this ability ability to have the pivot point on each object appears to be inconsistent between different software exports (when looking at the comment section). The FME .fbx export appears to have the same issue. I would prefer to use the datasmith format but any workaround would be good.

 

After having a bit of a play with the .udatasmith files, the only workflow I can see working is exporting each feature to 0,0, then set the x/y coordinates under the transform tx/ty values within the datasmith file using a text editor (then they're in the right position, with the correct pivot point, and multiple features can be exported to the same file). Is there a way to set these tx/ty values using the datasmith reader, be either passing in parameters or somehow setting the transform? I'm not sure I follow the logic of using the CsmapReprojector. Otherwise I'll need to write the datasmith file with a featurewriter, then read/edit it and pass in the correct coordinates for each ActorMesh tx/ty. It's all a learning process at the moment so I could be missing something obvious...

 

If you know of any example .fmw workbenches or guides for writing to Unreal/Twinmotion using FME that would be useful too. My current queries are if light sources can be written, if it's possible to feed in animations/pathways to Actors in the .udatasmith writer, if it's possible to preset an existing Unreal/Twinmotion library object (by GUID?) and set its variables like tree height from FME (sorry about hijacking the post a bit here - I should probably start a separate post).

Reply