Showing posts with label Ludum Dare. Show all posts
Showing posts with label Ludum Dare. Show all posts

Sunday, June 29, 2014

Ludum Dare 29: 72 Hour Jam Game: The Fields



The above video has a breakdown of game design and technical art decisions made while making my latest jam game "The Fields". Hit the jump for a link where you can play the game, a quick synopsis of the game, bunch of links about shaders and graphics programming.

Sunday, May 4, 2014

Physically Based Shader v0.10

So I started learning CG a few weeks ago (partly inspired by an awesome GDC talk by Sean Murphy) in order to build a physically based shader. This here is the first version of that shader:


The shader takes four texture maps: "main color", "smoothness", "metallicity", and "normal". The main color gets split into the specular and diffuse map based on the smoothness and metallicity of the material. The specular contribution is a normalized Blinn-Phong and the diffuse contribution is an NdotL normalization that I made. Using a "light wrap" property, the material can transition from a lambert, to Valve's half-lambert, to a perfectly translucent material. This wrap can be used to help emulate partially bounced light and subsurface scattering with minimal additional cost. Both the spec and diffuse contributions are affected by a fresnel term that is softer on rough materials and shallower (due to a higher base reflectivity) on metallic materials. I also decided to use a physically-inaccurate attenuation model that uses a gaussian curve instead of the square of the distance. This sort of falloff is much easier to work with in a practical case because near to the illuminated object, it better models the light coming off an object that is not an infinitesimal point. This attenuation is currently calibrated to work best at ranges up to 15 meters (after which, the contribution of an individual light falls effectively to zero, and the light can be culled).

I had this shader nearly finished when Ludum Dare 29 started last weekend, so I used it all through the production of "The Fields" in order to test the shader's applicability in an actual production.

Rabbit in a minefield; lit by one directional light and an ambient.
I'm happy to report that it went pretty well! I discovered a bug that caused negative lighting in very rough, very metallic materials, but luckily, I was working in a game that only had rocks, dirt, wood, grass, and bunnies, so it wasn't much of an issue. After LD, I went back and fixed the bug (a problem in how I was normalizing my spec contribution that could cause it to go negative) and here we are at version 0.10!

Since it doesn't take very many maps and two of the maps are black and white, I found it pretty easy to work with and maps were generally pretty easy to generate. Everything except for the wood is hand-painted, and the only things in the scene not using the physical shader are the alpha cut-out materials. I hope to have a greater variety of colors and materials to shade in the next use case; World War I is not a very vibrant setting.

I still have a ways to go. The current shader uses the unity ambient light to determine non-direct shading and environment reflectivity. This looks okay on rough materials and diffuse materials, but becomes obviously flawed on specular metals -- especially when they have a not-very-noisy normal map. Next version will support RSRMs that will either be stand-alone reflectance maps, or will be overlayed on the ambient light and provide more value information than color. I think I'll add support for cube maps, since the main point of this shader is to be easy to work with and cheap to render, and I find cubemaps (and their mips) to be a pain in the ass to generate and work with (you can only ever appreciate them on extremely smooth surfaces, and if you have a lot of those, the failures of non-parallax corrected cubemaps start to show anyway).

Thursday, December 19, 2013

Ludum Dare 28: My 48 Hour Game: Flee to Light

I completed my first Ludum Dare! 48 hours to produce everything... all new code, all new art, all by myself. I'm super proud that I got as much done as I did (though that doesn't include any music or sound) for my first attempt at the challenge. I may try the LD Jam next year so as to have some more time/resources/people to make a more finished product.

That aside, here's the game I made! It's called:


"Flee from skittering shadow creatures. The only defense you have is light. Protect your torch and it will protect you. Accidentally throw it in the water, and you're doomed. 

Light up bits of wood in the environment to clear a path or to make a temporary bonfire to drive back the creatures. Light up lanterns to (semi)permanently protect an area. Don't get too comfortable, because the longer you stay in one place, the easier it is for the creatures to find you. Find and light all ten (six are near the end) lanterns to open the exit."

To play the game yourself, click here.
(Windows, Linux, and Mac)

To watch a time lapse of the work, hit the jump.