0

Since windows 10 Fall Creator update you can add 3D models directly into PowerPoint presentations.

I have been using OpenXML to create PowerPoint documents programmatically, however I couldn't find a way to add a 3D model to a PowerPoint document. Anyone knows how to achieve that?

As Steve suggested in the comments I have created an empty pptx file with only a 3D model and unzip it to see the content.

In the content there is a subfolder called media which the 3D content is located with the name "model3d1.glb". However the 3D content is automatically converted from the format that I have used (.3mf) to (.glb). It seems that powerpoint automatically converts all the supported formats to GL Transmission Format.

My question: Is it possible to avoid the conversion?

Lion King
  • 495
  • 5
  • 14
  • 3
    In Powerpoint, create a plain presentation with no content, save it as PPTX. Add a 3D model to it, save again under a new name. Unzip both and compare the XML contents. That should at least point you in the right direction. – Steve Rindsberg Jul 20 '20 at 13:58
  • @SteveRindsberg Thanks for suggestion. Based on tha tI have updated the question. Could you please have a look. – Lion King Aug 14 '20 at 09:52
  • 1
    I'm afraid the latest question's over my pay grade. It deals with the internals of PowerPoint, something only the developers could comment on. IIRC, PPT's always done something similar with images; done a one-way conversion at import-time to one of the formats that the app internally supports (JPG, PNG, BMP, EMF, WMF). – Steve Rindsberg Aug 14 '20 at 18:55

1 Answers1

0

First of all, you may find out that you should wrap a AltertanativeContent in OOXML, it contains 2 parts, Choice for rendering 3D Model, and Fallback as an image demonstrator of the Model.

Second of all you can fill the Fallback elements easily by wrapping OOXML elements. But for the Choice element, you should create an OpenXMLUnknowElement and fill it with the OpenXMLAttributes. For example you should have an OpenXMLUnknowElement for Camera, Lights, Translation Objects and so on...

I've found out some heuristics which helps me to cope with the solution, While it's not a complete solution but it's a good way to go.

  1. The Lights in all 3D scenes in PowerPoint have same values so you can use them exactly from a simple file:)
  2. You can use default Camera, or calculate the distance of Camera using this answer.
  3. For meterPerModelUnit scaling factor, After reading and parsing your 3D Model using some available packages, such as Microsoft GLTF or Khronos gltf Loader , you can calculate it easily using this & this. The formula is 1 / (2 * MaxExtentsOnXYZ) or 1 / MaxExtentsOnXYZ.
  4. It's a hard task to generate the Fallback image and if you use some arbitrary images the user should click on it to reload the scene. Consider that there may be a feature release in the future for this issue, But I've found that by Feeding the part using an Image with lower dimension of the Extents of the shape box, PowerPoint will automatically bring you the 3D rendered Model, I don't know whether it's a bug or an intended feature.
  5. Another way to automatically go to the 3D rendered scene is using Skinned Skeletal Animations. I can't figure out a simple method to do it, But I think it's a feasible solution. Remember that as Microsoft 3D Models Guideline stated, other types of animation (Rotations, ...) are not supported in current version of PowerPoint.
  6. I also couldn't figure out how to calculate the PreTrans, as it's essential to have a center-oriented object.

For your second questions, I think GLB is the standard way of transporting 3D Model files. Also as Todd Main suggested to me, you can ask directly from Microsoft Open Specs Q&A

Ali Safe
  • 11
  • 2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31111418) – Filburt Feb 26 '22 at 11:13
  • @Filburt: Thanks for you review, I got your point and will update my answer with more details about the solution ASAP. Anyway, this in one of my first times answering questions here, and I'm not familiar with the culture. I wanted to add just a comment for question but I didn't have enough reputation. – Ali Safe Feb 27 '22 at 08:49