Bug 145700

Summary: FiLEOPEN DOC lighting direction has inverted z-direction for extruded custom shapes
Product: LibreOffice Reporter: Regina Henschel <rb.henschel>
Component: LibreOfficeAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: zcrhonek
Priority: medium    
Version: 6.4 all versions   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
Whiteboard: target:7.4.0
Crash report or crash signature: Regression By:
Attachments: negative z-coordinate of light
positive z-coordinate of light
compare case negative
compare positive
rtf source for case negative
rtf source for case positive
Proof, that z-axis points towards observer
Test file with non-default settings as mentioned in previous attachment
Test file in doc format, so that you can open it directly in LO

Description Regina Henschel 2021-11-15 14:45:56 UTC
Created attachment 176263 [details]
negative z-coordinate of light

Open the attached documents in Word and in LibreOffice. Notice, that the maximum of the lighting is at different positions.
The problem is, that Word interprets a positive z-direction of the light as being a light coming from the side of the observer. But LibreOffice interprets a positive z-direction as coming form the opposite side.

Unfortunately neither [MS-ODRAW] nor ODF specify the orientation of the z-axis in the coordinate system of an extruded custom shape. Therefore an immediate fix is not possible. We might need to change the model for ODF or the import/export filter.
I currently try to clarify it:
https://docs.microsoft.com/en-us/answers/questions/625631/3d-coordinate-system-orientation-in-office-drawing.html
https://lists.oasis-open.org/archives/office/202111/msg00016.html
Comment 1 Regina Henschel 2021-11-15 14:46:32 UTC
Created attachment 176264 [details]
positive z-coordinate of light
Comment 2 Regina Henschel 2021-11-15 14:47:07 UTC
Created attachment 176265 [details]
compare case negative
Comment 3 Regina Henschel 2021-11-15 14:47:37 UTC
Created attachment 176266 [details]
compare positive
Comment 4 Regina Henschel 2021-11-15 14:55:39 UTC
Created attachment 176267 [details]
rtf source for case negative

I have used the attached rtf document, to create the doc files. An rtf document has a human readable source and so allows to set values directly.
To get a suitable rtf document start with a new document in Word, insert a custom shape -here a circle- and save it to rtf format. That converts the circle to a shape compatible with the MS binary formats. You then get an UI in Word, which has the similar settings than the "3D Settings" dialog in LibreOffice.
Then I have used Word to generate the doc files.

Import of extruded shapes in a rtf document is not implemented in LibreOffice. Therefore a direct compare of the rtf documents is not possible.
Comment 5 Regina Henschel 2021-11-15 14:56:17 UTC
Created attachment 176268 [details]
rtf source for case positive
Comment 6 Regina Henschel 2021-12-25 00:15:49 UTC
Created attachment 177130 [details]
Proof, that z-axis points towards observer

I'm sure now, that in MS Office the z-axis points towards observer. For screenshots and calculations see the attached files.
Comment 7 Regina Henschel 2021-12-25 00:17:01 UTC
Created attachment 177131 [details]
Test file with non-default settings as mentioned in previous attachment
Comment 8 Regina Henschel 2021-12-25 00:21:32 UTC
Created attachment 177132 [details]
Test file in doc format, so that you can open it directly in LO
Comment 9 zcrhonek 2021-12-31 11:13:40 UTC
I can confirm with Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: c13db6e792cc347ffff4585f23866f195651f21f
CPU threads: 4; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded Jumbo
and Word2010
Comment 10 Commit Notification 2022-02-17 13:14:44 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/157b027c4cfca2582b1c1bdb66992560084ac008

tdf#145700 Improve lighting in extruded custom shapes

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Regina Henschel 2022-02-21 15:55:00 UTC
The here introduced invalid range for draw:extrusion-specularity is tracked in bug 147580.