Image-Based Lighting in Unity - Part 1: What is IBL?


My blog has been far too empty as of late (well, for the past two years)... So! I'm going to do my best to document my personal projects.

My current project; Image-Based Lighting in Unity.

IBL is a pretty interesting topic that branches into two main groups; physically based rendering and "I don't care about/have the time for physically based rendering". For the moment, I'm headed down the "I don't care" road.. that's likely to change at some point.

So, What is IBL?

Image based lighting is a method of using offline-computed cubemaps to add a sense of realism to reflections, not just in high-quality specular, but faking bounced light contribution, as well as rough reflections.

This image represents the basics of IBL (click for the original article).


As a side-note, Sébastien Lagarde is a name you'll hear a lot when reading up about image based lighting and physically based rendering. I suppose you could say he's the expert on the subject, or at least the most vocal. Either way, his blog is awesome and has a lot of great info so make sure you check it out.

There are two main parts to acheiving this effect; Diffuse and Specular Convolution. For simplicity, think of 'convolution' as a blur.

The diffuse convolution cubemap is responsible for simulating the bounced light contribution. Simply put, it's super blurry to give the object a general idea of the colour of its surrounding surfaces. Here's an example of what the diffuse convolution cubemap tends to look like (in vertical cross format).

Before and after (Click for full size).

