UEFN Progress Bar with Only a Material and Verse

Insane UEFN
5 Aug 202418:09

Summary

TLDRThis tutorial explains how to create a progress bar using Unreal Engine 5, focusing on using material nodes to adjust the progress bar's appearance. The video covers scaling the bar based on input values, manipulating UVs, and setting up a random value system for dynamic changes. It demonstrates how to integrate custom materials and nodes, update the bar's scale, and handle user inputs with button interactions. The tutorial also addresses common mistakes and offers practical coding tips for working with progress props in game development.

Takeaways

  • 🎨 The video tutorial demonstrates how to create a progress bar using Unreal Engine's material system.
  • 🔧 The progress bar's value is controlled by the Y scale, which can be set to any value between 0 and 500.
  • 🖼️ The progress bar uses a texture that is masked to show the appropriate value, with the top half always white and the bottom half changing.
  • 🔄 The tutorial explains how to use nodes to split up UVs and position the texture correctly based on the value.
  • 📐 The material is created using a combination of nodes, including a multiply node for emissive color and an opacity mask.
  • 🔧 The material nodes are sourced from the scaler test debug scaler values, and the tutorial mentions flipping the numbers due to inversion.
  • 🖥️ The tutorial guides viewers on how to use a website, blueprint.com, to copy and paste material code for use in Unreal Engine.
  • 🛠️ A custom C++ class named 'ProgressProp' is created to handle the progress bar's functionality, including updating its value and transform.
  • 🎮 The tutorial includes a button device example to interact with the progress bar, simulating player input.
  • 🔄 The 'Update Transform' function is highlighted for reusability, adjusting the progress bar's scale and position based on the new value.
  • 🔚 The tutorial concludes with a discussion on handling the button press event, updating the progress bar, and cleaning up resources when the progress is complete.

Q & A

  • What is the main focus of the video tutorial?

    -The main focus of the video tutorial is to create a progress bar using Unreal Engine 5, which can be controlled and displayed based on the Y scale value.

  • How does the progress bar's value get set in the video?

    -The progress bar's value is set by using the object skill and feeding it into a series of nodes, which manipulate the UV to display the correct portion of the texture based on the input value.

  • What is the purpose of masking the top half of the bar in the tutorial?

    -The top half of the bar is masked to always remain white, while the bottom half changes based on the number value, indicating the progress.

  • How does the progress bar keep facing the camera in the video?

    -The progress bar keeps facing the camera by using nodes that are part of the scaler test debug scaler values, which are designed to maintain the orientation relative to the camera or player.

  • Why are the numbers inverted in the progress bar texture?

    -The numbers are inverted possibly due to the way the data or values are calculated, necessitating a flip at some point in the process.

  • What is the role of the 'scaler test debug scaler values' node in the tutorial?

    -The 'scaler test debug scaler values' node is used to provide the necessary values for the progress bar, and in Unreal Engine 5, it allows for a deeper inspection of the node's functionality.

  • How does the tutorial handle updating the progress bar's value?

    -The tutorial handles updating the progress bar's value by creating a new class called 'progress prop' with a variable to hold the new skill value, and using a button device to trigger updates.

  • What is the significance of the 'update transform' function in the video?

    -The 'update transform' function is significant as it allows for the reusability of code to adjust the scale, rotation, and position of the progress bar based on the changing values.

  • How does the tutorial ensure that only one player can update the progress bar at a time?

    -The tutorial ensures that only one player can update the progress bar at a time by using a logic statement that checks if the progress bar is currently updating.

  • What is the final step in the tutorial for making the progress bar functional?

    -The final step in the tutorial is to create a mesh and blueprint that includes a plane rotated 90 degrees on the X-axis, applying the correct material, and connecting all necessary components to achieve the desired functionality.

Outlines

00:00

🎨 Creating a Dynamic Progress Bar in Unreal Engine

