Wednesday, July 22, 2015

I'm No Material Girl Afterall

So I was able to get the basic selection cube material working as I wanted, but I got stuck getting the exact gradient that I was looking for.

Here's a shot of the cube:

I was hoping for a bit more opacity on the bottom of the sides, but I figured it wasn't a valuable use of time getting too nitpicky on this right now.

For reference, here's the material:










Basic rundown is that I take a gradient texture and rotate it for times, once for each side.  I then pow each one to compress the gradient, subtract away anything that doesn't meet a threshold, clamp for good measure, then add them together.  I then multiple that by a glow color and value to get a nice emissive brightness.

For opacity, I take the world position of the pixel, subtract away the object's position to get a local position (is there a native function for that? I couldn't find one...).  I then normalize the values, mask to get just the Z, and multiply it by a negative number to cause the white to be down.  Multiply by a scalar parameter and feed that into opacity.

One thing I'm having trouble with is the glow is flickering as the camera moves.  I suspect there's a post process effect causing this.  I had some flickering with my selection circle due to temporal anti-aliasing being on.  It's set to FXAA now, and even though I went through and tried to disable a bunch of settings, I still have it.  Turning off all post processing fixes it, but then I lose my glow as well.

I'll look into this further later.  For now, I want to get movement, targeting, and tiles working.

No comments:

Post a Comment