question

AliSafe-1138 avatar image
0 Votes"
AliSafe-1138 asked MikeBowen-1599 answered

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

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?!




openspecs-office-fileformats
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello Alisafe-1138, thank you for your question regarding Microsoft Open Specifications. One of our team members will contact you soon to assist you with this question.


Regards,
Sreekanth Nadendla
Microsoft Windows Open Specifications

0 Votes 0 ·

Hi @AliSafe-1138 ,

I will look into this for you. One question, when you say you reset the model from PowerPoint, do you mean you remove the zoomed GLB then, re-add the original GLB file to the PPT and re-save the PPT file with PowerPoint?

Thanks!

Michael Bowen
Escalation Engineer - Microsoft Open Specifications

0 Votes 0 ·

Hi @MikeBowen-1599

Thanks for your reply, No, I mean resetting the model by selecting the model and pressing Reset Model Button in the 3d Model ribbon.

I want to generate the XML content for model 3d, the method mentioned in the comments of this question. I can have other parameters for xml tags some of them are default and some others are in my GLB model, but the value of this parameter is question for me. I think this is an engine-based parameter, because I can see difference in its value when the mesh coordinate of models change in scale.

Sorry for asking another question but this is a related and more general question:
Is there any function in Open XML to generate the XML content(Scene/Model Parameters) and parts(Fallback Image) for a 3d model?
I know about the FeedExtendedPart to feed the model3d relationship part but couldn't find a way to generate the fallback image of model.

Thanks!


0 Votes 0 ·
MikeBowen-1599 avatar image
0 Votes"
MikeBowen-1599 answered MikeBowen-1599 commented

Hi @AliSafe-1138 ,

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



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

HI @AliSafe-1138 ,

I wanted to add that for the Open-XML-SDK, while it doesn't currently have a method to generate the fallback image for a 3D model, please feel free to add a feature request to the Open XML SDK issues page, for a possible future release.

Best,

Michael


0 Votes 0 ·
AliSafe-1138 avatar image
0 Votes"
AliSafe-1138 answered MikeBowen-1599 commented

Hi @MikeBowen-1599, 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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AliSafe-1138 ,

Thanks for the response. I will keep investigate more and try your example from KhronosGroup glTF.

For your examples. What values do you expect for the numerator and denominator?

Best,

Michael

0 Votes 0 ·
MikeBowen-1599 avatar image
0 Votes"
MikeBowen-1599 answered

Hi @AliSafe-1138 ,

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.