Shaders- Blueprints/ Functionality

My use of blueprints at this stage of the project mainly focused on narrative. I created a custom HUD, added on-screen text to imply someone is talking to the player, and I used small devices to contain and display my notes on each shader. 


The HUD blueprint only creates a cursor and the intro text, most of the functionality comes from the main level blueprint. This is because the HUD would not take input, such as mouse buttons or trigger events.



The player is kept in place when the intro is on screen by their location being set until the intro is not on the screen anymore. I wanted the player to start in the correct location. Each widget is displayed when the relevant trigger box is overlapped, but I'm sure there is a more efficient way to do this. I made each widget trigger only once by using a bool variable on each event, which is set to false after the event is run. I made a clear widgets function also, as I needed to add the cursor back to the viewport every time it is cleared.



The device blueprint controls all funtionality of the device, the main one being the display of widgets. I had a lot of trouble getting it to work, as the instance index I used to assign each instance a different value kept returning the previous index value right before the correct index. I eventually fixed this by adding a previous index variable and setting it to the index number at the end of the flow. When E is pressed, the blueprint checks if the instance values are equal before continuing. This also means that each device can only be accessed once. Widgets are only displayed if the line trace returns true (when the line is blocked by an instance of the blueprint). This also gave me a lot of problems, but it turned out that switching off consume input for the E key fixed this, even though consume input is supposed to stop other blueprints from using it. The screen is also changed to be entirely green when clicked, as the default image would interfere with the text on screen (another lerp with scalar parameter).


The device material uses a pulsing fresnel/ time function to imply that it can be interacted with. I added a lerp with a paramter accessed by the blueprint to turn this off once the device has been clicked.



I wanted to have the mesh display in the widget when clicked on, so I used a "studio" blueprint to create a scene capture of the device, which then gets sent to a render target and set as the colour for the UI material. The bright red meant that I could subtract the background, but there was still a thin red outline present. I tried using a scaled down duplicate of the texture as the opacity, which fixed it somewhat, but the red can still be seen in some pixels. 


I struggled to make the text change on the widget- I was using buttons to activate a change in opacity, which depend on the variable "page number". This was set in a range, and controlled the switch to choose the correct opacity for each button. It took me a few goes to figure out the correct logic for this, but the problem with the text is that I was not used to the single, self contained funtion bindings. After a while, I figured out how to use and set slate colour nodes, and used this in combination with the page number to achieve my goal.

I spent more time on this section that any other section, but it is the part I enjoyed most. The narrative could use some work, and the environment is simple, but the logic seems to be sound.







Comments

Popular Posts