How PowerPoint 3D engine calculate scaling factor of 3D models (am3d:meterPerModelUnit)

Ali Safe 21 Reputation points
2021-12-19T17:01:03.607+00:00

I want to add some 3D models into PowerPoint presentation using OpenXML and C#, in order to generate proper XML tags, I drag GLB files into an empty presentation, then extract its XML contents. There are so many parameters with am3d tag, and I know about them, except the meterPerModelUnit parameter:

<am3d:meterPerModelUnit n="8069447" d="1000000"/>

When I increase this number (and save and zip again) the model will be zoomed in and when I decrease it the model will be zoomed out in the presentation file. Also when I reset the model from PowerPoint the value will be reset automatically to this constant number for my specific model.

According to microsoft office model 3d schema, this is the scaling factor used in GLB file but I couldn't figure out the mathematics behind this ratio calculation in 3D Models and/or in the PowerPoint 3D Engine.
My question is how the meterPerModelUnit parameter is calculated when the model is inserted in PowerPoint?!

Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
138 questions
{count} votes

Accepted answer
  1. Mike Bowen 1,781 Reputation points Microsoft Employee
    2021-12-21T23:40:50.027+00:00

    Hi @Ali Safe ,

    Thanks for answering my question. I looked into how the scaling is calculated for 3D models and we calculate this unit scale factor as 1.0 / (2.0 * max3DExtentsOnAnyAxis). The “extents” are the {x,y,z} dimensions of the 3D model scene, in the scene’s original orientation. 3D models can have wildly different internal units, so this scaling value can be very different based on how the model was authored.

    When we write out this float number as a fraction, we just multiply the numerator by 1000000, and then reduce the n and d terms by common max divisible value.

    Regarding the question about the SDK, I’m not sure what FeedExtendedData refers to. Are you referring to extendedPart1.FeedData(data);? But, as far as generating the fallback image of a 3D model, you would have to code that yourself using the c# types that wrap those elements.

    159475-microsoftteams-image-1.png

    Please let me know if that answers your question.

    Best!

    Michael


2 additional answers

Sort by: Most helpful
  1. Ali Safe 21 Reputation points
    2022-01-04T22:04:11.607+00:00

    Hi @Mike Bowen , Sorry for late reply.

    Thanks for your answers and information. It was very helpful. I've tested the formula with a simple minimal triangle model from the KhronosGroup glTF tutorials. I think the multiplication of 2.0 in the denominator doesn't make sense with the numbers I get from PowerPoint.

    Triangle Points: (0,0,0)(0,1,0)(1,0,0) --> max3DExtentsOnAnyAxis = 1.0 ===> <am3d:meterPerModelUnit d="1000000" n="1000000"/>
    Triangle Points: (0,0,0)(0,0.1,0)(0.1,0,0) --> max3DExtentsOnAnyAxis = 0.1 ===> <am3d:meterPerModelUnit d="1000000" n="9999999"/>
    Triangle Points: (0,0,0)(0,0.01,0)(0.01,0,0) --> max3DExtentsOnAnyAxis = 0.01 ===> <am3d:meterPerModelUnit d="1000000" n="100000002"/>

    Yes I was trying to find some ways to generate fallback image using Open XML SDK, but failed.


  2. Mike Bowen 1,781 Reputation points Microsoft Employee
    2022-01-05T19:53:32.707+00:00

    Hi @Ali Safe ,

    I looked into this and the am3d:meterPerModelUnit scale factor is used to scale the model to a standardized 1x1 unit space, so as the dimensions of the model get smaller, the scaling factor should grow proportionally.

    For the first triangle, model size is 1.0, so the scaling factor is 1000000/1000000 = 1.0.
    For the second triangle, model size is 0.1, so scaling factor is 9999999/1000000 = 10.0 (rounding up).
    For the third triangle, model size is 0.01, so scaling is 1000000/1000000 = 100.0 (rounding down).

    Best,
    Michael

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.