Bug 140321 - Fontwork: Change in surface has no effect
Summary: Fontwork: Change in surface has no effect
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Regina Henschel
URL:
Whiteboard: target:7.3.0 inReleaseNotes:7.3
Keywords:
Depends on:
Blocks: FontWork-WordArt
  Show dependency treegraph
 
Reported: 2021-02-10 17:26 UTC by Aron Budea
Modified: 2022-01-24 12:06 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2021-02-10 17:26:39 UTC
When enabling Toggle Extrusion in Fontwork toolbar, and changing Surface on a Fontwork object, the following three surfaces show no difference:
Matt, Plastic, Metal.
(Wireframe is different)

I'm not sure how each of those should look, but I assume they shouldn't look the same.

Observed in LO 7.2.0.0.alpha0+ (066799b4a162aa0a4bc6aa28339f1f943a13971e), 3.3.0 / Ubuntu.
Comment 1 Fred Olness 2021-03-09 23:10:58 UTC
Can you list the steps to reproduce, and maybe add a png clip. Thanks.
Comment 2 Xisco Faulí 2021-03-10 09:05:02 UTC
Reproduced in

Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: 3dfe1df0f1084b06c7d4c95df387253b2e058cd6
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

@Regina, any opinion here ?
Comment 3 Regina Henschel 2021-03-10 10:15:24 UTC
It was never implemented, see https://bz.apache.org/ooo/show_bug.cgi?id=98334 and https://bz.apache.org/ooo/show_bug.cgi?id=67765.

If implementing, then we should use the presets of OOXML.
Comment 4 Regina Henschel 2021-03-18 00:03:37 UTC
It seems, that this four materials correspond to the OOXML material presets legacyMatte, legacyMetal, legacyPlastic and legacyWireframe, which are specified in section 20.1.10.50 ST_PresetMaterialType (Preset Material Type) in ISO/IEC 29500-1:2016(E). But in case someone really wants to implement it, I suggest to use material presets, which are currently available in the UI of MS Office.
Comment 5 Regina Henschel 2021-10-29 23:42:51 UTC
ODF 1.3 has an exact definition for "draw:extrusion-metal":
"   •false: the specular color for the shading of an extruded shape is white. 
    •true: the specular color for the shading of an extruded shape is gray (red green and blue values of 200) instead of white and 15% is added to the specularity." 

https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part3-schema/OpenDocument-v1.3-os-part3-schema.html#attribute-draw_extrusion-metal
Comment 6 Regina Henschel 2021-10-31 15:14:55 UTC
We cannot make it the same as in MS Office, because that would need to set the specular color equal to the fill color. But ODF allows only white(255,255,255) or in case of Metal gray(200,200,200). But at least we can render it matte and apply the ODF values in case of Metal.

This does not only effect FontWork, but extrusion of other custom shapes too.
Comment 7 Regina Henschel 2021-11-04 18:40:19 UTC
First version of a patch is now in Gerrit
https://gerrit.libreoffice.org/c/core/+/124720

Here some details about the changes:

Changes to EnhancedCustomShape3d::Create3DObject():

Value 'false' of attribute 'FirstLightHarsh' and case 'matte' are now
rendered correctly although in the 3D engine the first light is always
specular. For that I use the forth light instead of the first light,
because the forth light cannot be specular in the 3D engine. The forth
light cannot be used in ODF custom shape extrusion, so there should be
no conflict.

ODF specifies specular color 'white' in case of value 'false' of
attribute 'metal'. So I have changed 225->255. In addition, this makes
the distance to value 'true' larger, for which ODF specifies
gray(200,200,200).

MS Office uses specular Color = fill color in case of surface 'matte'
and 'metal'. That is not possible for ODF because ODF specifies 'white'
or gray(200,200,200) respectively. So getting exact the same rendering
is not possible.

MS Office adds black to diffuse and ambient color in case of surface
'metal'. I have reduced fAmbientIntensity and fLight2Intensity by an
-arbitrary- amount to get rendering nearer to MS Office in that case.

