https://github.com/minetest/minetest/issues/6867
How can I enable gamma correct downscaling for mipmap generation?
Mipmapping with gamma correction
Re: Mipmapping with gamma correction
You cannot. The mipmap generation is done by your hardware, and both the alpha and srgb details are handled there. There is no option for tuning either.
However, you can compute mipmaps manually in software and do whatever calculations you like. Naturally that's slower vs the hardware generation. That's what Niko's blog entry did, and that's what BAW does too.
However, you can compute mipmaps manually in software and do whatever calculations you like. Naturally that's slower vs the hardware generation. That's what Niko's blog entry did, and that's what BAW does too.
Re: Mipmapping with gamma correction
Correction: IrrBAW lets you upload parts of the mipmap chain explicitly, so i.e. you can come with your own mipmaps with formats such as the .dds (and khr soon), we never calculate mip maps ourselves in software.
Its mostly for purposes of better lowpass filtering such as using a sinc filter when generating mip-maps or when you intend to use the mipmap chain for other weird purposes (Hierarchical depth Min/Max Z)
But we do support automatic mipmap generation, but thats after a texture is uploaded and in functions other than IVideoDriver::getTexture() it needs to be triggered explicitly.
Its mostly for purposes of better lowpass filtering such as using a sinc filter when generating mip-maps or when you intend to use the mipmap chain for other weird purposes (Hierarchical depth Min/Max Z)
But we do support automatic mipmap generation, but thats after a texture is uploaded and in functions other than IVideoDriver::getTexture() it needs to be triggered explicitly.
Re: Mipmapping with gamma correction
All this reminds me of an effect i saw with regard to uploading diferent mip images into a texture, from when the hardware didn't run pixel shaders
http://blog.mecheye.net/2018/03/deconst ... -sunshine/
http://blog.mecheye.net/2018/03/deconst ... -sunshine/
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Posts: 4
- Joined: Sun Apr 22, 2018 7:18 am
Re: Mipmapping with gamma correction
If I understand that correctly, the internal format of a texture can be set to GL_SRGB to enable gamma correction:
https://www.reddit.com/r/opengl/comment ... on_issues/
https://learnopengl.com/Advanced-Lighti ... Correction
https://www.reddit.com/r/opengl/comment ... on_issues/
https://learnopengl.com/Advanced-Lighti ... Correction
Re: Mipmapping with gamma correction
There is a toggle on the Irrlicht device creation parameters structure that enables the sRGB color space in textures automatically
http://irrlicht.sourceforge.net/docu/st ... eters.html
it is called "HandleSRGB"
http://irrlicht.sourceforge.net/docu/st ... eters.html
it is called "HandleSRGB"
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Mipmapping with gamma correction
In my opinion it works rather badly and only affects the framebuffer OUTPUT.
For sRGB(A) you'd need to set the internal format correctly on the texture, and irrlicht supports a very limited subset of internal formats.
For sRGB(A) you'd need to set the internal format correctly on the texture, and irrlicht supports a very limited subset of internal formats.
Re: Mipmapping with gamma correction
Yeah... i mistook it by my own engine, i handle the sRGB as texture format indeed...
It wouldn't harm to have some sRGB texture formats, as well as being able to load and have mipmaps for floating point textures. but either i haven't found them, or D3D9 doesn't support sRGB texture formats, only changing the output gamma ramp.
It wouldn't harm to have some sRGB texture formats, as well as being able to load and have mipmaps for floating point textures. but either i haven't found them, or D3D9 doesn't support sRGB texture formats, only changing the output gamma ramp.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Posts: 4
- Joined: Sun Apr 22, 2018 7:18 am
Re: Mipmapping with gamma correction
HandleSRGB indeed gives wrong results.
Re: Mipmapping with gamma correction
In my opinion it works rather badly and only affects the framebuffer OUTPUT.