We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert OBJ to 3D PDF

Hi,

We are trying to create 3D PDF from Wavefront (OBJ) file and MTL file using Aspose 3D for .Net (evaluation version). But we see that coloring information and the texture is not as of the source in the generated PDF. We are passing the below configuration in the ObjLoadOptions

  • EnableMaterials and FlipCoordinateSystem as true and pass the
  • LookupPaths of the MTL file location. And then load using Scene Object and do PDFSaveOptions. Are we missing any configuration while loading? Please let us know.

Thanks,
Siva

1 Like

@sivakp13

Please try to use the API with free 30-days temporary license. In case you still experience any issue, please share your sample files along with sample code snippet. We will test the scenario in our environment and address it accordingly.

We will evaluate with the temporary license. Our Wavefront object has reference to MTL and texture file JPG. When we convert the OBJ to 3D PDF, we dont see the texture file being used.

The code snippet is pretty straightforward:
// Initialize an object
ObjLoadOptions loadObjOpts = new ObjLoadOptions();
// Import materials from external material library file
loadObjOpts.EnableMaterials = true;
// Flip the coordinate system.
loadObjOpts.FlipCoordinateSystem = true;
// Configure the look up paths to allow importer to find external dependencies.
loadObjOpts.LookupPaths = new List(new string[] { dataDir});
Scene scene = new Scene();
scene.Open(dirPath + “sample.obj”, loadObjOpts);
PdfSaveOptions options = new PdfSaveOptions();
MemoryFileSystem mfs = new MemoryFileSystem();
options.FileSystem = mfs;
scene.Save(dirPath + “output_2.pdf”, options);
Is this option supported in Aspose 3D while conversion?

Thanks,
Siva

@sivakp13

Can you please share your sample source file in .zip format with us? We will test the scenario in our environment and address it accordingly.

Did you guys figure out how to solve this? I am having the exact same problem where there is no textures.
obj_giraffe_ball.zip (15.2 KB)
My program coverts an obj to pdf and then adds some text to a new page at the bottom from a text file.

Just to be clear I’ve attached my example program, .obj, .mtl., and my c# program in the zip file

@LawrenceAspose

Thanks for contacting support.

We need to investigate this scenario in details which is why we have logged an investigation ticket as THREEDNET-1054 in our issue tracking system. We will look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

Can I view the progress on the investigation ticket?

@LawrenceAspose

The ticket is logged in our internal issue management system. Therefore, you will not be able to access it. However, we will keep you informed about progress against its resolution. As it was recently logged, it is pending for analysis. We will investigate and resolved it on a first come first serve basis and let you know as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as THREEDNET-1054) have been fixed in Aspose.3D for .NET 22.2.

I’ve been using the evaluation version of Aspose 3d and can’t seem to get MTL files to render properly in the scene. I can render out the mesh models and use the predefined materials as well as change the colors of the materials, but the final render never has my texture applied to it, just a solid color with some basic material properties.

I went through the documentation and followed the provided steps and could not replicate the loading of the data.

Is there an example that combines objs and mtls and renders them out into some viewable form?

@rngking

Could you please share the complete sample code snippet that you have tried so far along with sample files? We will test the scenario in our environment and address it accordingly.

sure,

string inputFile = Path.Combine(inputDir, “giraffe_ball.obj”);
string matFile = Path.Combine(inputDir, “giraffe_ball.mtl”);
string outputDir = Path.Combine(inputDir, “Reports”);

// Initialize an object
ObjLoadOptions loadObjOpts = new ObjLoadOptions();
// Import materials from external material library file
loadObjOpts.EnableMaterials = true;
// Flip the coordinate system.
loadObjOpts.FlipCoordinateSystem = true;
loadObjOpts.LookupPaths = new List() { inputDir };
loadObjOpts.FileName = inputFile;

var scene = new Scene();
scene.Open(inputFile, loadObjOpts);

PdfSaveOptions pdfOpts = new PdfSaveOptions();
pdfOpts.LightingScheme = PdfLightingScheme.CAD;
pdfOpts.RenderMode = PdfRenderMode.ShadedIllustration;

scene.Save(Path.Combine(outputDir, “testing.pdf”), pdfOpts);

A link to the files can be found here

The expected behavior, at least from the vibe I’m getting, is that the obj and mtl will be loaded together and outputted into a 3dpdf scene.

Hi, I don’t if you got the correct response.

@rngking

Thanks for sharing the requested information. We have logged an investigation ticket as THREEDNET-1079 in our issue management system to analyze this case. We will further look into its details and keep you posted with the status of its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

@rngking

pdfOpts.EmbedTextures = true;

Please try add the above line before calling Save method. This is a new added property, and please make sure using the latest version.

I’ve done the requested chance and I can still see is an untextured ball.

Am I supposed to manually apply the material or is there another process that I need to go though to use mtl files?

@rngking

Thanks for sharing your feedback. We have recorded it under the earlier logged ticket and will inform you as soon as the ticket is resolved. Please give us some time.

@rngking

C:\Users\LewisL\Pictures\Saved Pictures\giraffe_close_up.jpg

Could you please provide this file?