Posts

Showing posts from November, 2022

I forgot to clear the screen

Image
I started a side-side project about 90 minutes ago. It has been a good exercise in making sure the libraries I have written are useful in non-game-engine contexts. I got SDL and IMGUI working properly, but I forgot to clear the screen before each frame. I always find this mistake funny, so this time I recorded and uploaded it :)

Sound Cloud

Here is a link to my soundcloud page. Also, here is a link to a playlist containing a few songs.

Shader-Program Batching

Image
I added support for multi-material meshes a while back. These meshes are partitioned into slices for each of which a separate material and draw call is used. I recently added a partially transparent material. This makes rendering order necessary to consider. My solution for correcting rendering order is to assign draw-orders to each material. Until this point, I was iterating over the collection of multi-material meshes and rendering all the slices for each mesh. But to respect material draw order, I now collect the slices from each multi-material mesh into bins associated with their materials before sorting the bins according to their material draw order and finally rendering the slices in each bin. When I say material I pretty-much mean an opengl shader program. Here's a chart from an nvidia powerpoint showing that changing shader programs is one of the more expensive state changes in opengl. This new rendering technique of binning according to material and then rendering prevent...

Typesetting

Image
I really like the way Paper Mario: The Thousand Year Door does its text-boxes. In addition to the normal text formatting options you would expect to see in character dialog text, there are also options for making the text vibrate and oscillate. I needed to create a typesetting library for my game engine anyway, so I decided to include similar features. I really like the results!

Physically-Based Rendering

Image
 I've been following an excellent set of tutorials on graphics programming with a focus on opengl ( https://learnopengl.com/Introduction ). One of the more recent tutorials I followed was about physically-based-rendering ( https://learnopengl.com/PBR/Theory ). I haven't finished the tutorial yet, but I have achieved some pretty great results.

Voronoi Diagrams

Image
Voronoi diagrams are pretty neat. https://en.wikipedia.org/wiki/Voronoi_diagram To create a voronoi diagram: Pick some points in 2d space. Assign colors to those points. Create an blank canvas image with enough pixels to represent that 2d space. Assign every pixel in that image to the color of the closest point. Step four is interesting because there are lots of ways to measure distance. I wrote a program to create voronoi diagrams using different distance functions. Here are the results: Euclidean-distance: Manhattan-distance: Hacky manhattan-distance with polar coordinates:

Entity selection and highlighting

Image
 I got entity selection working for my in-engine editor! There are no editing features yet, but it is difficult to perform operations on something when that thing cannot be specified :)