Revision: Full Force, Part 2

Revision: Full Force, Part 2

by ferris

This week was more Revision stuff, and basically nothing else!

Main things I did this week are more scenes (which I can't show yet) and revamping our materials/lighting. Since we want to go for a particular look in some places, and have consistent materials throughout the production, making the move to PBR is a pretty obvious choice.

After catching up on some theory and studying some code (and also stealing some on stream and then messing it all up) I integrated a bunch of it into our tool. To help test, I also added basic shadertoy-like mouse position support in the tool, to make it easier to move the camera around when testing scenes.

From there it was all about making some models/materials and playing with them in different lighting conditions/scenarios. We're still at a "splat everything" phase, but some concrete direction is starting to emerge it seems. :)

Apart from all that, I also took a second look at our chromatic aberration function, with this shadertoy project. This came from a twitter conversation a few months back where a bunch of people were debating whether it would be best to do this ramp in ALU or to have it as a 3-pixel texture. Turns out the 3-pixel texture tends to be a bit faster (likely as there's enough ALU going on already) but both methods are crazy fast anyways. However, during the discussion mentor/TBC proposed a mock branchless version of the ramp function, which was way cooler than my original, so I had to sit down and make it proper :) . The shadertoy project contains all the juicy bits, but I've copied them here as well for completeness:

// Old, ugly branching version
vec3 aberrationColorOld(float f)
{
    f *= 3.0;

    if (f < .5)
        return vec3(1.0, 0.0, 0.0);
    if (f > 2.5)
        return vec3(0.0, 0.0, 1.0);

    if (f < 1.5)
    {
        f -= .5;

        return vec3(1.0 - f, f, 0.0);
    }

    f -= 1.5;
    return vec3(0.0, 1.0 - f, f);
}

// Newer, happy unicorns and rainbows version <3
vec3 aberrationColorNewer(float f)
{
    f *= 3.0;

    float r = 1.0 - (f - 0.5);
    float g = 1.0 - abs(f - 1.5);
    float b = f - 1.5;

    return saturate(vec3(r, g, b));
}

// Newer, happier, unicornsier and rainbowsier version of the above!
//  Thanks to Rune Stubbe for some math optimizations here :)
vec3 aberrationColor(float f)
{
    f = f * 3.0 - 1.5;
    return saturate(vec3(-f, 1.0 - abs(f), f));
}

See you next week!

Last Edited on Sun Mar 26 2017 08:47:56 GMT-0400 (EDT)