Friday, December 12, 2014

VFX Reel 12-11-2014

Since I'm applying to some new jobs recently, I decided to collect and demo some of my recent VFX work. It's mostly particle work, but there's a bit in there about the new ribbon component I'm working on which is meant as an upgrade to the existing Trail Renderer in Unity and a quick mention of my new particle shaders, scene color control script, and the shockwave script I wrote to make my explosion effects more dynamic.



The particle shaders I wrote have their own dedicated video:



And my other recent shader project, the Simple Physical Shader set, is detailed in another:


Monday, December 1, 2014

WIP Ribbon Component

I've been doing tests recently for a ribbon effect system. It is meant to give some more functionality to the normal Unity Trail Renderer Component. Ribbons, unlike the trail renderer, can move around after being spawned. It can do things like inherit velocity from its emitter object, react to gravity and wind. spawn with velocity along some worldspace vector, and move around with perlin noise.

You can also put a scrolling texture on it to help sell the illusion that the ribbon material is hanging in the air.

Saturday, November 15, 2014

Physically Based Shader 1.1: "Simple Physical Shader"

My physical shader is now released! Check out the demo video for Simple Physical Shader 1.1:


Learn more and get the playable demo here:
http://ryangatts.weebly.com/simple-physical-shader.html

Get the shader on the Unity Asset Store here:
https://www.assetstore.unity3d.com/en/#!/content/22143

Simple Physical Shader is a general-purpose physical shader that is intended for users who are new to Physically Based Rendering (PBR) and want a simple shader that can be mixed and matched with the Unity default shaders.

Simple Physical Shader works on Unity Free, on any devices that support Shader Model 3.0, and was developed to provide a usable PBR shader for projects that don't use HDR or linear lighting and for users who don't want to worry about baking out cubemaps. It uses maps that are human readable and easy to generate.

It's still under development, so expect support for core and edge retroreflectivity (for safety vests and velvet materials) as well as one that has a second specular lobe (for materials with a clear coat on top like car paint or wet skin).

Tuesday, October 28, 2014

On Internet Arguments, Feminism, and GamerGate

I've been having a pretty interesting discussion about criticism, feminism, and videogames on Youtube, and I felt a need to preserve it, so I'm copying the conversation here. What I find interesting about this conversation is that as it has gone on, the anger and immediacy of the conversation has worn off, and we've managed to find some common ground.

I haven't written much about feminism or representation in videogames here, but it is a subject that is close to my heart. At least part of my posting of this was prompted by FilmCritHulk's excellent and amazingly empathetic essay here: http://badassdigest.com/2014/10/27/film-crit-hulk-smash-on-despair-gamergate-and-quitting-the-hulk/ . I want to try to bring to bear some of his calm demeanor in my own discussions -- especially around touchy subjects like GamerGate and feminism. I have these kinds of conversations all the time, so I felt the need to time-capsule this one up as an example. This is not an example of someone winning an internet argument. This is not me bragging about how good I am at arguing on the internet. This is just an example of two people managing to reach some amount of common ground.

This conversation is in response to the ExtraCredits & IdeaChannel collab video here: http://www.youtube.com/watch?v=7lPUlN0dnKk

Fair warning: this is a really long internet argument that turns into a really long internet discussion.

Monday, October 20, 2014

ShaderLab + CG highlighting for Notepad++

I finally got around to fixing my style and code highlighting for Unity Shaderlab CG in Notepad++. If you want something similar you can download it here: link
To import it, download this file to Appdata>Roaming>Notepad++ . Then, in Notepad++, go to Language>Define Your Language... and click the import. Make sure you set your global background style to something dark (Settings>Style Configurator>Enable Global Background Colour).

It's based on Luiz Alvarez's CG highlighting, with some color style edits to make it look better and work on a dark background, and additional keywords added so that major shaderlab terms are highlighted.

Tuesday, October 7, 2014

Hatching Shader

I was troubleshooting some shader problems on the Unity forums, and ended up overhelping and making a pretty decent-looking crosshatching shader (if I do say so myself). Here's what it looks like:


The UV math is a little messed up, but I think it looks pretty cool :D.

---edit---

(can't stop. won't stop) I went ahead and fixed the uv math. It now uses the UVs of MainTex rather than of Hatch0 as it's main input. I was going to resolve (read: "re - solve" as in "solve again") all of the other UVs separately, but it made the inputs a pain to set up when making a new material, so I just left the Hatch Density input.

Friday, October 3, 2014

Explosions with shockwaves

