Tuesday, September 22, 2015

Day 30: Wrapping Up Shader Study and Operation DeepSpaceNine

Today we finally started up our next prototype project, currently named "DeepSpaceNine" for semi-appropriate reasons. This is the first time we'll be integrating Unity into Perforce, so hopefully we'll be able to separate the actual necessary files (Assets, ProjectSettings) from the Unity and Visual Studio generated folders.

As for the rest of the shader work I completed today, I did a couple of other interesting things involving shader lighting. First off was translucent objects, mainly flat surfaces. This is a bit different from transparent in that lighting is allowed to show through (calling for diffuse reflections with the reverse view direction and reverse normal direction) but not the objects behind it. This results in an interesting translucency that is shown in this plane below:

The translucency can also be applied to bodies like spheres, but the process requires quite a few passes. The amount of light that passes through an object increases when the distance between back and front is closest, or nearest to a silhouette. By taking the original faces and blending it with the lighting from behind, we can produce a waxy figure. The lighting is a bit faint when pulled through a sphere, so the translucent color has been shaded red to note the amount of light shining through an object:

Lastly, I had a shot at using specular and diffuse reflection for toon shading, or by cartoonish cel-shading. The outlines and specular highlights were included to ensure the points at objects where specular reflection and closeness to a silhouette could be observed were outlined with varying thickness based on those values. The diffuse color was also split between a simple light and dark color that varied based on the dot product for the diffuse reflection (more direct gets light color, closer to 0 gets dark). When applied to the scene, the specular reflection may result in some unusual shadowing on objects (which may just be removed in way of the outline) but is one of the more impressive products of lighting in a shader:

The sphere was a bit bland to show off the product, so I incorporated a free dragon model to show off these shadowing and cartoonish outlining for a simple cel-shader.

Unfortunately, it's likely I won't be implementing too many of these shaders in the upcoming project, but they may come in handy.

No comments:

Post a Comment