I. Features
1. Shadow Volume Feature
The shadow volume feature uses a reference mesh to generate shadow volumes. This mesh is then assigned a geometry shader which extrudes triangles away the light source. The modified mesh is rendered as a shadow volume using a transparent black material.
For Sprites, you can generate this quickly using the sprite's outline verticies.
- Make sure the sprite renderer component is at the root game object and is its own prefab file.
- Adjust the Sprite Shape if required, by clicking "Open Sprite Editor" and making changes to the shape.
- Right Click the SpriteRenderer component
- Choose "Generate Shadow Volume"
- Manually adjust the location, rotation and scale of the shadow volume, if required.
- Be careful never to manually delete the ShadowVolume Node from the scene tree. Always Right Click the Sprite Renderer and choose "Remove Shadow Volume" option. This is because the shadow volume saves the material and mesh as a separete asset inside the sprite prefab file. When manually removed, the saved assets will permanently bloat the prefab file even though they are not being used.
For 3D Meshes:
- Copy paste the mesh as a child of itself and rename this child "ShadowVolume"
- Assign this child mesh the Material "Custom/Shadow-Volume"
2. Cutscene System Feature
Cutscene system is a collection of three things:
- List of slide (1 Image + 1 Subtitle) to be shown on screen, in an order
- A UI to display a slide with a skip button to go to the next slide
- A block of code that can switch between UI Input and disable all player inputs (Currently inside the Class StarterAssetsInputs)
It is managed by the CutsceneStageUIManager Class, and it can be used globally as follows:
// Sample code which will trigger the cutscene
GameObject player = GameObject.FindWithTag("Player");
StarterAssetsInputs playerInputs = player.GetComponent<StarterAssetsInputs>();
playerInputs.SwitchCutSceneInputs(true);
// Load cutscene information
CutsceneStageUIManager cutsceneStage = GameObject.FindGameObjectWithTag("UIParent")
.GetComponentInChildren<CutsceneStageUIManager>(true);
cutsceneStage.ClearSequenceList();
cutsceneStage.AddSequence("This is subtitle text", Resources.Load<Sprite>("Cutscene/Sage1"));
cutsceneStage.AddSequence("This is another subtitle text", Resources.Load<Sprite>("Cutscene/Sage2"),
CutsceneStageUIManager.CutsceneEntryDirection.Right);
cutsceneStage.OnCutsceneEnd = (idx) =>
{
playerInputs.SwitchCutSceneInputs(false);
return idx;
};
cutsceneStage.BeginCutscene();
3. Skybox Feature
The skybox uses a custom CG SHader to blend between three cubemap skybox textures: Full Day Time, Sunset/Sunrise & Dark Night Time. The shader assigns three floats to each of these skybox textures, then makes a vector of these floats and normalises this vector. It then blends between the three skyboxes weighted by this normalised vector in order of the skyboxes defined above.