Shader 3- Versatile Crystal

The crystal shader is the simplest of my collection, so I decided to make it as versatile as I possibly could. I used the first section of an Artstation tutorial by Kurt Kupser as a base, and I added my own features from there. This shader uses numerous switches and parameters, which gives the user complete control over whatever they need to change. I began adding cracks damage for when the player shoots at the crystal, but as today is the formative deadline I decided to make it a stretch goal. I also need to create a high poly cube and bake it to use for some instances of the shader, as the cube currently in my level is using the baked maps of the crystal mesh.



Most of this shader's features are controlled by the baked thickness map, which should vary depending on the mesh. The power node controls how much the edge colour spreads, and also controls the subsurface colour. 

The parallax occlusion uses the same logic as the blinking eyes, but this time I decided to use a material function, as it got quite messy. The middle layer of the crystal utilises bump offset instead; I thought this would be cheaper, as I only required a simple version of PO to move the middle layer's mask. The movement height is controlled by the detail normals, which gives the surface of the crystal more or less opacity based on the relevant scalar parameter. 

The emissive section possibly has the highest concentration of versitility, as I wanted to include the option of having a dynamic eye (or another shape) or a static light, with a further option to make the light flicker. The emmisiveis also masked by the middle layer, as I wanted to allow the user to have further control over the emmisive shape, creating more options for crystal variety. I also duplicated the eye in order to create a static rotation effect, with both eyes rotating in opposite directions. 

I used an interesting technique from Kupser's tutorial to create a strong reflection on the crystal. It involves using a HDR combined with world space normals to give the illusion of world space reflection. I had to add a roughness control to counter this, as the reflection makes the object appear extremely shiny. 

This shader taught me how to group parameters effectively, as there are too many options to keep track of otherwise. I also learned more about what artists expect from shaders; the options that should be available, the expected parameter ranges and ease of use. I used several multiply nodes to bring various parameters into ranges that made sense, further increasing the UI efficiency. Another feature I wanted to add was to make the eye follow the player, so I attempted to use a fresnel node to manipulate the UVs. However, this did not work, and neither did my various camera vector experiments. The closest result I managed to achieve still moved the eye in panning view space, after I got everything else to work. 

Comments

Popular Posts