MIPMAP and other settings for graphics

jin_xi
Member
 
Posts: 165
Joined: Mon Jul 02, 2012 18:19

MIPMAP and other settings for graphics

by jin_xi » Sun Aug 26, 2012 09:48

Hi all,

after hearing complaints about noisy textures and similar stuff i tried some experimenting. To try it yourself you need to edit source files and compile minetest afresh. here are the changes:

for mipmapping change main.cpp as follows:

change line 1296 to the following:

// Disable mipmaps (because some of them look ugly)
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

please report if you find anything "ugly"

for anisotropic and / or bilinear filtering, change clientmap.cpp as follows:

after line 469 insert this:

buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, true);
buf->getMaterial().setFlag(video::EMF_ANISOTROPIC_FILTER, true);

have fun hacking!
 

User avatar
VanessaE
Moderator
 
Posts: 4354
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE

by VanessaE » Sun Aug 26, 2012 09:53

On my system, adding the mipmap and anisotropic filtering festures as directed above makes a world of difference in the game (I tried it in 0.4.1 and 0.4.2-git from a day or two ago), and has no performance penalty whatsoever.

Note that you should only use the bilinear filter if you're using exclusively higher-resolution textures - anything in the 16px range will turn blurry with bi- or tri-linear filtering. High-resolution textures just get smoother.

I recommend the above settings be attached to checkboxes in the GUI. One each for mip-map and anisotropic filtering, and a radio button to switch between no-, bi- or tri-linear filtering. These are must-have's!
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
 

User avatar
Calinou
Moderator
 
Posts: 3145
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Sun Aug 26, 2012 10:10

VanessaE wrote:I recommend the above settings be attached to checkboxes in the GUI. One each for mip-map and anisotropic filtering, and a radio button to switch between no-, bi- or tri-linear filtering. These are must-have's!

+1, maybe an ability to change GL texture mode in minetest.conf would be good too.
 

User avatar
rubenwardy
Moderator
 
Posts: 5638
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Sun Aug 26, 2012 10:18

VanessaE wrote:...and a radio button to switch between no-, bi- or tri-linear filtering.!


Or a drop-down-list :)
Last edited by rubenwardy on Sun Aug 26, 2012 10:18, edited 1 time in total.
 

glomie
Member
 
Posts: 141
Joined: Sun Aug 07, 2011 19:41

by glomie » Sun Aug 26, 2012 18:48

Your change make texture blured.
Sorry for my bad english...
 

User avatar
rubenwardy
Moderator
 
Posts: 5638
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Sun Aug 26, 2012 19:06

glomie wrote:Your change make texture blured.


That is the point.

AF is aperture, which is what the eye uses to focus

iirc it is a type of primitive shading, that can be used on old machines w/o shaders
Last edited by rubenwardy on Sun Aug 26, 2012 19:11, edited 1 time in total.
 

User avatar
VanessaE
Moderator
 
Posts: 4354
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE

by VanessaE » Sun Aug 26, 2012 19:07

I would also recommend that a threshold setting be added for the bi-/trilinear filtering options - that is, a setting that says "only apply this filter if the texture is larger than this resolution". That way, high-resolution textures get the full-blown filtering, while low-resolution textures don't get the bi-/trilinear filtering, so they don't get blurry.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
 

leo_rockway
Member
 
Posts: 172
Joined: Tue Jul 31, 2012 20:37

by leo_rockway » Sun Aug 26, 2012 19:29

glomie wrote:Your change make texture blured.


That makes the highres textures don't look bad in the distance.
I tried this with lowres textures and it looks terrible, but with highres it's very necessary. Hence, the GUI to pick what you want would be ideal.

EDIT: MIPMAP +1

EDIT2: Here are screenshots of mipmap:

With mipmap:
Image

Without mipmap:
Image


