Shader 1- Spooky Eyes
My first attempt at a complex shader is almost complete, with feedback and optimisation fixes left to do. I am basing the shaders on a horror theme, as I had not explored this genre in my work yet. Because I am quite behind on tech art, I had to watch many shaders tutorials during my work, and many of the functions are based on functions used in those tutorials.
I encountered many problems along the way, mainly how to pack and arrange textures so there would be no re-entry. The eyes might need their own base colour texture, as they currently use masks to create their colour. The holes that open up in the fibers needed constant tweaking, as they would overlap and interfere with each new feature I added. All of the textures were created and packed in Substance Designer, with the alpha channels added in Photoshop.
I started off with a parallax occlusion function that moves the texture according to the camera angle. I got this from a volumetric ice tutorial, and I used it to push the environment texture back from the fibers. It also gives the illusion of the eyes following the player, which I hope to turn on and off using a switch node. The function is driven mainly by a custom reflection vector, which is then multiplied by the normal z-depth and the inverted texture resolution to lock the effect to the correct size and depth. This then gets added to the texture coordinates of the texture samples of the "lower" layer.
The eye colour is formed by adding and subtracting the eye mask, shape and colour mask. These then get modified and appended to form the base colour. The blinking is created by subtracting the alpha mask (a linear reflected vertical gradient that begins white on the top and bottom) from the eyes' colour, and is then used as a mask to lerp between the eyes and the environment material. The movement of the blink mask is created by a looping time node which goes through sine and cosine modifications. These are added together to create slight variation in the blink frequency.
I introduced movement to the fibers by using another looping time node, similar to the blinking function but with different settings. The movement is masked by a fresnel, which is also used to mask other parts of the shader. I added some depth to this movement by multiplying it by a four layer mask created from the fibers in Designer, which offsets the movement so that the fibers furthest forwards have the biggest range in movement.
The normals are lerped together using various masks created from the eyes, fibers and peek holes. I had to multiply the envronment texture in order to give it more definition, and I had some trouble finding the correct masks to use as alphas. Each environment texture was also converted to a parameter, so it can be replaced depending on the required texture in the material instances. The emmisive colour is controlled by the fresnel, and adds a purple light to the fibers closest to the player.
I used round and saturate nodes when subtracting the peek hole masks to give the impression of the fibers retracting, rather than circles being subtracted. The rest of the graph contains each section being combined to give the final, unnerving result.
Comments
Post a Comment