UE5 Plugin - STEP to GLB with 7.9.0 Beta

I successfully integrated OCCT 7.9 to Unreal Engine 5. My goal is implementing runtime STEP and IGES importer. But it can't be done in a short time (collision, materials, hierarchy).

So, if I can convert STEP to GLB, it will solve our problems in short term beacuse UE5 has very powerfull GLB runtime importer.

I created this function but gltfWriter.Perform() returns false.
Gist

I attached my step file from GrabCAD. I can get all components names and print them.
Is there any suggestion ?

Attachments: 
Dmitrii Pasukhin's picture

Hello. GLTF data format required Tessellation. Please tesselate the XCAF.

  // collect document roots into temporary compound
  Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(theXdeDoc->Main());

  TDF_LabelSequence aRootLabels;
  aShapeTool->GetFreeShapes(aRootLabels);

  TopoDS_Compound aCompound;
  BRep_Builder    aBuildTool;
  aBuildTool.MakeCompound(aCompound);
  for (TDF_LabelSequence::Iterator aRootIter(aRootLabels); aRootIter.More(); aRootIter.Next())
  {
      const TDF_Label& aRootLabel = aRootIter.Value();
      TopoDS_Shape aRootShape;

      if (XCAFDoc_ShapeTool::GetShape(aRootLabel, aRootShape))
      {
          cout << "Build tool add a compound." << endl;
         aBuildTool.Add(aCompound, aRootShape);
      }
  }

  // perform meshing

  BRepMesh_IncrementalMesh anAlgo;
  //anAlgo.ChangeParameters(). Deflection = ...;
  anAlgo.ChangeParameters().Angle      = ...;
  anAlgo.ChangeParameters().InParallel = true;
  anAlgo.SetShape (aCompound);
  anAlgo.Perform();

Additionally, OCCT have support for USD Import/Export as a part of commercial component. And if you will need any OCCT bug fixes or improvements, OCCT3D offer that service. And extra "technical consultihg" to guides you with OCCT. https://occt3d.com/services/bug-corrections-and-improvements/

Best regards, Dmitrii.

Eray Ozer's picture

Hi, thank you very much for your quick response.
I tried your suggestion but gltfWriter.Perform() still gives false.
I disabled Visualization, USE_D3D, USE_DRACO, USE_RAPIDJSON in CMake while building it. Maybe this cause the error ?

USD is nice-to-have feature for us because UE5 doesn't support it as cross platform. So, we can't import USD models in for example Meta Quest.

For commercial support, thank you very much for pointing out. As a startup, we can't afford commercial supports in the mean time but when our requirements and customers are increased (for example DMU viewing, mesh fixing), we will absolutely get one including commercial license for native extension such as Parasolid, IAM, SLDASM.

Dmitrii Pasukhin's picture

GLTF will not work without USE_RAPIDJSON. Please turn it back. I assume you are having warnings in logs about that.

Best regards, Dmitrii.

Eray Ozer's picture

Thank you very much. I enabled USE_RAPIDJSON and DRACO. Right now I can export GLB files without problem.
Only problem is using Shared library. If we need to use DLL files, using them as Delayed Load is the best practice for us. But somehow it generates fatal error.
I moved them to plugin's Binaries folder and it worked. I can use it as Static library, too but Epic's EULA prohibits to use LGPL library as static.

Dmitrii Pasukhin's picture

Hello, nice to hear, that it is working. Beta2 will have 2 fixes around gltf and will be published on 10.02. The stable release on 17.02.25.

OCCT offers purchasing for LGPL exception to avoid that type of limitations. I guess as soon it will have high business impact, it can be helpful.

Best regards, Dmitrii.