The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.15 (Linux)
File Line Function
/showthread.php 906 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Texture creation refactoring + texture filtering options
#1
I'd like to implement shadow maps and anisotropic filtering in some future version of Colobot. But first we need to refactor texture creation. TextureCreateParams structure is too low-level, doesn't contain enough information, and contains some useless information. Plus we could add some graphics options and correct some problems.

I write this post because I want to encourage more involvement in the project of various people, not just few programmers. Someone could help decide where and how to put things in graphics option menu.

From the point of in-game texture usage, there are few specific texture parameters that player should be able to choose in graphics menu. Each one translates to magnification and minification filters, mipmap generation and anisotropic filtering. These should be a single texture type which can be chosen in right option menu:
  • Texture filtering option:
  1. Nearest neightbour = Doom-like filtering, some textures need this (GL_NEAREST / GL_NEAREST)
  2. Bilinear filtering = Linear filtering, UI textures should use this (GL_LINEAR / GL_LINEAR)
  3. Trilinear filtering = Mipmapped linear filtering, world textures can use this (GL_LINEAR / GL_LINEAR_MIPMAP_LINEAR)
  • Mipmap level (4, 8, 16) = Specific number of generated mipmaps, enabled only for trilinear filtering
  • Anisotropy level (1, 2, 4, 8, 16) = Specific number for anisotropic sampling
Current mipmap generation (GL_GENERATE_MIPMAP) is available since OpenGL 1.4, so we need to disable trilinear filtering below that version or precompute and upload mipmaps manually. Current code doesn't set GL_TEXTURE_MAX_LEVEL, which defaults to 1000. Most textures need up to 8 mipmaps. Using trilinear mode without mipmaps is pointless. And using anisotropic filtering without 

Anisotropic filtering can only be enabled when GL_EXT_texture_filter_anisotropic is available. Maximum available anisotropic level should be checked from MAX_TEXTURE_MAX_ANISOTROPY_EXT.

We need to introduce depth texture format (aka GL_DEPTH_TEXTURE24) for future implementation of shadow maps, available only when OpenGL 1.4 or GL_ARB_depth_texture is available. WARNING: GL Context has to be created with 24-bit Depth buffer or else huge performance penalty will be introduced when copying from framebuffer.

Created textures should be generally stored in a class, not single integer, but that's for later. We could add these settings to .ini file first and later to graphics options. Also, we can probably remove VBO switch since the problem has been resolved. We can add these as Trello problems/ideas for game engine and/or Github issues.
"After three days without programming, life becomes meaningless."
~The Tao of Programming


Messages In This Thread
Texture creation refactoring + texture filtering options - by tomaszkax86 - 05-05-2015, 01:50 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)