So, implementing this in a dynamic way is still giving me some lingering sorting/rangefinding problems, but I think this effect has legs :)


The green lines are debug. The explosion effect performs a check to see how far away it is from the ground and then spawns user-defined secondary effects based on how close it is. These effects also fade out the farther away the explosion occurs (by manipulating the start color alpha value of the shockwave effects). As you can see on the left, those two explosions are close enough to the ground to kick up a vertical column of debris underneath them. The explosion on the right is too high, and only spawns the shockwave ring. 

These effects can also be delayed slightly to give the impression that it took time for the expanding pressure wave to reach the ground and kick up the dust.

You can also see the sorting errors that are currently causing me trouble :/ Unity never has been very good at sorting particle effects. Does anyone know a good way around this problem?

Thursday, October 2, 2014

Lit Particle Shaders Demo

I've been working on some custom shaders for Shuriken particle effects in Unity. The main idea is to fill gaps that currently exist in the available alpha blended material.


Crucially, the default alpha blended material does not receive light from the scene -- not ambient or direct illumination. I originally wanted to also support point lights, but with the current limits on what data you can know about particle positions and normals, it ends up being a fairly complicated and performance-prohibitive feature.

That's why my shader supports lighting from directional sources and ambient sources. I did manage to get vertical hemispherical lighting working, so particles can receive disparate lighting from the top and bottom (either directional on top or on bottom).

There's also not good default way of modelling emissivity in particles. You have to either have two particle systems with two different materials one alpha and the other additive, or take what you can fudge from the alpha blended. I found myself always making "glow" particle effects to play alongside other effects, so I just wrote a shader that supports that kind of effect by using multiple passes and materials. Unfortunately, Shuriken can only pass one float4 value through the vertex color input of a CG program, so the "color" values in the Shuriken system only refer to the glow color and the general alpha of the particle. The "background" color of the particle can only be adjusted per-material. This turns out to not be much of a problem in practice, though, and it's an unambiguous step up from the default workaround for this effect.

Anyway, I hope to make it available for purchace on the asset store shortly.

Monday, September 29, 2014

Some Particle Flipbooks

I've been working on various techniques for making particle flipbooks easier to author. I've done some tutorials on fire and smoke (you can find them on my youtube channel), but I want to share a sort of gallery of effects I've managed to get and how I got them.


So, initially, I was trying to reproduce the look of GTA5's particles, so I tried baking out fluid simulations from Maya. The sim on the right was solved in 2d and was pretty quick to solve and render. The one in the middle was solved in 3d and was really really slow to work with. These two both have nice subtle animation, but they took forever to set up and to bake. The one on the right is generated completely from turbulent noise effects and masks in After Effects. I felt a lot more control here, and it was much faster to make (I'm very comfortable in AE, though, so your milage may vary).


These two effects were both hand made without a sim. The one on the left was made using the same kinds of noise effects as in the smoke effect above. The one on the right was animated as traditional frame-by-frame 2d animation in Flash and then modified in After Effects to add detail. I have a tutorial for how to do this on my Youtube channel, but suffice to say, it gives you a lot more control over the final look of the effect. That said, this technique doesn't scale well to effects longer than 32 frames long (or 64 if you're really patient). Because it relies on hand-drawn animation rather than tweens, as you double the length of the animation, you double not only the cost of keeping all the sprites for the animation in memory during the game, but also, you linearly increase the amount of work to make the effect in the first place, which is a problem that tweens don't have.

Anyway, feel free to ask questions if you have any. I have many many more flipbooks than these, but the ones here are fairly representative of the various ways I've tried to solve fire and smoke systems.

Thursday, September 25, 2014

On Definitions of a "Game"

I recently responded to a Cynical Brit video about Glitchhikers and "what it is to be a game". The post is a little long (I am given to a certain amount of pedantry), but you can read it after the jump.


 tl;dr: Brit thinks "games" need a failure state; I didn't agree. More after the jump.

Wednesday, September 10, 2014

Physically Based Shader v0.2

Just a quick demo on progress. You can also see my in-progress lens flare controller in this scene! I made this video to show off my progress at a Unite party. I'm actually a little bit farther than this level of quality now, but that will have to be for later. I've decided I'll be submitting it for free to the Unity Asset store shortly!

Wednesday, July 30, 2014

Pontificating on a Different Kind of Particle...


I have a tendency to write overly-long youtube comments. This one was on a video of someone showing off a high powered laser popping balloons...

Friday, July 18, 2014

Quick Point-Lit Particle Update



