Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

post zortchtest update!

first of all a recap for those not in the loop,
the zortchtest revealed a few very large bugs:
(also once again thanks for everyone who tried zortchtest)

 there was an error with the stencil test:
  - on windows if you want anti-aliasing you need to make two windows: one to request an opengl context - with the opengl context you can ask if the gpu supports anti-aliasing - if you do then you close this window and make a new opengl window with anti-aliasing support
- and there was a problem on the second window where I forgot to request a stencil buffer - and in this case you get a window format that either supports it or don't - and it was a toss up - some gpus returned one with the buffer and one without
- the stencil is used to draw the skybox - surfaces marked with the skybox texture only draw into the stencil
- the skybox is drawn after this step - without any depth checking - and without a stencil buffer the stencil test always passes - so the skybox ended up obscuring the whole world

there was a problem with loading things from zip:
- all the data is stored in large zip files
- loading from these files was surprisingly slow
- turns out it was opening and closing the file for every texture load
- this slowed things down for the initial load of the game (and somewhat loading textures for levels)
- there was a simple fix  for this - open the zip at start of loading and close it when it's done
- and still use the old method for loading resources ingame (which happens very rarely)

and now I'd like to talk about my  third big mistake: scaling of the lightmaps
- initially I wrote the unwrapper to maximise the size of the lightmaps
- the lightmaps are stored in one big single atlas texture (it's good practice to use as few textures as possible - switching between them is slow)
- I started to work on a new lightmapper and my goal was to be able to have multiple lightmaps in the game
- initially I was thinking of having lightmaps with the max size of 1024x1024
- because I have a small old laptop and this it's maximum resolution
- also old games like Quake3 had multiple lightmaps of 256x256 because at the time many video cards had this as max resolution
- now the thing is todays even the crappiest gpu has a max resolution of 16384x16384 per texture
- and in the level editor I have a preview mode - the lightmap is 256x256 for the whole level and it looks passable
- long story short: if I don't try to maximise the space used for the lightmap atlas and just say 32x32 world units is equal to 1x1 lightmap pixel
then - even for the biggest map - the lightmap comfortably fits into a 2048x2048 texture - with space to spare
- and on older gpus I just resize the texture and it still looks good enough
- I'm a fool.. an utter fool 😔


a screen from the editor - the lightmap for the entire map is a single 256x256 texture



I added an option to scale textures down if they are too big - and tested it by manually setting it
to a small value - this is a screenshot of the first test


I made a mistake somewhere and things got unintentionally funky


this a screenshot with the fix - the max texture size is set to 32x32 for debug


I kinda like this style - we now truly channeling the spirit of the N64


this is one of the old lightmaps - I tried to scale the uv coordinates to maximise the usage of space
 this didn't result in better looking lightmaps ingame - but more time needed to bake them


scaled down version of the lightmap (from the same level)
there is a lot of wasted space now - but the lightmap looks better ingame
and takes less time to bake



be sure to try out ZortchTest and tell me what you think!


until next time!