Texture Mapping Help?


I’m currently in a little bit of confusion. I’m a programmer and not much of a texture/rendering kinda guy and I am needing a little bit of a heads up.

So my issue is having a texture which contains HUD elements. How would I get the location of a certain element?

If I look in ShooterGame example, it has the health bar and for the U axis as 67 and I am confused with how I would figure out how they got the co-ordinates.

If anyone could provide a quick, easy-to-grasp answer or at least a point the direction then that would be awesome. I appreciate your time to support.

Man I won’t post as an answer cause I come from the same background as you, and this are things that I have recently grasped and don’t know if they are completely certain.

If you are trying to make a HUD you should use the HUD actor I don’t think you need to map UVs to screen cordinates there.

UVs coordinates are like the X and Y in a cartesian plane, they start at 0,0 in the upper left corner, then go 1,1 in the lower right.

ae: u 0.5 v 0 means top right, u 0.5 v 0.5 means center.

This is some quick heads up, hope I didn’t make a fool of myself here.

I know you are trying but I’m making an icon for a certain HUD element from a texture, technically. Here is an example from “ShooterGame”:

Texture: Screenshot - cf9a099e1ed808c94ac9546548f31d77 - Gyazo
Code to create icon from co-ords:

HealthIcon = UCanvas::MakeIcon(HUDAssets02Texture, 78, 262, 28, 28);

MakeIcon(Texure, U, V, UL, VL);

Well I just opened that image in paint, and given that system, is just the position of the icon inside the image, they called it u and v instead of x and y, the other two variables are the width and height, if you use the same function just replace the variables.

I know that it’s just X & Y but I was somewhat confused with the UL and VL.

you can use SubUV_Function in your material.
For more information have a look at Texturing | Unreal Engine Documentation

so what you actually can do is, to get a specific part of a texture and instruct your material to show that part. the SubUV function helps you makes it very easy and additionally by using some dynamic parameter you can control it from blueprints.

Looking at the texture, I’m guessing UL and VL are the width/height of the icon.

The icon starts at (78, 262) and ends at (78+28, 262+28)