This paragraph introduces the process of creating a dynamic progress bar using Unreal Engine. The focus is on utilizing a material and setting its value based on the Y scale. The technique involves splitting up UVs and using a row of numbers to display the progress accurately. The progress bar is masked to show the top half as a constant white, while the bottom half changes based on the input value. A limit is set to remap values, with 500 representing half completion and 300 showing a full sweep across the texture. The nodes are designed to always face the camera or player, and the tutorial references a scaler test debug scaler values node. The numbers are inverted, which is addressed by flipping them in Affinity Photo. The material is then imported into a website for further customization. The tutorial also covers feeding the material to the correct pins in Unreal Engine, setting up the emissive color, opacity mask, and position offset on a plane.

05:10

💻 Coding the Progress Prop in Unreal Engine

Paragraph 2 delves into the coding aspect of the progress bar, focusing on creating a new class called 'progress prop' with a float variable to hold the skill value. The tutorial explains how to initialize the prop's transform and scale values, and how to create a function to update the transform based on the changing values. It also covers the use of special math and random modules for giving random values to the progress prop. The logic is set up to ensure only one player can update the progress at a time. The paragraph details the process of initializing the prop, handling button interactions, and updating the progress bar's value and position. It also discusses creating a new function to update the transform and how to handle cases where the progress reaches zero or beyond.

10:15

🔧 Handling Button Interactions and Updating the Progress Bar

Paragraph 3 continues the coding tutorial by focusing on handling button interactions to update the progress bar. It describes setting a new random value for demonstration purposes, which would be replaced with agent data in a final game. The paragraph explains the process of updating the position and creating a new function to handle the progress update. It also covers the conditions for when the progress value goes below zero, such as disabling the button or making the progress bar invisible. The tutorial corrects a mistake in the code regarding updating the transform with the new value instead of the amount. The paragraph concludes with spawning the update function every time the player presses the button and the progress is not currently updating.

15:16

🛠️ Creating the Mesh and Blueprint for the Progress Bar

The final paragraph outlines the steps to create the mesh and blueprint for the progress bar. It starts with creating a plane that is rotated 90 degrees on the x-axis to form a rectangle. The tutorial then guides through creating a blueprint for the StMesh class, adding the rectangle, and setting the correct material. It discusses scaling the progress bar in the verse code and connecting all the necessary components, including the button and the progress prop itself, to achieve the desired result. The paragraph concludes with a reminder to the viewer about the tutorial's purpose and a look forward to the next tutorial.

Mindmap

Keywords

💡Progress Bar

A progress bar is a graphical representation that shows the progress of a task, typically displayed as a filled bar that grows as the task progresses. In the video, the progress bar is created using a material and is manipulated based on the Y scale value, which determines how much of the bar is filled. The script mentions setting the progress bar's value by feeding it into nodes, which control the masking of the bar's texture to reflect the current value.

💡Material

In the context of video game development, a material refers to a set of properties that define the appearance of an object in a 3D environment. The video discusses creating a progress bar material that changes based on a numerical value, using UV mapping to align the texture correctly and masking techniques to show the progress.

💡UV Mapping

UV mapping is the process of projecting a 2D image (texture) onto a 3D model. In the video, UV mapping is used to correctly position the numbers and the progress bar texture on a 3D object. The script describes splitting up the UV to use specific numbers from a texture sheet at the correct location on the 3D model.

💡Masking

Masking in 3D graphics is the technique of hiding or revealing parts of a texture or object. The video script explains using masking to control which part of the progress bar texture is visible, with the top half always being white and the bottom half changing based on the progress value.

💡Nodes

Nodes are fundamental building blocks in many 3D and game development software, used to create and control various aspects of a scene or object. The script mentions using nodes to split up the UV, control the masking, and manipulate the material properties of the progress bar.

💡Scaler Test Debug

The scaler test debug seems to refer to a tool or feature within the development environment used for testing and debugging scaling values. The video script discusses using data from this tool to create the progress bar material and ensure that the numbers and bar scale correctly.

💡Unreal Engine 5

Unreal Engine 5 is a game engine developed by Epic Games, used for creating high-quality 3D environments and games. The video script mentions using Unreal Engine 5 to inspect nodes and understand the calculations behind the progress bar's functionality, indicating that the engine provides tools for detailed node inspection and debugging.

💡Blueprint

In Unreal Engine, a blueprint is a visual scripting tool that allows developers to design game logic without writing traditional code. The script describes using blueprints to create a new material, set up the progress bar's functionality, and handle button interactions that update the progress bar.

💡Emissive Color

Emissive color refers to the color emitted by an object without the need for external light sources. In the video, the multiply node is set to control the emissive color of the progress bar, which affects how the bar's material appears when unlit.

💡Opacity Mask

An opacity mask is used to control the transparency of an object or texture. The video script explains using an opacity mask to determine which parts of the progress bar texture are visible, based on the progress value.

💡Transform

In 3D modeling, a transform refers to the set of operations that modify an object's position, rotation, and scale. The video script discusses updating the transform of the progress bar to change its scale based on the progress value, using functions to calculate and apply the new transform.

Highlights

Introduction to creating a progress bar using a material in Unreal Engine.

Setting the progress bar value based on the Y scale using object skill and nodes.

UV mapping to position a row of numbers correctly for the progress bar texture.

Masking the top half of the bar to always be white, with the bottom half changing based on the value.

Limit and remapping the progress bar to show different values across the texture.

Nodes keeping the progress bar facing the camera or player.

Using scaler test debug scaler values for the progress bar.

Inverting numbers for correct data representation in the progress bar.

Customizing numbers in Affinity Photo and transferring the material to a website.

Sharing a link to blueprint.com for accessing the material code.

Setting up the material in Unreal Engine by pasting the copied code.

Configuring the material with mask and unlit settings.

Using a multiply node for emissive color and opacity mask.

Setting the W position offset on the plane for the progress bar.

Creating a new class 'Progress Prop' with a variable to hold the skill value.

Using special math and random modules for updating the progress bar.

Initializing the progress prop with initial scale values.

Creating a function to update the transform of the progress prop.

Handling button presses to update the progress bar with random or agent data.

Updating the progress bar's position and scale based on new values.

Creating a new transform function to handle the progress bar's movement.

Disabling the button when the progress bar reaches zero.

Finalizing the progress bar setup with a new progress prop class.

Creating a mesh and blueprint to implement the progress bar in the scene.

Rotating a plane to create the correct orientation for the progress bar.

Applying the progress bar material to the plane in the blueprint.

Connecting the button and progress bar in the blueprint for interactivity.

Conclusion and invitation to the next tutorial.

Transcripts

play00:01

in this video we're going to create this

play00:03

progress bar and it just uses a material

play00:07

and first so let's dive straight into

play00:13

it with this progress bar or unlock bar

play00:16

or whatever you can set the value based

play00:20

on the Y scale so if I put in 13 or 14

play00:25

it will be that value over there the way

play00:28

I can do that is by

play00:31

using the object

play00:33

skill and feeding them into a bunch of

play00:37

uh

play00:38

nodes so that we will split up the

play00:42

UV and basically use

play00:46

uh this row of

play00:50

numbers at the correct spot this is the

play00:53

progress bar it is basically this

play00:57

texture and um

play01:00

I'm

play01:02

masking the top half and the part of the

play01:05

um bar to whatever value comes in right

play01:09

so the top part will always be White and

play01:13

the other half will change based on the

play01:17

uh number value so I've set here a limit

play01:20

and remapping that

play01:22

limit 500 will be half and

play01:26

then 300 it will you know swipe acoss

play01:29

cross the

play01:31

texture now one of the cool things is

play01:34

that with this line these nodes uh it

play01:37

will keep facing to the camera or to the

play01:41

player a big chunk of this these nodes

play01:44

are coming from the scaler test debug

play01:48

scaler values this node and if you

play01:51

double click on it is uh unable to check

play01:55

it but with Unreal Engine 5 we can look

play01:58

into this node and see what's happening

play02:00

so I took most of the notes for example

play02:02

this part from that and this

play02:06

part the weird thing though is that the

play02:09

numbers are inverted and maybe that's

play02:11

the way it's been it's calculating the

play02:14

um the data or the numbers so it needs

play02:17

to flip them at some

play02:21

point so I went ahead and do did the

play02:25

