This year I was lucky and thrilled to be selected as a student to participate in the Google Summer of Code. I got sponsored by Google to spend much of my summer working on an Open Source project called appleseed, a production-quality 3d rendering suite. At its core it is a path-tracing renderer, but there is also infrastructure surrounding it, including a DCC/GUI front end application called appleseed.studio. This is what my project for GSoC was focused on improving.
Light path recording is a unique and potentially extremely valuable tool in appleseed; however, before this project, it was relatively limited in capability of both data capture and visualization. This project aims to help remedy both of these by improving the number of quantities that are able to be recorded, improve the visualization capabilities for these quantities, and provide a method for filtering the light paths displayed.
In order to do this, a central goal of the project was to provide a unified viewport in appleseed.studio which is capable of displaying and switching between several possible views of a scene and overlay data and widgets on top of it. The motivations for this are many, and it will build a foundation upon which even more functionality can be built relatively easily.
For more detail on what the plan was going in, you can see my original proposal for the project.
I ended up completing much of what I set out to do. They say a picture is worth a thousand words, and in this case I think that is quite true. Here is a summary of all the user-facing/visible changes made to appleseed.studio.
Now, let's dig into all the details!
The first thing I did, partially before the actual GSoC coding period started, but I would consider it to be the real first step of my project, was to rewrite the old light path drawing code, which previously used Legacy OpenGL. That work was supported by upgrading appleseed.studio Qt version from Qt 4 to Qt 5. This was necessary for the modern style of OpenGL (3.3) to work properly.
Next, when the official coding period began, I started by reviewing the actual light path recording code for correctness and to annotate the physical quantities that were being stored. This work fixed a bug with the light path recording where when a ray was reflected off an emitting object, the emitted light was not properly added to the ray.
After verifying the base was correct, I started the first major piece of the project, the 'unified viewport'. The rest of the code I wrote for the project has not yet been merged, but this is mostly because appleseed has been going through a major release cycle during the GSoC coding period, and so code reviews and merging has been focused on bug fixes before the release, while my code is set to land after this release happens.
I submitted the initial version of the unified viewport in this PR, which allowed switching between the final render and OpenGL scene view at will, while retaining an overlay of the displayed light paths on top of either.
Next, I moved on to improve the fidelity of the actual rendering of the paths. Before this, they were simply drawn as line primitives using GL_LINES. This is fine for an initial implementation, but it provides very little range of options for changing how the lines look. I ended up developing a custom line drawing algorithm for our purposes, which at its simplest level creates billboarded triangle strips such that each 'line' in a light path is one rectangle made up of two triangles. It provides antialiasing without needing MSAA and offers the flexibility of changing the thickness of each line segment.
In addition, on the same vein of improving graphical fidelity, I implemented weighted, blended order-independent transparency to allow paths to have variable transparency and still be drawn in a consistent and representational manner regardless of viewing angle. I landed both this and the new line drawing in this PR.
Around this time, I hit my first and only major roadblock when I had a family medical emergency. My dad had a very bad heart attack and was in intensive care for about a week. I initially didn't expect this to affect my coding ability much, but the mental strain it put on my had an impact for several weeks afterwards, and I ended up being much less productive for the next three weeks or so.
During this time, I mostly worked on fixing bugs and improving user-experience related to all the things I had implmented so far. This included fixing unintuitive behavior, crashes, and more, and implmeenting the existing 'soloing' or light path selection feature that was already present by using transparency instead of just showing only one light path at a time.
Finally, as my mental state improved and GSoC was beginning to wrap up, I began work in earnest on the filtering part of my initial proposal. Through talks with my mentors and other appleseed community members, it was determined that implementing a filter based on light path expressions which are now a fairly industry-standard method of selecting certain light paths which should contribute to an AOV.
OSL, which is already used elsewhere in the appleseed codebase for multiple things, includes an implementation of a Light Path Expression parser and some functions for using them in computing AOVs. I adapted this code to be used in the job of filtering selected light paths in appleseed's light path recording and display.
Here is a full list of the code that I've submitted
Overall, I am quite happy with my contributions to appleseed and my time doing GSoC 2019. I'm super thankful to my mentors who have been not only very responsive and helpful, but also very understanding and friendly people who I'm glad to have met and worked with. I'm excited to get all the stuff I've worked on over the summer merged into appleseed proper and see it in the next release, hopefully with even more on the way between now and then!