Creating a Cloak Effect

It has been a while since I have done any type of tutorial or any technical related blog post, so I thought I would share the process of how I implemented a “cloak” effect on my character. Essentially in my game, I am adding a cloak skill and in order to visualize this to the player I want a sort of holographic semi-transparent cloak effect. Something magicy and Sci-Fi. So I jumped back into my shader coding.

If you need a quick refresh of the make up of shaders in Unity then here are a couple of previous posts (with horrendous typos that I should porbably sort):

Unity Shader Tutorial – A look at a basic surface shader

Unity Shader Tutorial – a look at a basic vertex and fragment shader

Cool, let’s do it.

First we start by creating a Surface Shader and then strip it back so it just performs diffuse lighting, a good starting point for all shader creation.


Firstly in our properties section we are going to add… well… a new property


Which will expose the following “_DotProduct” float value to the editor that we add in our CG Program.



We also want to add a _MainTex property value pair into our shader.

We also want to change the tags.


This will render the shader in the transparent rendering queue and will ignore projectors. If we want, as the player character is becoming invisible, we can also add the “ForceNoShadowCasting” tag that will mean the object does not cast shadows.

We also want to disable the expensive PBR in this shader and switch it out for Lambertion reflectance before telling the CG program this is a transparent shader and then finally disable the lighting. Wow that was a long sentence.


The last thing we want to do before we actually jump into our surface function is change what actually gets run into the shader. In this case we want the world normal and view direction as well as what is already there.


Cool, now we whack this code in the surface function.

And we get this effect:


On a sphere it looks pretty basic although it makes a cool atmosphere effect one, similar to the one I used in my seasonal globe:

What this shader is doing is actually showing the silhouette of the object. If I swap the circle out for something else and we move around it we can see the outline changes.


After I tweaked the values a bit and applied it to my asset store model, here is what I got:


The gif doesn’t do it as much justice as in-game, but I actually think this is quite cool and that shader is cheaper than the previous refraction shader I was using.

I also had a little experiment for fun with my enemy model by adding a wave to all the verts and made what I am calling the “Demontor” shader





Story writing

This month is the national novel writing month or NaNoWriMo. It is something I have taken part in before (but I have never finished a novel in that time), however this time instead of writing a novel I am going to be writing the story for my game, but instead of just starting jotting random crap into a notebook like I do usually, I am approaching it differently.

My friend pointed me in the direction of something called “The Snowflake Method”, a method created by a software developer that apparently works really well. You can read about it here, but the crux is you start small and build it up, like you would do a bit of software. Right, enough talking about it, time to actually do it!


New Game Dev PC


Unfortunately my little game dev pc (also dubbed as “the micorwave”) bit the dust this week. It had lasted 3 and a half years and had done me proud, but the motherboard ports all died on me at once. Nevermind. So I had to quickly rebuild. It is nothing special, but it will work nicely for what I want to do. I do want to replace the graphics card soon to a 1050Ti mini, but for now here are the specs:

  • Windows 10 64-bit
  • Intel Core i3 6320 (Skylake) @ 3.90GHz
  • 8GB DDR4 Ram
  • Radeon HD7790
  • 128GB SSD and a 1TB HDD