Issue with "saveImage" and Parts with Transparency Nonzero

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by uwestoehr »

UR_ wrote: Mon Jan 06, 2020 6:32 am If you miss this parameter just create a new one.
Just right-click and awake context menu.
Many thanks! This works.
wmayer wrote: Fri Dec 27, 2019 12:16 pm
Werner, can this new parameter please there initially (without the need to add it manually)? Since this topic popped up already several times, it might also be nice to have this option in the preferences, or is there a reason why it should not be there?
Last edited by uwestoehr on Thu Feb 04, 2021 1:56 am, edited 1 time in total.
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by UR_ »

Perhaps available types of frame grabber (GrabFramebuffer, FramebufferObject, PixelBuffer, CoinOffscreenRenderer)
should be selectable by list box from SaveImage dialog.

Because GrabFramebuffer doesn't support other backgrounds, concerning list box should be greyed out while GrabFramebuffer is selected.
Also Height input box, because aspect ratio is fixed to that one from 3D view.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by uwestoehr »

UR_ wrote: Mon Jan 06, 2020 4:02 pm Perhaps available types of frame grabber (GrabFramebuffer, FramebufferObject, PixelBuffer, CoinOffscreenRenderer)
should be selectable by list box from SaveImage dialog.
:+1:
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by wmayer »

uwestoehr wrote: Sun Jan 05, 2020 9:01 pm So what do I have to do to get (not only PNG but also a JPG) that shows the scene exactly as I see it?
As soon as you have transparencies then you must use a file format that supports it. JPG doesn't support transparencies: https://de.wikipedia.org/wiki/Jpg#Visue ... te_Formate
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by uwestoehr »

wmayer wrote: Tue Jan 07, 2020 12:57 pm As soon as you have transparencies then you must use a file format that supports it.
It is not about transparency, it is about the image itself as I wrote.
With your new GrabFamebuffer option, the images look as I see the scene in FC and that is perfect. So all I and also UR_ want now is to have an option in the preferences to activate it. I fully agree with UR_ more detailed proposal: https://forum.freecadweb.org/viewtopic. ... 10#p358400
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by uwestoehr »

wmayer wrote: Wed Jan 08, 2020 11:51 am git commit 8e5151002
Many thanks. I will describe it in the Wiki ASAP. To do so, 2 questions:

Attached are images take with the now 4 available methods.
- What are their difference?
- the currently set default is "Offscreen (new)". But since this is the one most far away from what I actually see in FC, maybe another method should be the default.

------------------
The image dialog is a bit too large for my laptop screen -> I'll have a look the next days and make a PR.
Attachments
Framebuffer (as is)
Framebuffer (as is)
FBAS.png (50.85 KiB) Viewed 1821 times
Framebuffer (custom)
Framebuffer (custom)
FBC.png (44.89 KiB) Viewed 1821 times
Offscreen (old)
Offscreen (old)
OO.png (37.13 KiB) Viewed 1821 times
Offscreen (new)
Offscreen (new)
ON.png (30.34 KiB) Viewed 1821 times
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by wmayer »

- What are their difference?
Framebuffer (as is) = GrabFramebuffer:
If multi-sampling is off (i.e. no anti-aliasing) then it reads the image directly from the graphic renderer. If multi-sampling is on then it renders to a framebuffer and gets the image from there. The key part of this method is Qt's QOpenGLFramebufferObject class

Framebuffer (custom) = FramebufferObject:
It always uses the same technique as the latter method from above. Additionally it allows to set custom sizes and background

Offscreen (old) = CoinOffscreenRenderer:
It only uses pure Coin3d functions. The method however doesn't support multi-sampling, relies heavily on graphic driver and on many modern Linux systems it doesn't work at all any more.

It's a real off-screen rendering method that doesn't require an OpenGL window.

Offscreen (new) = default method
It's a replacement/alternative for Coin3d's off-screen rendering. Additionally it supports multi-sampling
The most important classes are Qt's QOffscreenSurface and QOpenGLFramebufferObject
- the currently set default is "Offscreen (new)". But since this is the one most far away from what I actually see in FC, maybe another method should be the default.
Have you enabled anti-aliasing in your settings? If not then set it to MSAA 8x and repeat all your tests again.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by uwestoehr »

Thanks the the explanation
wmayer wrote: Wed Jan 08, 2020 2:29 pm Have you enabled anti-aliasing in your settings? If not then set it to MSAA 8x and repeat all your tests again.
This was off. Now I set it to MSAA 8x. But with this, I get in no case exactly what I see on screen in FC :o :

Without MSAA 8x I got with Framebuffer (as is) what I need.
Attachments
Framebuffer (as is)
Framebuffer (as is)
FBAI.png (82.49 KiB) Viewed 1808 times
Framebuffer (custom)
Framebuffer (custom)
FBC.png (82.48 KiB) Viewed 1808 times
Offscreen (old)
Offscreen (old)
OSO.png (58.6 KiB) Viewed 1808 times
Offscreen (new)
Offscreen (new)
OSN.png (52.25 KiB) Viewed 1808 times
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Issue with "saveImage" and Parts with Transparency Nonzero

Post by wmayer »

Attached are your datum plane project and two Inventor files. The one Inventor file has been modified where all custom nodes are replaced with original Inventor nodes.

For the modified Inventor file the image looks correct while for the original file it looks bad. So the culprit must be one of the custom Inventor nodes which causes problems with transparencies.

I assume that the problem is introduced with realthunder's Link3 branch.
Attachments
Datum-plane.iv
(22.21 KiB) Downloaded 52 times
Datum-plane-org.iv
(31.63 KiB) Downloaded 56 times
Datum-plane-issue.FCStd
(17.98 KiB) Downloaded 56 times
Post Reply