Office has the abilty to insert 3D models and to create 3D shapes. Both of these using lighting, but the Office interface does not include any lighting controls. To change 3D lighting, you have to hack the XML.
There is very little documentation online for 3D lighting in OOXML aside from the Microsoft pages at 2.31 http://schemas.microsoft.com/office/drawing/2017/model3d. The am3d element that represents 3D models does not appear in the older ECMA-376 reference that defines the Office file formats. ECMA 376 has been superceded by ISO/IEC 29500-1:2016.
When a 3D model is inserted in an Office document, the model file is storeed in the media subfolder, along with a PNG rendering of the view of the model when the document was saved. The PNG is displayed when the document is re-opened and serves as a fallback image when the file is viewed in an earlier version of Office that doesn’t support 3D models.
The rendering information for the model is stored in the document, not in the embedded model file. In Word, the rendering information is stored in word/document.xml. In PowerPoint, it is kept in ppt/slides/slideX.xml, where X is the slide index number. In Excel, look xl/drawings/drawingX.xml.
3D models use scrgbClr parameters for lighting color with numbers expressed in a percentage. But unlike scrgbClr elsewhere in Office, the syntax is not r=”50%” g=”50%” b=”50%”. Instead, use whole numbers with three zeros added, so 50% becomes 50000: <a:scrgbClr r=”50000″ g=”50000″ b=”50000″/>
Here is a typical lighting section for a 3D model or shape:
<am3d:ambientLight> <am3d:clr> <a:scrgbClr r="50000" g="50000" b="50000"/> </am3d:clr> <am3d:illuminance n="500000" d="1000000"/> </am3d:ambientLight> <am3d:ptLight rad="0"> <am3d:clr> <a:scrgbClr r="100000" g="75000" b="50000"/> </am3d:clr> <am3d:intensity n="9765625" d="1000000"/> <am3d:pos x="21959998" y="70920001" z="16344003"/> </am3d:ptLight> <am3d:ptLight rad="0"> <am3d:clr> <a:scrgbClr r="40000" g="60000" b="95000"/> </am3d:clr> <am3d:intensity n="12250000" d="1000000"/> <am3d:pos x="-37964106" y="51130435" z="57631972"/> </am3d:ptLight> <am3d:ptLight rad="0"> <am3d:clr> <a:scrgbClr r="86837" g="72700" b="100000"/> </am3d:clr> <am3d:intensity n="3125000" d="1000000"/> <am3d:pos x="-37739122" y="58056624" z="-34769649"/> </am3d:ptLight>
The first section is am3d:ambientLight that controls the ambient (background directionless) light. Set the color with am3d:clr and the intensity with am3d:illuminance. The illuminance n and d parameters represent the numerator and denominator of a ratio. So the default values of n=”500000″ d=”1000000″ are equivalent to 1/2 or 50% brightness.
After that, the are three point lights (am3d:ptLight). You don’t have to use all three. You can delete them from the XML, comment them out or use the enabled parameter to turn them off:
<am3d:ptLight rad="0" enabled="false">
The rad parameter sets the radius of the light. The units are EMUs (English Metric Units), where 1 inch has 914,400 EMUs and 1 centimeter equals 360,000 EMUs. Set this number in the millions to have a noticeable effect.
You can also add more point lights, but usually three is enough. The color and intensity parameters work the same way as the ambient light.
The other major parameters are for the position of the lights. The left-right position is set by the x number. 0 is dead center, positive numbers move the light to the right and negative numbers to the left. The y number controls the position up and down, while z controls the in-out third dimension. This line would place the light inside the model:
<am3d:pos x="0" y="0" z="0"/>
The pos units are also EMUs. Use tens of millions to notice the effect.
After making changes to the XML and re-opening the presentation with the model, the appearance will be the same as before you edited it. This is because PowerPoint displays a PNG of the model, created when you save. To display the revised lighting, you must make a small change to the model so PowerPoint updates the appearance.
This is amazing, John.
Thanks!
hi GREAT!
But please where can i find the file – slideX.xml
Thanks
As mentioned in the article: “In PowerPoint, it is kept in ppt/slides/slideX.xml, where X is the slide index number.” So if the model is on slide 2, look in ppp/slides/slide2.xml.>/p>