Line: sal_Int32 nIntensity = static_cast<sal_Int32>(fSpecular) * 100;
should have been:
sal_Int32 nIntensity = static_cast<sal_Int32>(fSpecular * 100);
Otherwise you get always nIntensity=0 because fSpecular is in [0;1].
The fix avoids '/100' then '*100' at all.

If PowerPoint exports an ppt-file to odp, it sets shade mode to
'gouraud'. That gives rendering without steps. With the patch rendering
is no longer forced to 'flat'. Besides keeping the setting when using
the extrusion bar, it is necessary to use normal kinds other than
'flat'.

Changes to extrusionbar.cxx:

In consequence of now rendering value 'false' of property
'FirstLightHarsh', I have removed forcing property 'FirstLightHarsh'
to 'true' from SID_EXTRUSION_LIGHTING_INTENSITY.

If have removed forcing 'LightFace' to 'true' from
SID_EXTRUSION_LIGHTING_INTENSITY. That value is nowhere evaluated and
default value in ODF and in MS Office is 'true', so no need to be set
explicitely.

I have changed property 'SecondLightHarsh' to be always 'false' in
SID_EXTRUSION_LIGHTING_INTENSITY. The second light harsh is always
'false' in the 3D engine, but the ODF default value is 'true', so we
need to write it out as 'false'.

I have changed SID_EXTRUSION_SURFACE so that values of 'Specularity'
are kept. Only when changing to 'plastic' or 'metal', a value of 0 is
replaced by value 80. The previous value 122 was wrong, because the
data type is zeroToHundredPercent in ODF. The value 80 is freely
chosen. It tries to get rendering near to MS binary formats.

I have removed changes to the property 'Diffusion' from
SID_EXTRUSION_SURFACE. The property 'Diffusion' is read or set in
import/export with MS binary formats. But it is nowhere evaluated and
its purpose is unclear.
The ODF meaning is: 'The draw:extrusion-diffusion attribute specifies
the amount of diffusion reflected by a shape.' Default value is 0% in
ODF. The old value 122 is questionable, because the data type is
percent in ODF.
The meaning in binary MS Office is: 'DFF_Prop_c3DDiffuseAmt specifies
the ratio of incident to diffuse light that is reflected on a shape.
The default value for this property is 0x00010000.' (16.16 fixpoint).
The 3D engine has no attribute to use it directly.
Comment 8 Commit Notification 2021-11-06 14:36:45 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/70a4cb766ed356bc17433ac1673e977bb0bf3d2f

tdf#140321 enable 'matte', 'metal' extrusion surface

It will be available in 7.3.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 9 Regina Henschel 2021-11-06 14:44:22 UTC
There are no tests yet because it is not clear, how to write a test for rendering of 3D. Any help is welcome. https://lists.freedesktop.org/archives/libreoffice/2021-November/088005.html
Comment 10 Mike Kaganski 2021-11-12 15:55:59 UTC
https://git.libreoffice.org/core/+/70a4cb766ed356bc17433ac1673e977bb0bf3d2f added a test for this (a typo in the bug # made it send a commit notification to the wrong bug).

Thank you Regina!
Comment 11 Mike Kaganski 2021-11-12 15:57:05 UTC
Heh, and I followed a trend of providing wrong references ;)

https://git.libreoffice.org/core/+/87e5caca7d3133a32d92503bfa8e5a1409545187
Comment 12 Regina Henschel 2021-11-12 17:24:37 UTC
Thank you Mike.

Using the material tab should work now. Because it didn't work before, old documents might have an undesired choice in the file. Switch to 'wireframe' and 'metal', then to the desired surface and save. That should replace the wrong values in file with the correct ones.
Comment 13 Regina Henschel 2021-12-16 21:12:59 UTC
(In reply to Regina Henschel from comment #12)
> Switch to 'wireframe'
> and 'metal', then to the desired surface and save. That should replace the
> wrong values in file with the correct ones.

Correction: Switch to "Matt" and then to the desired surface.
Comment 14 Stéphane Guillou (stragu) 2022-01-24 12:06:05 UTC
verified as fixed in:

Version: 7.3.0.2 / LibreOffice Community
Build ID: f1c9017ac60ecca268da7b1cf147b10e244b9b21
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded