top of page

Graphics Programming and Shaders

I am a keen graphics programmer and when I get an idea I like to attempt to develop interesting shaders in my free time and side projects.

While many of my best shaders remain under NDAs I have a few examples of my work so I've dedicated this page to examples of some of the more successful shaders which I have made in my free time and talking about how they work and the theory behind them.

All my shaders are made with Unity's ShaderLab and Nvidia's CG language, most of them are vertex and fragment shaders but I have more recently began to experiment with more surface shaders and extending Unity's Standard PBR shader.

CUE and Eerie Worlds Shaders

During my time at Avid Games I developed countless bespoke shaders and visual effects, during the development of Eerie Worlds I used AI generated images to create high fidelity visual effects.

I'll be doing a breakdown of some of the different shaders and effects here soon.

GreenGlow.gif

Cartoon Face & Fire Shaders

Heavily influenced by the character Calcifer from the movie Howl's Moving Castle I wanted to try and create a cartoon fire shader and face with smooth transitions to emulate a hand drawn style. So far I've only had partial success with the background fire effect still being a bit noisy. I am however quite pleased with the cartoon face effect as a proof of concept. It has 3 expressions from one texture on the red, green, and blue channels, then a second texture to  use as a mask where the gradient defines the animation transition. The shader reads these textures to smoothly transition between expressions in a predetermined way. While there are obviously many limitations to this method such as the amount of expressions and you can only play the transitions as the gradient/mask texture dictates. However it does create an interesting art style and proved to be a fun tech art prototype/side project.

PBR Snow Shader

With this snow shader I wanted to experiment with extending the standard shader in Unity. It has standard metallic and gloss on the main texture and blends in a separate snow decal from a secondary texture and applies a different normal map to snowed areas. The effect is boosted my a parallax heightmap that is only applied over the snow areas to create the illusion of buldging heaps of snow at a distance.

Starburst shader

Just an experiment for fun to see if something that would normally use a large texture with a lot of alpha could be generated mathematically, and as always maths does not disappoint. The shader works mostly in the fragment function, calculating first the location of the fragment in relation to the centre in UV space. Once we have the position we can calculate how large each segment of the starburst needs to be from the number of segments input slider, this is done in radians.
Once we know the position of the fragment and how large in radians each segment of the starburst is it is simply a case of calculating if this falls in a odd or even segment using the mod operator and setting the alpha to 0 or 1 accordingly. This is then manipulated further by the fadeoff variable sliders to create a smooth fadeoff towards the edges of the starburst.
Rotation is achieved by simply adding the time value to the calculated radian angle of the fragment to offset where the rendered fragment will lie.
There are some caveats to this approach; most notably the fact that the calculation only looks at one quarter of the texture at a time, so the animating starbursts rendered actually only move 90 degrees around the texture and then reset the position, for this reason the total number of segments must be divisible by 4 in order for the animation to transition smoothly over the axis of the graph without visual artifacts in the form of uneven sized segments. For ease of use the shader enforces having a number of segments that will work visually, as close as possible to the number of segments given on the input slider.

Watercolour and Ink style shaders

After leaving university I had an idea for an game artstyle inspired by traditional japanese line drawings, and experimenting around this developed into trying to emulate a watercolour paint on paper look. The idea was for the whole 3D game wolrd to be set on an aged and stained piece of paper, experimentation ended after I found a job.
I played around with the depth buffer to allow the skybox to render through objects but also took influence from cell shaded game styles to create an ink effect by scaling up the back facing triangles and rendering them black, I also tried to offset and weight these lines to create an outline reminiscent of brush strokes, but had limited success.

Render through walls shader

Based on the watercolour and ink style shaders shown above, the idea behind this shader (used in my game Life Over Time) was to render a wall as invisble so that the skybox and other objects behind it were visible but the room contained was not. This effect was used to create an abstract environment.

Ripple shader

Trying to build on a simple rain shader I wrote several years ago, this is still a work in progress. The idea is to map a ripple in a pattern across another texture and then simply animate it as a normal by reading a value from a texture over time. Currently this is limited by being dependent on a (fairly time consuming to create) texture. The end goal is to come up with an algorithm and plug in some variables on sliders to create a procedurally generated pattern to get over this limitation.

 © 2020 Pieter Sebastian Jollans.

bottom of page