Bug 160429 - Transparency error in Shape3DPolygonObject
Summary: Transparency error in Shape3DPolygonObject
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
24.2.0.2 rc
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-30 09:07 UTC by Kadet
Modified: 2024-04-12 16:27 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Demo files (96.47 KB, application/zip)
2024-03-30 09:12 UTC, Kadet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kadet 2024-03-30 09:07:55 UTC
Description:
When polygons are superimposed in Shape3DPolygonObject, both polygons become transparent, and the fill of the outer one disappears.

Steps to Reproduce:
1.Open the Test or Test_1 file
2.Click the "Draw" button
3.

Actual Results:
The left row of the shapes that appeared were created using the Shape3DCubeObject object. They are created correctly. The right row of shapes is created using the Shape3DPolygonObject object. They are transparent.

Expected Results:
The right row of shapes should be the same as the right row - not transparent.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
To demonstrate the problem, the Test_1 document is also attached, in which the objects created using Shape3DPolygonObject have their back and right faces removed. Scenes can be rotated and viewed from different angles using the "<" and ">" buttons (at the bottom of the scene).
Comment 1 Kadet 2024-03-30 09:12:37 UTC
Created attachment 193400 [details]
Demo files

To the Test.ods creates closed (complete) "cube" objects by drawing 6 polygons of the "square" type.
In Test_1.ods, "cube" objects are created by drawing 4 polygons of the "square" type. The back and right sides are not drawn.
Comment 2 Regina Henschel 2024-04-11 15:10:50 UTC
I have discussed the problem with Armin. (I hope that I describe his comments correctly here.)

During the way to visualization the class SdrPolyPolygonPrimitive3D is used.
There you find the comment
    SdrPolyPolygonPrimitive3D class
        This 3D primitive defines a PolyPolgon in space which may have
        Line- and FillStyles and extra 3D surface attributes. It is assumed
        that the given 3D PolyPolgon (which may contain texture and normal
        information) is planar in 3D.
        The decomposition will include all needed 3D data for visualisation,
        including FatLines and fill styles.
https://opengrok.libreoffice.org/xref/core/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx?r=dcb36da2#30

The difference between the Shape3DCubeObject and your Shape3DPolygonObject is this:
The cube-object itself divides its points into a vector of six basegfx::B3DPolyPolygon objects, where each of them is planar in 3D. But for the Shape3DPolygonObject such division is not implemented. Thus the methods of the SdrPolyPolygonPrimitive3D class get an object, were the points are not in a plane.

I see some possible ways for a solution:
(1) Changing the Shape3DPolygonObject so, that it creates a vector of plane polypolgons. I don't know how costly it is and whether it would break any internal use.
(2) Add a documentation for all of the Shape3D*-objects to the SDK API Reference, especially for the Shape3DPolygonObject, as it has no corresponding shape in the UI. Such documentation then has to contain, that all points of the Shape3DPolygonObject have to be in the same plane.
(3) Extend the implementation by a new kind of Shape3D-object, that will do the in (1) mentioned dividing in a vector of plane parts by itself.

For now, you need to build for each face of your 3D objects a separate Shape3DPolygonObject.

I set this to new, because it is really a problem. But I'm not sure whether to classify it as a bug or an enhancement request.
Comment 3 Kadet 2024-04-12 16:27:57 UTC
Thanks! A friend of Armin Legrand suggested that I use "But you can check in the C++ code what these methods do - you need to do the same thing in principle." 
There, I was also offered to make a 3DPolyPoligon-an object from a set of various flat objects.
https://ask.libreoffice.org/t/how-to-make-colored-opaque-shape3dpolygonobject/104047/9

But all this is not quite suitable for the purposes for which I make my programs.
The fact is that it is not necessary to make the 3DPolyPoligon object flat. You can make them wavy, semicircular, etc. And such objects turn out to be quite normal. The main thing is that the opposite sides do not overlap each other.
Or alternatively, put another face between the opposite sides. Then something happens too.
And "playing" with normals doesn't do anything.