Skip to main content

Hi @MattAtSafe

I want to clip a 3D model with textures in FME. My modell has the following spesifications:

  • .obj format with textures
  • no coordinate system

If I use a clipper in FME, it doesn't accept the IFMEMesh.

Can you give me some recommendations on how to clip the modell and keep the textures?

 

Thanks!

Cecilia

Hi @cec_lia,

 

 

To clip a mesh in FME it first needs to have it's geometry converted as I understand it. You can use a GometryCoercer to convert the mesh to a composite surface. From there you can Deaggregate the surface (Splitting composits) using the Deaggregator. This should give you individual textured surfaces which can be now be clipped. Clipping will be performed based on the 2D extent of the data.

 

 

Without a coordinate system clipping could be difficult. I'm not exactly sure what kind of clip you want to do, but you may need to Georeference your models first before you can clip them.

 

 

After clipping you can either try and put the data back together as a Mesh or simply use an aggregator to create a multi-surface collection.

Hopefully this helps give you some of an idea on a possible process

 

 

Cheers

Hi @cec_lia,

 

 

To clip a mesh in FME it first needs to have it's geometry converted as I understand it. You can use a GometryCoercer to convert the mesh to a composite surface. From there you can Deaggregate the surface (Splitting composits) using the Deaggregator. This should give you individual textured surfaces which can be now be clipped. Clipping will be performed based on the 2D extent of the data.

 

 

Without a coordinate system clipping could be difficult. I'm not exactly sure what kind of clip you want to do, but you may need to Georeference your models first before you can clip them.

 

 

After clipping you can either try and put the data back together as a Mesh or simply use an aggregator to create a multi-surface collection.

Hopefully this helps give you some of an idea on a possible process

 

 

Cheers

I don't hink this will work. vitrualcitymatt is wright, the geometry has to be converted into an geometry type the clipper is capable to work on, but by doing this, your texture information is lost. When you coerce IFMEMesh into Polygons (triangles), the only thing that survives is the geometry but not the texture coordinates, as they were part of the surface that now no longer exists.


I don't hink this will work. vitrualcitymatt is wright, the geometry has to be converted into an geometry type the clipper is capable to work on, but by doing this, your texture information is lost. When you coerce IFMEMesh into Polygons (triangles), the only thing that survives is the geometry but not the texture coordinates, as they were part of the surface that now no longer exists.

Ahh yes good point. Clipping is not supported for surfaces.


Ahh yes good point. Clipping is not supported for surfaces.

My experience is also when you convert the polygons back to a mesh-format they are not welded together. So, you basically get a bag full of triangles and each vertex is copied 3 or more times (they are in the right place still tho, so programs like sketchup seems to weld them together on import).

 

You could avod this by delauney triangulate to a tin Surface with Surface modeller at 0 presicion, but then you get a heightfield (2 and a half dimensions) and extra triangles in the edges if you have a concave cutout area (and also in the height-axis if the edge heights are concave).


My experience is also when you convert the polygons back to a mesh-format they are not welded together. So, you basically get a bag full of triangles and each vertex is copied 3 or more times (they are in the right place still tho, so programs like sketchup seems to weld them together on import).

 

You could avod this by delauney triangulate to a tin Surface with Surface modeller at 0 presicion, but then you get a heightfield (2 and a half dimensions) and extra triangles in the edges if you have a concave cutout area (and also in the height-axis if the edge heights are concave).

Another option for this is to Aggregate the triangles into MultiSurface, Coerce into a composite surface and then coerce into a Mesh. There is also the MeshBuilder Custom Transfomer which is a nice option


I have the same problem with 3D reality meshes, although I'm not so much concerned about textures, as these can be re-applied later. However dropping mesh to surface is not sufficient as Clipper still rejects it (input is FBX or OBJ) and I ended up extracting geometry twice, down to 3D triangles. These are then Offset to World coordinates and Clipped, re-offset back to original position and I use MeshBuilder with grouping by Label from Clipper.

Problem I have though, is performance of this solution as I have few thousand mesh tiles, that need cutting and slicing to different sizes. Currently this equates to about 25k triangles/minute which for dataset I have would take something like 6 months!


Hi @cec_lia, @kkrajewski, @virtualcitymatt,

I'm sorry, but FME cannot currently clip surface features such as Faces and Meshes. We are working on adding this capability (FMEENGINE-15963, FMEENGINE-16057), and I will notify you as soon as it is available.


Hi @cec_lia, @kkrajewski, @virtualcitymatt,

I'm sorry, but FME cannot currently clip surface features such as Faces and Meshes. We are working on adding this capability (FMEENGINE-15963, FMEENGINE-16057), and I will notify you as soon as it is available.

I have a hunch our work to support Unreal is going to add more weight to this one. I do know that a clipping sprint is planned to follow our dissolve. That means no help in the very short term, but medium term looks good.


I have a hunch our work to support Unreal is going to add more weight to this one. I do know that a clipping sprint is planned to follow our dissolve. That means no help in the very short term, but medium term looks good.

Watching this space... ;-D


I have the same problem with 3D reality meshes, although I'm not so much concerned about textures, as these can be re-applied later. However dropping mesh to surface is not sufficient as Clipper still rejects it (input is FBX or OBJ) and I ended up extracting geometry twice, down to 3D triangles. These are then Offset to World coordinates and Clipped, re-offset back to original position and I use MeshBuilder with grouping by Label from Clipper.

Problem I have though, is performance of this solution as I have few thousand mesh tiles, that need cutting and slicing to different sizes. Currently this equates to about 25k triangles/minute which for dataset I have would take something like 6 months!

Hi @kkrajewski, can you elaborate on your approach at all and how you're keeping the textures?

I'm working with a smaller area that makes this approach feasible.


