Today I decided to implement a nice little effect I often notice in games, which is that sort of dithering pattern that is gradually replacing transparency in new games. For example, Mario Odissey exclusively use it throughout the game.
The reasons for its use are mainly to be found in performance, as the dithering pattern drastically reduces the overdraw, and also for its support of deferred rendering. Personally, I even find it more pleasing to the eye than transparency in some situations (i.e. an object disappearing with camera occlusion).
I implemented it by sampling a dither texture, and tiling sections of it across the screen, depending on the alpha value. For the alpha, I added an alpha attribute to the shaders, as well as finally adding support for opacity textures, which I somehow had never done before.
In the picture you can see:
- proper opacity support for the leaves, with some dithering effect around the edges
- the dithering pattern, which I increased with depth just for the sake of this picture, while normally it uses alpha
venerdì 22 dicembre 2017
mercoledì 6 dicembre 2017
Day 216: Small improvements
Today I cleaned and improved some of the batches classes, especially the Font one, which was slower than necessary.
I'm also starting to plan a substantial refactor of the engine, in order to remove the need for batching and sorting in case of materials that do not benefit from instancing. I'm still trying to find a clean way to do it before starting to work on it.
I'm also starting to plan a substantial refactor of the engine, in order to remove the need for batching and sorting in case of materials that do not benefit from instancing. I'm still trying to find a clean way to do it before starting to work on it.
martedì 5 dicembre 2017
Day 215: Improved Shell and Log
Today I decided to clean the engine a bit, and improve some of the debugging tools, which is always a good long-term investment.
First, I decided to add a small Stat window that constantly shows some of the most important performance data. FPS and draw calls are the most important ones for sure, and the reason I made the system in the first place, but other useful data can be occasionally shown.
I also modified the command parser for the shell, as it still consisted in an ugly chain of ifs, and I never had time to improve it. I created a map of lambda functions, and the command is used to access the map and call the corresponding function. The lambdas also return a string containing an hint about what the command does, and the new "help" command uses this fact to produce helpful messages.
I also fixed some bugs in the scene system and in the material class, and I plan to refactor them a bit more in the future.
First, I decided to add a small Stat window that constantly shows some of the most important performance data. FPS and draw calls are the most important ones for sure, and the reason I made the system in the first place, but other useful data can be occasionally shown.
I also modified the command parser for the shell, as it still consisted in an ugly chain of ifs, and I never had time to improve it. I created a map of lambda functions, and the command is used to access the map and call the corresponding function. The lambdas also return a string containing an hint about what the command does, and the new "help" command uses this fact to produce helpful messages.
I also fixed some bugs in the scene system and in the material class, and I plan to refactor them a bit more in the future.
lunedì 4 dicembre 2017
Day 214: Optimized and integrated SSAO
Today I decided to improve SSAO, and to integrate it into the pipeline of the engine. This required a few steps:
1) Move the SSAO shader to the engine code, and make it independent from the post processor, so that it can be used withing the deferred rendering pipeline
2) Instead of using the results directly, store a low-precision single-channel texture in the G-Buffer (actually 2, because of step 3).
3) Create 2 shaders to apply vertical and horizontal blur. They alternatively use the two occlusion textures.
4) Apply the results only to ambient light in the directional light shaders.
As you can see from the picture, the bilateral filtering makes the noise go away quite well, and finally the "shadows" look like shadows. On top of that, applying the results only to ambient light makes the effect much nicer when other lights interact with it.
1) Move the SSAO shader to the engine code, and make it independent from the post processor, so that it can be used withing the deferred rendering pipeline
2) Instead of using the results directly, store a low-precision single-channel texture in the G-Buffer (actually 2, because of step 3).
3) Create 2 shaders to apply vertical and horizontal blur. They alternatively use the two occlusion textures.
4) Apply the results only to ambient light in the directional light shaders.
As you can see from the picture, the bilateral filtering makes the noise go away quite well, and finally the "shadows" look like shadows. On top of that, applying the results only to ambient light makes the effect much nicer when other lights interact with it.
Iscriviti a:
Post (Atom)


