Graphics Programming with wgpu

This week started with kind of rushing through the book that teaches wgpu. I tried to adapt the code so that it is less repetitive as an exercise and I also incorporated async-winit which was useable after all my doubts from last week. I even skipped some of the chapters on lighting and mesh generation which were not that interesting to me since I really wanted to read about instancing. The principle there is much easier than I could have imagined:

In the example from the book a uniform buffer is created which holds the data which is different between instances of the same object. In the draw command we can pass an instance range which is directly passed to the shader as a raw instance index. We can then use this instance index to get the correct portion of the uniform buffer that is related to the instance by, ... well: indexing into the uniform buffer. And that's pretty much it.

I pretty much stopped reading the book from there on for the rest of the week and I'm just now picking it up again. It's a bit hard to continue since the author is presenting big, repetitive examples and he's switching up a few things back and forth between the chapters. This was a bit annoying to me since I thought I might get away with progressively updating my adaptations of the code. However, this is not the case. There is code from an earlier chapter popping up just now and so I'm refactoring the wgpu executing code to be able to run all variations of the examples. That works reasonably well and is a pretty cool exercise actually.

Terrain generation progress

My private side project I wrote about last week is a small experiment for terrain generation that looks like a game/simulation. Currently it's just a way for me to spend a bit more time doing something creative. This week I mainly drew some trees in libresprite and tried to work on vegetation. It's nothing sophisticated yet, but it starts to look more natural. I'll try to post some pictures once I'm satisfied enough with the results.

zsh and nix

I finally gave configuring zsh in nix a second try this week aswell as my previous configuration was a bit bare-bones. As a result the most basic things every normal linux user would expect are working now. I finally have proper syntax highlighting and auto completion. Another thing that got improved in that process is the zsh and nix-shell compatibility. Since I'm using a lot of nix shells (I can probably replace that with flakes but haven't figured out how to do so yet) I'm like half of my time inside of a nix shell. I didn't configure nix-shell in any way and so I was left with a minimalistic bash experience. Integrating zsh there wasn't to difficult however and now I'm enjoying zsh on my system again like in the good old arch linux times.