The specular convolution is much more interesting. The specular cubemap follows the same idea. Using a specific formula (which I won't cover, but Sébastien does in his blog) blur the base image but this time, we're going to do it in several steps starting with a perfectly sharp image and increasingly blur it and half-size the resolution. What we end up with is a cubemap with somewhere between 8 and 16 mipmaps, each incrementally more blurry and at a lower resolution.

How to Generate These Cubemaps

That's the basics of IBL; the diffuse and specular convolution cubemaps. But, how do we generate them?

Well, Sébastien saves the day! AMD used to provide a cubemap tool called AMD CubemapGen. They have since dropped support for it, but have given the source code to the community. Sébastien has modified and improved the tool and released his build on his website. Awesome!



The tool even has a command-line interface so you can hook it into your own tools (I've done so with Unity, but I won't get into that, it's a bit of a mess).

If you download the tool, try throwing in a cubemap, either in DDS format, or in a vertical cross. There's two options that you'll want to play with; Irradience Cubemap (this generates the diffuse convolution cubemap) and Cosine Power/Power Drop On Mip (this is the amount of sharpness and the amount to decrease on each mipmap of the specular convolution cubemap). Once you've got some settings you think will work, go ahead and hit the Filter Cubemap button. When it's done generating, you can even save out your cube to cross format or to a DDS.

printer friendly

Another Update


It's been quite a while since I've last updated. Here's the latest;

From QC to HFX

I was offered an opportunity to work side-by-side with the Longtail Studios team on their Wii U launch title Sport Connection. After several months of supporting their team and getting to know them, I decided that Halifax was a better fit for me. I've been working with Longtail Studios as a Junior Programmer since June 2012.

 

Shipping My First Title

We successfully shipped Sports Connection at launch in November 2012 and started working on our new project.


Rocking Out in Rocksmith 2014

Our next project was working with Ubisoft San Francisco on Rocksmith 2014. Longtail was responsible for all the Guitarcade games and features. We spent the development working on 12 minigames (one didn't make the cut). I personally was responsible for most of the shaders and graphics features of Guitarcade, so most of the visuals have been in my hands at some point. I was also in charge of implementing all of the particle effect triggers in each of the minigames.
There's a couple images of the minigames in action below.

There are lots of videos online too. Pretty awesome!

 

On To New Things

We have a new project lined up and we're just ramping up now. It's sounding like a graphically challenging project, so it should prove interesting. More info to come

printer friendly

[OLD] Yarrrr Video... Finally!



printer friendly

[OLD] Update

After applying to just about every development studio in Toronto, I finally got a reply from somewhere I had not expected.
Update #1: The new job!
At some point I started expanding my search to Montreal and BC. I was then contacted by Ubisoft Quebec, who had seen my application to Ubi Montreal and wanted to know if I was interested in a job. After two interviews (one phone and one in-person) and hours of debating, I accepted the job. I am currently working for Ubisoft QC's Onyx Support team as a Technological Support Programmer, specifically in graphics. Onyx is Ubisoft QC's in-house game engine that is currently being used by Ubisoft studios world-wide to make games for all the major platforms. I'm still doing some training tasks but I'm starting to get the hang of working with Onyx and the team in Quebec City.

Update #2: PXE2
In my spare time I'm attempting to re-build PXE from the ground up. When I originally came up with PXE, it was supposed to be fixed-pipeline only. I later added support for shaders simply because I could, which made the code incredibly ugly. This time around, however, I am coding it to support shaders and to run in DirectX instead of OpenGL. The reason for this is to hone my skills to better aid in my job at Ubisoft. I have little experience with DX or HLSL and I would like to change that.

Update #3: Yarrr!
I'm still planning on posting a video of Yarrr! but every time I try to record it, the capture software only captures a few frames (it runs at over 60 fps though, so I'm not sure wtf is going on). I need to get a copy of Fraps so I can finally capture it properly. Also, Yarrr! is pretty much dead in the water. I hope to finish it (probably in PXE2), but not for a long time .

printer friendly

[OLD] Voxel Modeller

This is a voxel modeller that we built for our OpenGL course last year. I built mine using the early version of my engine PXE.


printer friendly

[OLD] Yarrr Progress


I have a few screenshots of the newest version of Yarrrr!



printer friendly

[OLD] Ice Cream Bob

The adventures of Ice Cream Bob was a group project we had for project management. We had to take the game through all of the steps; from the proposal to coding the game. The idea of the game was that Bob was an Icre Cream truck driver who was out doing his rounds when a giant daimond-like, radio-active meteor smashed into his truck, causing him (and the kids at his truck) to be thrown back in time. Bob now has to collect all of the gem pieces that have been scattered all over time as well as the kids. My part of the project was mainly implementation of Box2D with OpenGL, creating the 'platforming environment' through Box2D and generating art assets for levels.



printer friendly

[OLD] Terrain from last year.

Last year, in my C class, we were given a final assignment. We were supposed to make some type of interactive application using OpenGL. At the time 'we' didn't know anything past making coloured primitives, the class was mainly an introduction to the power of C versus Java. Well I said "Screw that! I'm going all out." and I put as much as I could into the assignment. In just over a month I included texturing, particle effects, terrain, lighting and even real-time editing in my assignment. I also included some very simple physics and collision (none with the terrain at the time unfortunately). This was the first time I had used OpenGL for anything more than 2D graphics. Needless to say, I aced the assignment.



printer friendly

[OLD] Capstone Project: Yarrrr!


After months of preparing my engine, I'm now comfortable showing off some screenshots of my capstone project.

It is called Yarrrr! and it is a mix of rpg-style gameplay with tower defence. The player controls a pirate ship and greed is the name of the game. The player must control the ship to capture ports. Ports generate money, money means upgrades and upgrades means kicking ass; so naturally, the more ports the better.

So here are a few screenshots of my scene-management, models and per-pixel lighting



More screenshots soon...

printer friendly

Working with GLSL


My first assignment for my Graphics 2 course (GAME 640) is due today. The course focuses on GLSL (OpenGL's shader language) and the result was pretty cool, so I've decided to show off a bit a post a couple snaps.

(Click for full size)


The spheres around the scene are 'emitting' light (thus why they are not shaded) and following a path. The sphere in the center has 100% specularity.

I might post the exe later, but the assignment was written in GLUT (yuck!) so I'm a little reluctant...

Edit: I messed with the program a little more; I added some shapes and set the specularity super-high. It looks pretty awesome. Here's a couple more snaps.



printer friendly
Proudly powered by e107