Compare the trees on the background on the left: with mipmap they look better, IMO. The papyrus in the background looks bad with mipmap, though (it kind of disappears). These screenshots only have mipmap true/false. I didn't add AF, BI, TRI, because they make the default texture look terrible on my box.
Last edited by leo_rockway on Sun Aug 26, 2012 21:30, edited 1 time in total.
 

User avatar
VanessaE
Moderator
 
Posts: 4354
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE

by VanessaE » Sun Aug 26, 2012 22:36

Screenshot from my texture pack test track, using a build with AF/MM/trilinear turned on:

Image
(2550x1985 pixels, download and load it into a proper image viewer to see it full size, or maybe right click, view image, and click again if you're using firefox)
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
 

User avatar
VanessaE
Moderator
 
Posts: 4354
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE

by VanessaE » Mon Aug 27, 2012 12:35

C55 clarified the meaning of the "ugly" comment:

-----
[08-27 08:04] <celeron55> the problem with mipmaps is when you use them at the regular 16x textures
[08-27 08:04] <celeron55> they start to downscale the resolution too early
[08-27 08:04] <celeron55> you can see "borders" at where the scaling changes
[08-27 08:04] <celeron55> try rails for example
[08-27 08:05] <celeron55> (because they have clear single pixel detail)
[08-27 08:05] <celeron55> that is what the ugly refers to; and it was not initiated by me but rather somebody else and i just threw the code in
[08-27 08:05] <VanessaE> however, that isn't happening with AF+MM alone, at least on my box. Add in bi-/tri-linear filtering and it does.
[08-27 08:06] <celeron55> go blame whoever that was
[08-27 08:06] <VanessaE> not blaming you :-) just trying to understand the comment :-)
-----

Also, the following info may be useful:

-----
[08-27 08:14] <Calinou> "you can see "borders" at where the scaling changes" < and this is why we have linear mipmapping
[08-27 08:14] <Calinou> minetest used "nearest" mipmapping prior to 0.3; the mipmapping can be smoothed by using "linear" mipmapping
[08-27 08:15] <celeron55> i guess that is the default of irrlicht
[08-27 08:16] <VanessaE> celeron55: also, on my system, fwiw, AF+MM, with or without bi-/trilinear has no effect on performance.
-----

Also, as a side note: on my system, linear or something better apparently is the default - I don't see any hard borders between the mipmap levels.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
 

leo_rockway
Member
 
Posts: 172
Joined: Tue Jul 31, 2012 20:37

by leo_rockway » Mon Aug 27, 2012 16:52

VanessaE wrote:C55 clarified the meaning of the "ugly" comment:

-----
[08-27 08:04] <celeron55> the problem with mipmaps is when you use them at the regular 16x textures
[08-27 08:04] <celeron55> they start to downscale the resolution too early
[08-27 08:04] <celeron55> you can see "borders" at where the scaling changes


I guess this is why the papyrus disappears. Also, hard borders are what looks so bad about AF/BI/TRI in 16x (the blurriness, is bad, the hard borders are what make them unbearable). I should post a screenshot of the hard borders...
 

User avatar
VanessaE
Moderator
 
Posts: 4354
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE

by VanessaE » Fri Aug 31, 2012 15:47

My official proposal (summary of my previous posts):

We already have code at the top of this thread and I've provided Ubuntu AMD64 builds that use those changes successfully, with zero issues on my system anyway.

The following should be added to the "Settings" menu, since there are already some performance-related settings found there as it is.

  • Checkbox to turn on Anisotropic Filtering.
  • Checkbox to turn on Mip-Mapping.
  • Dropdown to set the Anisotropic filtering type from whatever types Irrlicht supports (e.g. Nearest Neighbor, Linear, etc.).
  • Dropdown to turn on/off extra Bilinear or Trilinear filtering apart from the other settings above.
  • Dropdown or Slider to set the resolution above which Bilinear/Trilinear is applied (anything below should be drawn without the extra filter).
  • Checkbox to set whether or not the extra filter should apply to transparent objects.