same thing in Affinity photo

play02:28

and uh my custom

play02:33

numbers so I went and copied the

play02:37

material over into this website

play02:41

blueprint.com and I will share this link

play02:45

so you can you know go over here look at

play02:49

it on

play02:51

the code to copy copy it

play02:54

over select everything contrl

play02:58

C go back to

play03:00

to ufn go to materials create a new

play03:11

material and paste it over here then it

play03:14

will give you everything you need for

play03:16

this material now we need to feed it to

play03:20

the correct uh pins over here in example

play03:24

we going to say set it to mask and to

play03:28

unlit

play03:30

now this multiply node will be emissive

play03:33

color and this will be the opacity

play03:38

mask and the last part is over here and

play03:41

it will be W position

play03:43

offset on this plane it doesn't show

play03:46

anything but here on the cube it does

play03:50

show the material when you don't have

play03:52

the

play03:53

texture set here you can set the numbers

play03:57

texture

play04:00

and here you can set the bar

play04:07

texture get rid of this stuff uh yep um

play04:14

in my example I'm using the

play04:17

button to update it it can be anything

play04:21

of course

play04:33

Buton device

play04:35

and we using the prop progress

play04:42

prop if

play04:50

prop we create a new class as

play04:57

well uh progress

play05:10

prop we need a variable

play05:13

float with the

play05:16

um yeah the new skill value or and the

play05:19

initial skill value that be a th in my

play05:27

case we want to

play05:30

update the

play05:32

transform of the prop so the value

play05:39

changes in a

play05:43

transform a

play05:45

transform okay let's get in the

play05:48

additional Things We Want U modules we

play05:51

want to use in our code this is special

play05:53

math and random and the random is just

play05:56

for the example here so that the player

play05:58

will give random values to this progress

play06:02

prop and one a bull or a

play06:09

logic that states if it it is updating

play06:13

or not so just one player can uh use it

play06:17

at a

play06:22

time the first function is to initialize

play06:26

it uh in it prop

play06:35

uh the

play06:36

button and

play06:39

interative with

play06:40

event subscribe to that

play06:45

andle uh button fine that's

play06:52

fine andle button agent is always the

play06:56

thing that comes through

play06:59

and in this example will just give a

play07:01

random value but in the final game you

play07:03

want here to get the agents data and

play07:08

feed it whatever value it

play07:10

holds to update this

play07:14

bar and initialize I'm going to give it

play07:17

the initial you know uh scale values in

play07:22

it

play07:23

transform and for this I'm going to

play07:25

create another function to update the

play07:28

transform so

play07:30

so I will mark this

play07:33

out this

play07:36

is come back to that

play07:41

later going to create a special function

play07:43

that we can reuse update

play07:47

transform if the

play07:50

amount that is changing and we return

play07:53

the

play07:57

transform now we want to

play08:00

uh move

play08:01

it um or use the move to

play08:07

function for the prop but we don't want

play08:09

to change the rotation of the position

play08:12

or the position so we want to save

play08:17

those the

play08:19

rotation uh progress prop get

play08:24

transform

play08:26

form rotation

play08:30

progress Pro get

play08:35

transform

play08:37

translation now we want to create a new

play08:44

transform and that is

play08:53

transform and return

play08:56

that new transform

play09:00

now do we want

play09:02

to adjust

play09:05

this first the

play09:08

scale which is a vector

play09:13

three and

play09:17

the uh

play09:19

rotation which is the rotation and the

play09:25

translation which is the position

play09:31

and for the scale the X will be you know

play09:36

we scaled it up when we can do it here

play09:40

or uh in the blueprint for now let's

play09:43

just do it here DX was four the Y is of

play09:47

course the uh

play09:51

amount and the Z is also

play09:56

four so we're going to use this function

play09:59

here to

play10:02

update one

play10:05

function let to update

play10:09

our

play10:14

yeah so the initial value is in this

play10:19

case new

play10:21

value so at the end it prob it will set

play10:25

a th000 on the Y for the skill

play10:32

and then we teleport

play10:34

that

play10:36

value prop teleport

play10:41

to in it

play10:44

