Finally – a post where I actually make these! I started by adding the custom uvs to the material.
I then set up my emissive in the way I described in the last post. This produced a glowing cloud material. I need to refine the texture, its just a generated cloud right now – once the material is finished I will go back and paint a texture or source a decent photograph. One of the mistakes I made here was that I originally added the texture sample to the B part of the lerp and left the alpha, forgetting that I needed to interpolate between the dust contrast and the minus of it to get a nice movement from no dust to dusty.
The opacity was also set up in the same way as the previous post, making most of the sphere dissapear! This was intentional, as this point was then streched out in the vertex shader.
I then did the vertex shader thought he worldoffsetposition node in the material editor. Again, set up in the previously described way, it stretched out my vertices to create a beam shape. Custom uvs were then set up to support this.
This all seemed fine, but when I applied it to the mesh I had some serious problems.
The beam was red, yellow and green, and in a square rather than streched out beam shape. The first fix I did was sort an edge brightness problem. Originally on my emissive colour, I plugged my dust contrast scalar into the A of a lerp, and one minus the texture sample into B, leaving alpha empty. This gave the shape a fairly solid look in comparison to what I was going for. I fixed this by putting one minusing my dust contrast and interpolating between dust contrast and minus dust contrast, which gave a nice blend of textures, and then using the texture sample in the alpha slot.
The next thing I realised was the part that was sort of breaking the whole material – I was supposed to be using only the red channel of the vertex colour. I am presuming that what this does is affects the vertices on only the Z axis, but my current lack of knowlege on vertex colours is very limited! After changing this in the vertex shader, things started looking a whole lot better.
The colour issue was also caused by incorrect use of channels – when I disconnected the part of the material that creates the individual light shafts, it started using the colour I had actually specified.
Looking back at the example material, I found I should have only been using the green channel. I have done a little bit of googling but I cannot really pin down why this is. Something I need to look into!
At this point, things were looking good, I added it to my scene and tweaked the colours to match. One issue though – it was upside down!!! This one took me a long time to work out. I messed about with the direction of light vector a lot, thinking it was the issue, but in the end what I actually needed to do was minus the red chanel of the vertex colour itself. I tried this on a whim – glad I did!
This is the final effect. I made it a lot more subtle, going for more of a natural light shaft look rather than a supernatural style god ray. I would like to make a few improvements to this, especially in terms of ease of use, making an instance version that less technically minded artists can use easily. Despite this, the exercise was a really good start to help me get into more advanced material creation in unreal.