All of these should default to "off", that is set so that the game behaves as if it's unchanged. All of these settings are supported by Irrlicht from what I've been looking at. There's lots of empty space to the right in the "Settings" menu, so just dump it all there in some reasonable order.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
 

User avatar
Calinou
Moderator
 
Posts: 3145
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Fri Aug 31, 2012 16:05

leo_rockway wrote:
VanessaE wrote:C55 clarified the meaning of the "ugly" comment:

-----
[08-27 08:04] <celeron55> the problem with mipmaps is when you use them at the regular 16x textures
[08-27 08:04] <celeron55> they start to downscale the resolution too early
[08-27 08:04] <celeron55> you can see "borders" at where the scaling changes


I guess this is why the papyrus disappears. Also, hard borders are what looks so bad about AF/BI/TRI in 16x (the blurriness, is bad, the hard borders are what make them unbearable). I should post a screenshot of the hard borders...


Linear mipmapping doesn't have these hard borders (see Optifine mod for Minecraft; "Nearest" mipmapping has, "Linear" hasn't).
 

User avatar
sfan5
Moderator
 
Posts: 3776
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Fri Aug 31, 2012 19:50

VanessaE wrote:On my system, adding the mipmap and anisotropic filtering festures as directed above makes a world of difference in the game (I tried it in 0.4.1 and 0.4.2-git from a day or two ago), and has no performance penalty whatsoever.

Note that you should only use the bilinear filter if you're using exclusively higher-resolution textures - anything in the 16px range will turn blurry with bi- or tri-linear filtering. High-resolution textures just get smoother.

I recommend the above settings be attached to checkboxes in the GUI. One each for mip-map and anisotropic filtering, and a radio button to switch between no-, bi- or tri-linear filtering. These are must-have's!

+1
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33
Location: Paradise (your not allowed)

by sdzen » Fri Aug 31, 2012 20:36

finally i can use nosferatu HD texture pack again
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

leo_rockway
Member
 
Posts: 172
Joined: Tue Jul 31, 2012 20:37

by leo_rockway » Sat Sep 01, 2012 05:51

Calinou wrote:
leo_rockway wrote:
VanessaE wrote:C55 clarified the meaning of the "ugly" comment:

-----
[08-27 08:04] <celeron55> the problem with mipmaps is when you use them at the regular 16x textures
[08-27 08:04] <celeron55> they start to downscale the resolution too early
[08-27 08:04] <celeron55> you can see "borders" at where the scaling changes


I guess this is why the papyrus disappears. Also, hard borders are what looks so bad about AF/BI/TRI in 16x (the blurriness, is bad, the hard borders are what make them unbearable). I should post a screenshot of the hard borders...


Linear mipmapping doesn't have these hard borders (see Optifine mod for Minecraft; "Nearest" mipmapping has, "Linear" hasn't).


Yes, the mipmapping didn't show hard borders, it was AF/BI/TRI that showed very obvious hard borders.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sun Sep 30, 2012 12:38

jin_xi wrote:after line 469 insert this:

buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, true);
buf->getMaterial().setFlag(video::EMF_ANISOTROPIC_FILTER, true);

Its after line 546 in latest git (i think).
 

User avatar
RealBadAngel
Member
 
Posts: 556
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Thu Oct 04, 2012 06:55

can some1 make windows build with it?
 

User avatar
VanessaE
Moderator
 
Posts: 4354
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE

by VanessaE » Sun Oct 14, 2012 12:15

I have put the basics of the above discussion into the engine with a proper GUI to control the settings, and have released a patch and build for Ubuntu Linux, plus sfan5 has released a build for Windows. I figured that deserves a new thread, since more stuff is likely to be added in the future, so go here:

http://minetest.net/forum/viewtopic.php?id=3410

Enjoy!
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
 


Return to Feature Discussion



Who is online

Users browsing this forum: No registered users and 0 guests