Hi @kkrajewski, can you elaborate on your approach at all and how you're keeping the textures?

I'm working with a smaller area that makes this approach feasible.

@stevenjh As mentioned in my post, the process I described is NOT keeping the textures at all, and results in a clipped mesh with default appearance. What we have done at later stage, was re-importing the mesh into Bentley ContextCapture and 'texturing' again. All in all it's a very inefficient and resource-hungry process hence we have only done this twice.


@stevenjh As mentioned in my post, the process I described is NOT keeping the textures at all, and results in a clipped mesh with default appearance. What we have done at later stage, was re-importing the mesh into Bentley ContextCapture and 'texturing' again. All in all it's a very inefficient and resource-hungry process hence we have only done this twice.

@kkrajewski thanks for this, I'll talk to our CC person!


@stevenjh As mentioned in my post, the process I described is NOT keeping the textures at all, and results in a clipped mesh with default appearance. What we have done at later stage, was re-importing the mesh into Bentley ContextCapture and 'texturing' again. All in all it's a very inefficient and resource-hungry process hence we have only done this twice.

Hi @kkrajewski,

I am attaching an experimental custom transformer that will clip and restore the textures on surfaces. Please give it a try and let me know how it works out


I have created an FME Hub transformer to perform a limited clip on textured surfaces: SurfaceClipper.

This transformer will clip mostly horizontal surfaces using a 2D polygon boundary, and so is best for ground surfaces. It recalculates the texture coordinates on the clipped faces to retain the original appearances. It also retains multi-level aggregate hierarchies of composite surfaces and meshes.


I have created an FME Hub transformer to perform a limited clip on textured surfaces: SurfaceClipper.

This transformer will clip mostly horizontal surfaces using a 2D polygon boundary, and so is best for ground surfaces. It recalculates the texture coordinates on the clipped faces to retain the original appearances. It also retains multi-level aggregate hierarchies of composite surfaces and meshes.

@daveatsafe This is really neat, but I'm finding the file sizes are blowing up and becoming unusable, a 1.67 meg file becomes 185 meg and I can't get it back down. This happens after the Deaggregator annotated 'Break up composites into faces', any thoughts or options?


@daveatsafe This is really neat, but I'm finding the file sizes are blowing up and becoming unusable, a 1.67 meg file becomes 185 meg and I can't get it back down. This happens after the Deaggregator annotated 'Break up composites into faces', any thoughts or options?

I narrowed this down to the SharedItemIDSetter'ers, I suspected it was copying the full texture files in each time, running a sampler to only run this transformer once per input file it appears to be the case, file size was about right for untextured fme-fbx file + texture file and the model was fully textured. Not entirely sure how the SharedItemIDSetter were working actually, as I had 42k faces, and it didn't copy the textures in 42k times...


I narrowed this down to the SharedItemIDSetter'ers, I suspected it was copying the full texture files in each time, running a sampler to only run this transformer once per input file it appears to be the case, file size was about right for untextured fme-fbx file + texture file and the model was fully textured. Not entirely sure how the SharedItemIDSetter were working actually, as I had 42k faces, and it didn't copy the textures in 42k times...

Hi @stevenjh,

Hmmm, I used the SharedItemIDSetter to avoid having multiple copies of the raster being stored. I do think it needs to be run on each face in order to properly set the texture coordinates using the texture generation parameters, though.

In my test dataset, I got 1M appearances, but all pointing to the same raster. It seems I may need to tweak this. What format are you writing to?


@daveatsafe This is really neat, but I'm finding the file sizes are blowing up and becoming unusable, a 1.67 meg file becomes 185 meg and I can't get it back down. This happens after the Deaggregator annotated 'Break up composites into faces', any thoughts or options?

Hi @stevenjh,

OK, I've tweaked the way the textures are replaced on the faces to avoid the file size growth. My test data outputs in FBX, OBJ and Sketchup show only a single texture being output.

Please try the latest version (you may need to Refresh your transformers in Workbench), and let me know if the problem is fixed for your dataset.


Hi @stevenjh,

OK, I've tweaked the way the textures are replaced on the faces to avoid the file size growth. My test data outputs in FBX, OBJ and Sketchup show only a single texture being output.

Please try the latest version (you may need to Refresh your transformers in Workbench), and let me know if the problem is fixed for your dataset.

Tried the latest and found I had missing textures on my model. Do you want my files/ workbench for testing? They're fbx from Context Capture.


Tried the latest and found I had missing textures on my model. Do you want my files/ workbench for testing? They're fbx from Context Capture.

Yes, please! I want to fix any problems before too many people start using it.

You can send them to me direct:


I have created an FME Hub transformer to perform a limited clip on textured surfaces: SurfaceClipper.

This transformer will clip mostly horizontal surfaces using a 2D polygon boundary, and so is best for ground surfaces. It recalculates the texture coordinates on the clipped faces to retain the original appearances. It also retains multi-level aggregate hierarchies of composite surfaces and meshes.

Brilliant! This is one of our most wanted new transformers. I have had a go at making a node like this several times and keept banging my head against the wall. Is there any chance of cutting down the texture to include only what is needed for the new mesh?


Brilliant! This is one of our most wanted new transformers. I have had a go at making a node like this several times and keept banging my head against the wall. Is there any chance of cutting down the texture to include only what is needed for the new mesh?

Hi @karnil,

That might be tricky, since the texture generation parameters that are used to regenerate the texture coordinates on the clipped faces would also need to have their U and V values modified to fit the clipped image.

There is also a possibility that the texture image is shared amongst surfaces to be clipped and surfaces that are not, so modifying the image would mess up the unclipped surfaces.

If you want to play with this, the texture generation parameters are described at http://docs.safe.com/fme/2019.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/appearanceextractor.htm.


Reply