Posts

Showing posts with the label outline

slightly better outlines

  This approach to outlines is a bit more robust & adds outlines to areas within the shape's silhouette - eg details around say the nose and eyes, vs just the outline of the head. It utilises passes - first drawing the shape as normal with a standard struct input and void surf... then adding outlines on top using a vert-frag shader. This is quite cool to see both surface and vert frag shaders being mixed Things to note - we Cull the Front...We're essentially rendering the inside of the mesh as the outlines. I've found an explanation online about this shader, pasted below the code.. From the docs - UNITY_MATRIX_IT_MV Inverse transpose of model * view matrix.   I'm not entirely sure what is happening with this code - but I'm fairly sure we're taking the vertex normal and multiplying it by something, before getting it into screenspace.  Shader "Dave/Unlit/advancedOutline" {     Properties     {         _MainTex...

simple outline shader, using the vertex normal

Beneath is a method of drawing outlines around our mesh - or rather, we're expanding the mesh, giving it a flat colour and then drawing the mesh as normal on top of it. Note that we have two CGPROGRAM blocks, which get executed in order. This type of outline requires the transparent tag to work properly, and this could cause problems elsewhere.. Also it only outlines the extremities of a shape - or you could say, just the alpha edges . Next post will feature a more advanced shader    Shader "Dave/Unlit/simpleOutline" {     Properties     {         _MainTex("Texture",2D) = "white"{}         _OutlineColor("Outline Colour",color)=(0,0,0,1)         _Outline("Outline Width",Range(-0.1,0.1))=0.005     }     SubShader{         Tags{"Queue"="Transparent"}         ZWrite off ...