• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: July 5th, 2023

help-circle


  • I was learning OpenGL at the time and I was frustrated that I could not play a game using OpenGL (When I use a technologie in programming, I love using software that use it) because none of the games in my library supported it. So I discovered Ubuntu 16.04 and I immediatly loved it. I also reinstalled it seven times because every time I broke it and I didn’t know how to fix it.

    What realy chocked me at the time is how easy it is to install C++ dependencies for your project. You just use the package manager and boom, you link it to your project and your done and if for whatever reason the package is not available in your package manager, you can build it manually very easely.

    However, there where some downside too. VSCode didn’t exists at the time (or I didn’t ear of it) and the only proper IDE was kdevelop which I never liked. Hopefolly, when VSCode came it was realy cool, but not as cool as when I discovered NeoVim. The gaming too was bad, Proton didn’t exist, Wine was not as advanced as today and DXVK was not a thing yet. You could only play games that where 5+ years old and only at 15/20 fps with a lot of glitches.

    Linux nowoday serve all my needs, I only need to start Windows when I deploy and test some program to it or when I play a game that is not well supported on Linux and I only do it in a VM with single GPU Passthrough.


  • TL;DR : With deferred rendering the light is calculated only once per pixel. With the forward rendering however the light can be calculated thousand of times per pixel.

    No, there is less calculation with the deferred rendering. It’s because there is a lot of objects on a scene. The rendering engine (actually the 3D API like Vulkan) is trying to render each object. It identify what pixel on the screen the object is using and it is launching the calculation of the color of the pixel. This process is looping for each object in the scene. If two objects are using the same pixels, the engine is determining for each pixel if it is closer or not of the camera compared to the previous object rendered. If it is closer, it launch the calculation of the color for this new pixel. You can think of it like drawing. On a sketch, you are drawing a line, then another and another on top of each other. This is so obvious that this process of rendering a 3D scene is also called drawing.

    However, as you can tell, the calculation of a texel (texture pixel) can be run a lot of times for a single pixel. This is why forward rendering is soo inefficient because if you rerender a texel 1000 times, you recalculate the light and all 1000 times.

    The goal of deferred rendering is to do the rendering of a scene in two stage. The first stage is producing multiple texture with basic data : the depth of the pixel (how far is it from the camera), the raw texture applied on each objects of the scene along with the normal map, etc. And then, in the second stage, the light, shadow, etc. is calculated based on the texture made by the first stage. The big aventage of this method is that the light and other expensive calculation are only made once per pixel.