Posts

Screen-Space Reflections Explained

Image
 Introduction Some of the most difficult algorithms to properly implement for graphics developers are the family of algorithms used for screen-space reflections (SSR). These are difficult to implement because they require programmers to navigate peculiarities of transformations and coordinate systems inherent to their rendering API, as well as requiring a solid understanding of Linear Algebra. This is further complicated by the need for rendering multiple data buffers for use in the algorithm -- the algorithm I will describe requires buffers for depth, normal vectors, and an output color buffer from the lighting pass. These are buffers commonly generated and used in a deferred renderer though this algorithm could also be used in a forward renderer, as well. Methodology The simplest SSR algorithm starts with the view space calculation of the reflection vector (R) from the view (V) and normal (N) vectors using the formula V - 2.0 * dot(N,V) * N, where V = pixelViewSpacePosition - cameraP

Young Diagrams and The Ski Lift Problem

Image
 Somewhere years ago when I was in college, I came across what seemed like a simple combinatorics problem: "There are 3 ski lifts and 3 students who wish to ride them. Given that each lift has an unlimited amount of room to seat students, what is the total number of permutations of students on lifts?" As a fun bonus, rather than simply solving the problem (which is really a trivial calculation on its own) I thought it would be fun to find a generating function for any number of lifts and students. Not knowing much beyond rudimentary discrete math or combinatorics, I began to work. This at first seems like a straight-forward permutation problem: there are both students and lifts being permuted, but ultimately this is nothing a first year student couldn't reckon with. To create a generating function, it's necessary to calculate the permutations of lifts used, then multiply this by the number of permutations of students.  For the lifts, there are 3 of what I’ll