Shaders made when working at Unity

I did a few advanced shaders when I was working at Unity during some of my free time in order to test Shadergraph's functionality. Most of these were made in Shadergraph with HLSL code to handle the more complicated functionality. Here are a few I made:


Decal blend shadergraph

Using decals, you did not at the time have access to the underlying normals; to test the position node in Decal shaders being fixed, I did some clever blending of redirected normals on top of the geometry normal calculated with ddx/ddy of the position, and based on the z value of the normal map of the decal, modified the normal opacity so it would blend to the surface about as well as you could expect without having access to the underlying normals.

Force field effect

My attempt to use multiple depth texture samples to make a forcefield effect that doesn't stick to the underlying surface, but instead forms around it.

Advanced pong shader

This shader plays a game of pong with itself. There is no c# code keeping track of the balls of paddle positions; all of these are calculated deterministically using only time as the input.

PS1-like shader

To test the new Custom Interpolators, I made a shader to simulate the appearance of lighting in a PS1 game. Uses multiply-based vertex lighting, vertices snapping to pixels, and an effect to simulate the warping of PS1 polygons due to affine texture mapping.

Raymarched fractal

Uses a dividing planes algorithm to render a gigantic amount of spheres at O(log2n) time. Calculates color, normals, and ambient occlusion, and resizes the spheres based on distance to allow for large amount of detail while reducing visual noise while zoomed out.



Stochastic anisotropic reflections

Uses a blending algorithm to result in good looking anisotropic reflections blended by TAA - only one sample per pixel!



Stochastic depth-smoothed shadows

Some clever sampling and math along with interpreting a lightmap's depth values directly lead to this innovation, where shadows will blur as the object gets farther from the plane the shadows are being cast on:



Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square