Thursday, April 27, 2017

Slow progress is still progress

I haven't updated the blog in a while, but I have been working on the project. Most of it is mundane stuff like reading and writing configuration files (I abandoned the Panda3D .prc for the more common .ini), and little performance tweaks that I'm not gonna talk about. 

Lightning!


But lightning effects - now that's more interesting. For fire effect I have a GPU particle system that I can use, but that's no good for lightnings. What I did is made use of instancing and some noise generated in the shader. The lightning is generated as solid geometry, nothing more then a thin, long cylinder with multiple cross segments, the vertex are displaced using a simple-ish nose, stretched to the right length and rendered as many times I need and each instance can be rotated to make a fan.
Just by passing in different values to the shader I can now make any kind of lightning effect I need.
The glow-bloom pass adds .. well glow to the lightning effect, and a extra point light moving along the lightning ray gives a nice visual effect.

  

GUI

Programming GUI is always a pain for me. I'm not all that good when it comes to 2D graphics and I also always try to fit the UI on some small display whilst trying to make it readable on a big display, and at the same time make the widgets automatically resize to the window size and to draw it all with as few draw calls as I can... it's hell.
The layout, size and callback are all loaded from a JSON file and I'm using a small texture atlas to draw all the elements, so it's easy for modders to re-skin the whole thing. The texture atlas I use look like in the picture below and the final GUI look as show on the video: