NaviCube Anti-Aliasing (lack therof)

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
asegura
Posts: 16
Joined: Sat Jan 23, 2021 11:43 pm

Re: NaviCube Anti-Aliasing (lack therof)

Post by asegura »

OK, a similar change in the texture that holds the navicube "arrows" also makes them smother.

I don't know how to proceed. A full pull-request for just 2 lines changed and 2 lines added?

The change is to have this:

Code: Select all

	texture->generateMipMaps();
	texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear); // new
instead of this:

Code: Select all

	texture->setMinificationFilter(QOpenGLTexture::Linear); // old
in src/Gui/NaviCube.cpp :

* around line 531 (end of createButtonTex())
* and line 425 (end of createCubeFaceTex())

There is another texture in createMenuTex() line 604, but I see almost no difference here.
User avatar
chennes
Veteran
Posts: 3882
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: NaviCube Anti-Aliasing (lack therof)

Post by chennes »

@uwestoehr does this warrant inclusion in 0.20? Or do you want to hold for 0.21? (@asegura we are in a feature freeze right now so the answer to you question depends on what the release manager, Uwe, thinks is best)
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
asegura
Posts: 16
Joined: Sat Jan 23, 2021 11:43 pm

Re: NaviCube Anti-Aliasing (lack therof)

Post by asegura »

FYI, this is based on master and improves on this recent commit https://github.com/FreeCAD/FreeCAD/comm ... 2c4e9f3ed5. Best noticeable in the text on the cube's faces when rotating.

Now I've seen that the generateMipMaps() call is not necessary, it seems mipmaps are generated automatically by default. So it is only 2 lines changed:

Code: Select all

--- "a/I:\\src\\_Ext\\FreeCAD\\src\\Gui\\NaviCube.cpp"
+++ "b/I:\\src\\_Ext\\FreeCAD\\src\\Gui\\NaviCube-orig.cpp"
@@ -422,7 +422,7 @@ GLuint NaviCubeImplementation::createCubeFaceTex(QtGLWidget* gl, float gap, cons
 	Q_UNUSED(gl);
 	QOpenGLTexture* texture = new QOpenGLTexture(image.mirrored());
 	m_glTextures.push_back(texture);
-	texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
+	texture->setMinificationFilter(QOpenGLTexture::Linear);
 	texture->setMagnificationFilter(QOpenGLTexture::Linear);
 	return texture->textureId();
 }
@@ -527,7 +527,7 @@ GLuint NaviCubeImplementation::createButtonTex(QtGLWidget* gl, int button) {
 	Q_UNUSED(gl);
 	QOpenGLTexture* texture = new QOpenGLTexture(image.mirrored());
 	m_glTextures.push_back(texture);
-	texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
+	texture->setMinificationFilter(QOpenGLTexture::Linear);
 	texture->setMagnificationFilter(QOpenGLTexture::Linear);
 	return texture->textureId();
 }
 
In short, when rendering textures at a smaller resolution (minification), best result is with LinearMipmapLinear minification filtering.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: NaviCube Anti-Aliasing (lack therof)

Post by uwestoehr »

chennes wrote: Fri Jun 03, 2022 6:07 pm @uwestoehr does this warrant inclusion in 0.20?
Absolutely yes. severl people tried their best few days ago and we could commit some improvements but it looks on some screens still clumsy.
So the patch to make is smooth is very welcome!

@chennes, can you please take over an manage the commit? (I am still busy with packaging issues).
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: NaviCube Anti-Aliasing (lack therof)

Post by uwestoehr »

asegura wrote: Fri Jun 03, 2022 5:59 pm I don't know how to proceed.
We work with pull requests, no matter how small the change is.

I tested your proposal and just using lineal does not change anything visibly for me, MipMap, however does. Therefore I made now a PR:
https://github.com/FreeCAD/FreeCAD/pull/6962
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: NaviCube Anti-Aliasing (lack therof)

Post by adrianinsaval »

nice improvement!
Post Reply