transform

play10:48

form yes

play10:52

sir now the fun part is handle button

play11:03

so if it's not updating is

play11:07

updating is

play11:11

false

play11:20

itating uh just set a new random value

play11:23

this is new

play11:26

random this is for demo purposes and the

play11:29

in a final game final idea you want to

play11:32

give or get the agent data and give that

play11:35

value but for now this

play11:37

is

play11:39

fine and we want to update the uh

play11:43

position so we spawn a new function it

play11:46

is date

play11:50

prop with the amount

play12:06

suspend and we going to set this

play12:10

updating to

play12:14

true we're going to set a new

play12:17

value which was thousand in the

play12:20

beginning we want to set it to the new

play12:23

value minus the amount here

play12:31

and two things can happen if the

play12:35

value the new value is lower than zero

play12:38

that means like it's over right the

play12:40

progress is done so we want to take that

play12:42

into account if it's not below zero we

play12:46

want to

play12:49

um update the progress bar so if the new

play12:55

value is equal to Z

play13:01

we want to do something and else we want

play13:05

to

play13:06

do the update the update this a new

play13:09

[Music]

play13:13

transform we reuse the

play13:16

function with the

play13:21

amount then we're going to move the prop

play13:24

progress prop move to

play13:30

new

play13:33

transform uh with a Time

play13:36

SO2

play13:39

seconds and if it's done we set is

play13:41

updating

play13:43

to

play13:45

false now if the value is lower than

play13:48

zero we can for example um disable the

play13:54

button we can

play13:56

also you know there is a last part right

play13:59

there is a small part that needs to be

play14:02

filled

play14:03

up so

play14:10

transform update transform weuse the

play14:13

function and the value is zero so we

play14:16

want y to be zero now and then we going

play14:19

to do uh progress prop move

play14:24

to transform

play14:30

and if that's happen so it will be

play14:33

invisible

play14:35

progress prop

play14:43

dispos so we created update prop and now

play14:46

we're going to spawn that every time the

play14:49

player is pressing the button and it's

play14:51

not

play14:52

updating

play14:55

dat

play14:56

prop with the amount which is a new

play14:59

random

play15:02

value so I made one little mistake in

play15:05

this code and this is when updating prop

play15:07

we don't want to update the transform

play15:09

with the amount but with a new value so

play15:12

change that to new value and now it

play15:14

should work on

play15:16

begin uh

play15:19

new progress

play15:24

prop progress

play15:30

prop and it

play15:32

needs two things the

play15:38

button and the progress prop

play15:48

itself so I'm feeding these two

play15:50

editables into this new class here and

play15:55

new

play15:57

progress prop it's just one function I

play16:00

need to start it off to kick it off and

play16:03

that's the in init

play16:08

prop now let's create the mesh and the

play16:11

blueprint to make this work and first of

play16:14

all we need a plane that is rotated so

play16:18

we're going to get a

play16:23

rectangle we zeroed it

play16:26

out and we just want to rotate it on on

play16:29

the x-axis like so 90°

play16:32

accept and then we can over here make

play16:35

the

play16:36

transform we're going to use this going

play16:39

to create a blueprint for this blueprint

play16:42

class St

play16:50

mesh and while we select a rectangle we

play16:54

going to add it over here

play16:59

and we going to set the correct material

play17:01

so M

play17:07

example and here is

play17:10

it now let's grab everything we need it

play17:14

is the

play17:16

progress it will be scaled in the verse

play17:19

code but we can do for example you

play17:22

know scale it up just see what's going

play17:25

on and remember this is the value

play17:30

we need the

play17:38

button

play17:40

and the first

play17:44

device example

play17:47

device this will now the

play17:50

button this one

play17:52

and

play17:56

progress and with everything connected

play17:58

we get the result we

play18:01

want I hope you like this tutorial and

play18:03

I'll see you in the next one

Rate This

5.0 / 5 (0 votes)

相关标签
Unreal EngineProgress BarMaterial NodesBlueprintsGame DevelopmentTutorialInteractive Design3D ModelingUV MappingTexture Masking
您是否需要英文摘要?