View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0031988 | Community | OCCT:Visualization | public | 2020-12-09 11:02 | 2023-08-07 15:52 |
Reporter | Vico Liang | Assigned To | bugmaster | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | duplicate | ||
Target Version | Unscheduled | ||||
Summary | 0031988: Visualization - use Quantity_ColorRGBA as background rather than Quantity_Color to support alpha channel | ||||
Description | The current implement uses Quantity_Color as input in class V3d_View void V3d_View::SetBackgroundColor (const Quantity_Color& theColor) But the storage field is in class Graphic3d_CView: Quantity_ColorRGBA myBgColor; OpenGL actually uses the alpha value, occt set the alpha value to 0 as below: glClearColor (aBgColor.r(), aBgColor.g(), aBgColor.b(), 0.0f); It means the color is full transparent, it will cause blending. The blending result is very hard to predictable especially using with external GUI such as QT. It would be nice to have an option to set the alpha channel by user. Method SetBgGradientColors have the same issue. void V3d_View::SetBgGradientColors (const Quantity_Color& theColor1, const Quantity_Color& theColor2, const Aspect_GradientFillMethod theFillStyle, const Standard_Boolean theToUpdate) | ||||
Tags | No tags attached. | ||||
Test case number | |||||
|
The idea of providing an alpha component option within viewer background color has appeared in the past. However, in practice such API would produce only confusion, as apart from background, alpha values are also written by rendering semi-transparent objects. The option proposed by a patch for 0031597 is expected to handle both issues and ensure 3D Viewer content is rendered opaque even if color buffer contains alpha component. |
|
Dear bugmaster, please close the issue as duplicate of 0031597. Dear Vico, consider reopening the issue in case if 0031597 doesn't fulfill your needs. |
|
Dear Kirill, Issue 0031597 provides option to enable or diable alpha component, it can't change the alpha value even if the alpha channel is enabled. So these two issues are different. I insist to open this issue. This will allow user to control the alpha value not only enable or disalbe the option. |
|
> it can't change the alpha value even if the alpha channel is enabled I see no meaning of setting a non-opaque alpha to the background color - what is expected result for it? |
|
>>I see no meaning of setting a non-opaque alpha to the background color The blending algorithm will use the alpha value if setting so. OpenGL will generate different result. |
|
Dear Vico, > The blending algorithm will use the alpha value if setting so. > OpenGL will generate different result. There are the following use cases: 1. Alpha color writes are disabled. Background is filled in as fully opaque in case of RGBA buffer. Opaque and Translucent objects fill in pixels with opaque color - alpha values are used for blending but not written into result frame buffer. RESULT: image is opaque, transparent of semitransparent objects is pre-multiplied with background. 2. Alpha color writes are enabled. Background is filled in as fully transparent. Opaque object fills corresponding pixels with opaque color. Translucent object fills pixels with semitransparent color (last drawn object overrides alpha values). RESULT: image will contain two semitransparent regions: original background and translucent objects. Note that the alpha component for latter ones will be incorrect - as color is already blended with background, applying transparency second time will make result more transparent. Allowing to set arbitrary transparency to background color will reveal two more scenarios: 3. Alpha color writes are disabled. Background is filled in as semitransparent color. Opaque and translucent objects will not write alpha values into frame buffer. RESULT: the whole image will have a uniform semitransparent alpha that was defined for background. 4. Alpha color writes are enabled. Background is filled in as semitransparent color. Opaque object fills corresponding pixels with opaque color (override background). Translucent object fills pixels with semitransparent color (last drawn object overrides alpha values). RESULT: image will contain two semitransparent regions: original background (now semitransparent, not fully transparent) and translucent objects. |
|
The 3rd case looks dubious to me, as if application wants to blend 3D Viewer content with some other background uniformly - there should be more straightforward ways to do it in specific engine, where 3D Viewer is integrated into. The 4th case looks not very practical as 2nd case - it would just allow to avoid fully transparent background color. Which use case do you actually see in your scenario? Note that there might be a 5th use case with expected behavior: background is (semi)transparent, opaque and transparent objects fill in alpha as opaque (e.g. overrides background alpha, but transparent objects write color as opaque). But this is technically not implementable in current design. |
|
Dear Kirill, Wow, you really surprised me. I just think that there are different blending functions in OpenGL intenral. I don't consider the details as your described. From your described senarios, it's worthwhile to have this alpha channel controlable from user input, right? I'd like to see the surprised rendering result when this feature is available. |
|
Dear @bugmaster please close the issue |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-12-09 11:02 | Vico Liang | New Issue | |
2020-12-09 11:02 | Vico Liang | Assigned To | => kgv |
2020-12-09 11:11 | kgv | Relationship added | related to 0031597 |
2020-12-09 11:12 | kgv | Summary | use Quantity_ColorRGBA as background rather than Quantity_Color to support alpha channel => Visualization - use Quantity_ColorRGBA as background rather than Quantity_Color to support alpha channel |
2020-12-12 13:17 | kgv | Note Added: 0097529 | |
2020-12-12 13:18 | kgv | Note Edited: 0097529 | |
2020-12-12 13:18 | kgv | Note Edited: 0097529 | |
2020-12-21 15:18 | kgv | Relationship added | related to 0031964 |
2020-12-21 15:19 | kgv | Note Added: 0097833 | |
2020-12-21 15:19 | kgv | Assigned To | kgv => bugmaster |
2020-12-21 15:19 | kgv | Status | new => feedback |
2020-12-21 15:19 | kgv | Resolution | open => duplicate |
2020-12-21 18:10 | Vico Liang | Note Added: 0097842 | |
2020-12-21 18:11 | Vico Liang | Assigned To | bugmaster => kgv |
2020-12-21 18:12 | Vico Liang | Note Edited: 0097842 | |
2020-12-21 19:47 | kgv | Note Added: 0097847 | |
2020-12-21 19:48 | kgv | Assigned To | kgv => Vico Liang |
2020-12-22 10:28 | Vico Liang | Note Added: 0097855 | |
2020-12-22 10:49 | kgv | Note Added: 0097858 | |
2020-12-22 10:54 | kgv | Note Added: 0097859 | |
2020-12-22 18:43 | Vico Liang | Note Added: 0097868 | |
2020-12-23 08:30 | Vico Liang | Assigned To | Vico Liang => kgv |
2021-09-20 11:08 | kgv | Target Version | 7.6.0 => 7.7.0 |
2022-08-17 11:55 | kgv | Target Version | 7.7.0 => 7.8.0 |
2022-10-19 15:49 |
|
Assigned To | kgv => vpozdyayev |
2023-08-02 02:11 | dpasukhi | Assigned To | vpozdyayev => bugmaster |
2023-08-02 02:11 | dpasukhi | Target Version | 7.8.0 => Unscheduled |
2023-08-02 02:11 | dpasukhi | Note Added: 0113836 | |
2023-08-07 15:52 | vglukhik | Status | feedback => closed |