I have an upcoming video I'm working on going over a bunch of utility scripts I've made just to speed up my workflow in unity, and I've finally solved (well enough for the moment anyway) one of the most persistent problems I've had: point-lit particles.

It's a true pain in the butt and no one has really solved it (lots of pretty good attempt though) due to the particle vertices being located in camera space and not world space (where the lights are). Farfarer has made strong progress in solving this translation problem, but his solution did not work the way I wanted it to, so I made a simpler -- if less robust -- approximation to be used here.

Anyway, look forward to more soon! The other scripts I'll be showing off are also running in this scene, but I'll get more into that next time.

---Edit from 2 months in the future---

You are so wrong. This is not the right way to solve this, and your idea won't work :P

Sunday, July 6, 2014

Physically Based Shader v0.12

More progress on the Physically Based Shader for the free version of Unity. I've improved the math for the ambient diffuse contribution. It should now behave very similarly to hemispherical ambient light solutions you might see elsewhere. Next I'll probably re-tackle the math for how the ambient light setting is combined with the RSRM. The one I'm using still ends up a little too saturated in extreme lighting conditions -- though it's really not noticeable in most scenes now.


This scene is wearing out its usefulness in demonstrating new features, so this may be the last time you see the bunny, the rocks, and the kyles like this. I actually broke this scene in the latest version of the shader and had to reset the material settings, lights, and camera by eye. :/ The shader can cast and receive shadows now and I've fixed a bug that couldn't be seen in this scene where objects that were lit by multiple point lights would double accumulate fog.

In the new scene, I'll also be showing off new tools for wrangling scene render settings, skybox tint, key light settings, distance fade-able flares, ambient light-skybox calibration, and a fog light scattering approximation. So stick around for that!

Hit the jump for a couple more pictures including just the ambient contribution and some different lighting conditions.

Tuesday, July 1, 2014

Face Contouring Makeup

I was taking some notes on basic makeup layout for "contouring" which, for those uninitiated, is using makeup to emphasize attractive contours of the face by highlighting or shading. I only made them as part of my personal note-taking, so it's all way overdone and not very subtle, but I thought I'd share them here as they are broadly applicable to painting, modelling, and texturing of faces:


Other than the red, the colors are not meant to be taken literally, but as broadly representative of either darker shading makeup or lighter highlighting makeup. Hope it helps somebody to have this laid out for them clearly :).

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.

Thursday, May 8, 2014

Physically Based Shader v0.11

RSRMs are up and running on my PBR shader.

Local point lighting.
Directional lighting from behind camera. Materials are exactly the same.
Here's a quick demo of the setup. You can see a material with various levels of smoothness and metallicity:

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).

Sunday, March 30, 2014

Particle Effects for Unity 02: Wispy Smoke

After some delay, here's my second Unity particle effect tutorial covering wispy smoke that you might see from thin steam, or relatively cool wet smoke.


Subscribe or check back for more.

Saturday, March 29, 2014

GDC 2014: Day Two

Slight delay on day 2 due to suddenly being sick. Anyway, on with GDC coverage:

Tuesday, March 25, 2014

GDC 2014: Day One

I love GDC. This is my second year attending the conference, and I doubt it will be my last. These are some blog/journal entries I made during the conference a week ago. I'm cleaning them up and posting them here to help a reader understand what they can get from GDC on a professional/educational level and to remind my future self what exactly I did each day (and to actually have some content for this blog). All words like "today" or refer to about a week ago from time of posting.

Saturday, February 15, 2014

Female Muscle Study Sculpt 01


I picked up 3d Coat a while back and have been playing with it's sculpting tools. Long ago on this blog I started an ecorche in Sculptris but had such trouble with that style of sculpting in the Sculptris interface, that I abandoned the effort. I really would like to have seen what Sculptris would have become had Pixologic not defensively bought them so that Sculptris wouldn't grow up to compete with Zbrush. (For those unaware, Pixologic bought Sculptris in 2010 and hired the sole developer. I'm sure that was great for him, but it killed Sculptris. It's still available for free, but hasn't been updated since it was bought except for the addition of a GoZ button, which seems insulting to me...)

3D Coat is nice, though. I'm getting a better sense for when I should be working in voxels and when I should be working in surfaces/polys. I think I'll really start being able to do finished work in it too!

Now if I could just get clean normal map bakes out of it we'd be golden.


Sunday, January 5, 2014

Ben "Yahtzee" Croshaw dressed as Andore from Final Fight etc.

For context, this picture was requested in this youtube video at around 32:40:



Hit the jump for the image...