Friday 12 April 2013

Lighting and Shaders Episode 2: Implementation

How we went from this:


To this:


The short answer: By putting the task of making an awesome game above all others (including blogging).

The long answer: Shaders(!!!!!), new art assets, completely revamped game engine and systems, original soundtrack and sound effects


Let's start with the shaders


Cel Shading with Black Outlines + Rim Lighting
In my previous blog (Lighting and Shaders Episode 1), we talked about a few effects I planned to add to our game (GTFO: The Double Dungeon Debacle). One of these effects was cel shading. Here you can see my implementation of the effect on our old prototype character model as well as our new and improved model.

The trick to this algorithm is very simple. To achieve the cartoon shading effect, we calculate the intensity of the light by taking the dot product of the incident light and the normal at each vertex. We then use a piece-wise function to compute the final light color based on specific ranges of light intensity. To generate the black outlines, we simply draw the model again but this time we translate each vertex by its corresponding normal (normalized then multiplied by some scalar), and force the color to black in the fragment shader. We also invert OpenGL's back-face culling before drawing the black mesh.


Tangent Space Normal Mapping

After looking at our prototype, we realized our environments look pretty flat. The walls and ground lacked depth and had no lighting applied to them whatsoever. To remedy this, we added normal maps to all of our environment assets. We placed our light source relative to the main character's position to create a sort of "halo" effect around the character. Since we use the same lighting model for the ground as well, the light appears consistent, and adds a ton of detail to the scene.



Particles

Our graphics programmer, Divakar Dev took on the task of completely revamping our game's particle system. In the prototype, we had basic 2D particle support, but no billboarding. We also had a few nasty memory problems, and game breaking glitches related to our half baked particle engine. Now, we use geometry shaders to render particles which takes care of billboarding automatically. Divakar also fixed most of the memory and performance issues related to the particles and added some really nice looking effects to make our game's visuals pop.

Still to come: Shadows, FXAA, SSAO, Sexy new GUI



All new art assets




Our art team (Bobby Muir and Vincent Marchesano) worked painstakingly to create brand new models, textures, and animations to show off our game's new graphical capabilities. Bobby and Vincent iterated constantly, often re-doing entire animations for the sake of gameplay functionality and polish. Most characters have an average of about 5 animations.

Revamped game engine and systems

New and improved Level Editor. Grids, navgraphs and triggers oh my!

As lead programmer, the largest chunk of my time was spent coding our game engine. I would say 60% of the time I spent coding was invested into our level editor. This was the tool that allowed us to bring all of our assets together into a unified experience.

Our prototype editor contained only the basic functionality to place walls and monsters. After we ran our second pass on the game's code, much of the back end was scrapped. This was because of the transition to OpenGL's retained mode rendering. All of the basic building blocks of our prototype were using deprecated graphics code and strange proprietary math libraries. As a result I spent a large amount of time revising just about every aspect of the game's code, from the locomotion and animation systems, to collision detection and AI. The editor also received a plethora of upgrades including grids/gridsnap, dynamic navgraph creation,  intelligent spawn point creation, and basic switch and gate triggers.

I didn't spend all of my time working on tools however. The final stretch of development (of the current build) was mostly spent on gameplay improvements. I was finally able to implement melee combat (for our second lead protagonist, Shara), and I made countless changes and improvement to the game's controls and gameplay in general. My goal was to make movement feel as smooth as possible, and to create accessible yet deep combat.

My favorite new feature has to be see through walls (occlusion control)





Original soundtrack and effects

Not everyone knows this but, music is probably the only thing I love as much as video games (don't tell my girlfriend I said that). The current demo build of GTFO features an original track by yours truly. In this song (originally titled Halloween) I play guitar, bass, and keyboards (synth flute + drums).

Our sound producer Gianluca Leal produced/recorded a gargantuan amount of sounds, not all of which managed to make it into the game. But those that did continue to make me feel warm inside almost daily.

Conclusion

To close this blog, I'd like to say that I'm extremely proud of the work that my group and I have been able to produce. It would not have been possible without the dedication and hard work of everyone who contributed. This game has been our top priority since it's conception, and we will continue to try to make it into something great.

A final note to any professor's who may be reading/grading this submission *wink*

Our team is first and foremost dedicated to making great games, no questions asked. Not all of us have been keeping up with blogs, but that's because we've instead chosen to make a stellar product as opposed to writing about one. Please take this into consideration when you grade us!

Thanks for a great semester,

James Creavalle



No comments:

Post a Comment