# UE5 Notes
Following the tutorial here:
https://www.youtube.com/watch?v=k-zMkzmduqI
## User Interface

- this is the viewport. navigate world view here

- this is the toolbar. lots of tunnels and repeated button pushes here
- can add objects (see + over the square)
- can switch modes, ex to landscape mode (drop down menu on left)

- this is the outliner. it is a list of all the objects that make up the current world
- can create folders to org here
- can select objects from here
- can hide objects from here

- this is the details panel. you must select an object to see the details panel for that object. you can edit objecct properties in the details panel

- last and arguably most important is the content drawer. must click on content drawer in bottom left to bring up the panel to see it, or can use CTRL + SPACE hotekey to bring it up
- it stores information for everything. world, objects, etc.
- gives folder view of all assets
- basically a file explorer
- if you want to work with content drawer constantly docked into the layout, can press button in picture below to do that

These are default windows. To add more windows that are docked use the Window tab in the top left corner. World Settings is used frequently and tutorial instructor recs activating that window.

Adding World Settings window from Window tab, it will by default get docked next to details window. Can move it around and dock it in various places on the screen as desired
*** If you break the UI and can't read it anymore, can reset to default ***
- Window --> Load Layout --> Default Editor Layout
## Camera Navigation
Right Mouse Button --> Look around
Right Mouse Button + WASD --> also look around
Right Mouse Button + E --> go up
Right Mouse Button + Q --> go down
WASD will do nothing without holding down right mouse
Holding SHIFT key down while moving an object will bring the camera view with you as you move the object
Camera speed can be adjusted here:

- Camera speed adjust short cut = Right Mouse + Mouse Wheel
*** If you fly too far away from geometry and can't find stuff, click button in the Outliner, then hit the F key to "focus" on the object, and it will bring you there ***
With object selected, holding down ALT + Left Mouse will rotate you around that object with the object being the pivot point
ALT + Right mouse button with object selected allows you to zoom in and out
Can use this to change perspective of viewport:

View modes can be used to see objects in different way:

- good for finding bugs
Show flags enable us to turn on and off different object types:

Game View enables us to see exactly what the player will see in game. You get it by clicking this button then selecting "Game View" from the drop down

- hotkey for Game View is G
## Object Creation and Basic Manipulations
This is the Movement button. Select this to make the "gizmo" (what is circled) change movement / position
- hot key is W

This is the Rotation button. Select this to make the "Gizmo" change rotation
- hotkey is E

This is the Snapping button. Right now its set to snap to grid every 10 centimeters. Click button to grey it out to turn it off if you would like
- turning snapping off enables smooth movement
- can change how many centimeters snapping moves by clicking 10 and changing it to a different number

This is the Rotation Snapping button. Right now its set to snap rotation every 10 degrees. click cutton to grey it out to enable smooth rotation
- can change snapping degrees by clicking the 10 and adjusting it

These are Scale and Scale snapping
- hotkey is R

This will toggle object movement from global axis movement to local axis movement
- the same thing applies to each movement mode of rotation and scale

Example of "axis locking" -- hover mouse in beween x and y axis, both turn yellow. now can move along x and y without changing z

CTRL + D is duplicating
- can also duplicate an item by hovering mouse over directional arrow while Movement/Translation is active, then holding ALT while dragging on the arrow after it hilights

Can add objects using this button:

Can also add objects through Content Browser and dragging them into the scene
Ctrl + click a selected object will de select it
Shift + drag shift on a selected object will drag camera with it

The END key will snap an object to the floor
Now we have a basic scene that we will take into the next phase, "Post Process and Camera Exposure"

## Post Process and Camera Exposure
We are in the "Minimal Default" map -- in Content Browser we locate this in maps. See the astrick -- this means there are unsaved changes

Built a little small structure to show example of exposure

- With Global Post Process selected in the Outliner, notice the exposure settings on the right in Details that can be adjusted
- The Lit button has an option for "Game Settings" that can be turned on and off to adjust auto exposure
Can turn on Metering Mode and change to Manual then use Exposure Composition to adjust world exposure

The settings we change in PostProcessVolume only affect the camera

Bloom settings under PostProcessVolume then in the Lens tab under Details

Turn intensity of Bloom up and see how bright it gets in viewport. To return to default, this arrow next to the setting will do that

Vignette settings can be adjusted here under Image Effects

Deleting the PostProcessVolume to see how to create it from scratch
- select then delete

Create --> Volumes --> PostProcessVolume

Drag into the scene. A box will appear that represents the PostProcessVolume. By default the changes to this will only apply from inside the box. Turn on "Infinite Exbound" in order to make the PostProcessVolume apply to the entire level

## Materials
To cover Mats, create new folder "MyStuff" next to Start Content

Then we will go File --> New Map --> Basic template to create new map; save when the new map pops up, then the files will populate in the new MyStuff folder in the Content Browser
In the Content Browser, click Settings, then "Show Engine Content" and you will see a folder pop up called "Engine"

Engine --> Content --> EngineMeshes --> SM_PreviewMat. We drag this into world

Add PostProcessVolume. Turn on Infinite Exbound

Make sure "Game Settings" is turned on under Lit and change exposure settings to Manual and 11

We are going to add a Material from the StarterContent Materials folder

Grab a Material and drag it onto the object we want to put it on

To create a Material from scratch, lets go to folder where we want to create it -- MyStuff. Right click, select add new Material, then you see a blank material pop up

Double Click on the Material in the Content Browser to bring up the Material Editor

The Material Editor creates its own window. Can grab it and dock it into the main view next to the viewport

To create nodes, click on the right where it says Palette and all the different nodes will pop up. On the left in the mini viewport for Mat preview, you can change the type of preview geometry you see with the buttons that are circles. In the bottom left, is the details where you can edit properties of selected nodes

- can also right click anywhere to bring up the node palette
Constant 3 Vector is the color for UE5. Drag the node in. Double click the node to bring up color picker. Adjust bars to choose color

Drag into Base Color to make it change the material

Must hit the Apply button before the material is changed

- any edits to the material must be re-applied every time in order for it to take effect

To edit Roughness we want to use the "Constant 1" node. Drag it on to the screen

- 0 will be smooth and 1 will be rough

- Alt + left click will break pin connections
Add Metallic -- duplicate, plug into Metallic input, change vvlue to 1

## PBR
UE5 uses Physically Based Rendering
- its dope
This button will automatically bring us to the Materials location in the Content Browser

Add Noise Texture

Replace Constant Node with Noise Texture

Preview change in viewport. Tip: Ctrl + L will rotate the sun so you can preview from multiple lighting angles
Add another Constant3Vector, change color; add Linear Interpolate (LERP) node to the scene with right click + search or you can hold L + Click to hotkey that node in.

Add the RGB output of the Noise texture into the ALpha input of the LERP node, then output of LERP into Base Color input
- notice the material change adding in the new color

Now we are going to find T_Metal_Rust texture and LERP it in to the mix

Double click into the Metal Rust texture -- you might see it blank as such

Uncheck the Alpha box (A) in the texture screen and you will see the texture uwu

Replace the second color with the Rust Texture

## Textures
Dragged in textures from asset download

- notice the asterisks on the textures that mean they need to be saved. select all three and hit CTRL + S
We must go into the roughness and normal maps that we draged in and make sure sRGB is turned off

- make sure to hit Save in the top left after turning it off
Create new Material and dock it -- the material is Spanish Pavement.
- M_ following all mats is good naming convention to easily sort out all mats
- T_ following textures same thing

Drag in three new textures into the graph

Plug in Base Color, Roughness, and Normal -- apply it to floor in our level

Save / Apply the material, then put it on to the floor and see how nice it looks. We now want to fix the tiling to make teh squares bigger in viewport

Add Texture Coordinate Node and Multiply node
- right click blank space in graph to search
- hold down M + Left click is hot key for Multiply node

TC output into A channel input of Multiply then multiply output into UV inputs of texture nodes

Add a Constant 1 node; plug it into B input of Multiply node; edit the value of the Constant from 1 to .5; click apply. This will double the size of the scale of the material in viewport

Add in a Multiply node; add in a constant 3; edit color. connect as shown. Apply -- change the material color.

## Parameters and Instances
Parameters allow us to make changes in real time without extra time added to compile the edits on changes, especially when working with complex materials
- Parameters are a setting that allow us to change our material
Before a Parameter can be created, we need to create a Material Instance. The Material Instance will hold all of the Parameters.
To create the Material Instance, right click the Material, then click "Create Material Instance"
- re-named it to MI_MaterialInstance for easy filtering

Double click into the MI and note that there are no Parameters you can see. We need to create them

To do this, right click the Constant node, then hit "Convert to Parameter" -- we re named the node "Size" since that constant adjusts the tile size of the material
- after creating the Parameter, must click apply

Now notice in the MI tab we have Sizze that was not previously there. Now on our floor in the Level, we can replace the Material on the floor with the MI that has the size Parameter, then we can edit the scale of the tile size in real time

Drag the MI_ on to the floor, make sure in the Materials under detail it is the MI_ and not the M_

Now we can undock the MI tab we had and adjust the size Parameter we created to edit the scale of the tile size in real time

We can also convert the Constant 3 node into a Parameter which will be named Color, then apply

Now we will have a Color Parameter to turn on as well and then adjusting color in real time is also possible

If we want to decrease the intensity of the Normal Map, we can add a "FlattenNormal" node to the graph
- the new node needs a Constant 1 to adjust value
- Can hold the 1 button + left click in the graph to hotkey create the Constant 1 node
- Right click the Constant 1 node to turn into a "FlattenNormal" Parameter, apply, now can adjust normal "bump" in real time

Can adjust normal bump uwu

- adjusted value to -5 for intense normal effect
- screen shot shows ridiculous number to highlight change
Add in a multiply node for Roughness now; connect a Constant 1; convert to Parameter; apply -- now we have a roughness real time scaler

Holding S then Left Clicking in the graph will hotkey in a Constant Parameter, to save a step or two

Now that we have edited each of the 4 parameters we created, we can easily reset them all back to default by pressing these arrows circled here

See that those arrows are now gone and the defaults have been restored

## Master Materials
Described as "one material to rule them all"
- imagine we have a single material but from it are trees of other materials created off of it
- kind of like genus and species hierarchy of materials
First step is to rename our M_SpanishPavement into M_MasterMaterial in the Content Drawer

Now in the graph we will convert each of the 3 textures into Parameters, renaming them Color, Roughness, and Normal. Click apply after changing

Now we can change out the textures on the fly as well; use the drop down menu for each newly created texture parameter to change

We need our Master Material to have another function: to enable Metallic maps as well
Copy the Roughness map in the graph; paste into empty space into the graph to duplicate it. Rename it to metallic under the details on the left. plug into metallic. apply

Create a "StaticSwitchParameter" node; add constant 1; change name to "Metallic O/F". Now we have on off switch for metallic maps


## Import / Create Static Mesh
Note: 3d objects are called "Static Meshes" in UE
Static Mesh -- Plain 3d object
- then add material
- material can contain multiple textures
Import a 3d object into the Content Drawer and drag into the world
- we are going to use the master material of the pavement to create a new and unique material for the crate

Add the textures for the crate from drive into a folder with the WoodCrate; drag the crates textures into the Content Drawer

- Double check that all maps are correct:
- sRGB set on for color map
- metallic map sRGB off
- NormalMap make sure UE detected it is normal for compression settings and sRGB is off
- roughness sRGB off
Create Material Instance of Master Material and name it MI_Crate; drag the MI_Crate into the WoodCrate folder

Drag the MI on to the crate in the viewport

Open the MI and activate the Color, Normal, and Roughness parameters previously setup

- now we can drag the appropriate maps into each parameter
See how the crate appearance has changed after we replaced the maps

Can play with the other parameters on the box MI to your liking as well

- though the scale should remain at 1 or else the UV will break
Open the crate and set its default material to MI_Crate

- now when we drag crate into scene from Content Editor it will have that material on it

Random note that this map right here is a combiation of multiple maps using the RGB channels (idk what that mean)

This texture uses the Red channel for Metallic and the Green channel for Roughness. Thus we can use it for both at once like shown below (thats what it mean)


## Asset Migration
Migration of assets between projects is important if we want to re use things and don't want to take all the time to setup them up for each individual project
To demo this we are going to open up the dummy project in the download files -- note the materials already in the project in the content browser

We want to bring assets over

Right Click on Lightning, then select "Migrate" in the list that pops up. This window will pop up. Verify it is correct then hit okay

Navigate destination to Content folder of the original Project

## Lighting System Lumen
Now we have moved the lighting stuff into our project

UE5 lighting system is called Lumen
- gives real time global illumination
- very expensive to calculate
- Lumen renders global illumination at fraction of a computing cost than previous gloval illumination rendering systems
- fancy term for light bouncing
- also takes some light from object and projects to nearby objects
We are going to open the map Light Bounce in the Lighting Examples folder

Note Global Illumination here is set to none

Select Light Source -- make sure it is set to static

Now at the top tab, select Build, then "Build All Levels" -- notice the difference in the shadow, how much more realistic it looks

- This is the method of how to get global illumination in UE4. its good but there are some major issues:
- mostly that lighting and shadows are static.
- this means light shadows break when moving light sources
- lumen helps to get dynamic moving shadows that keep up with light sources moving around
World settings is where we take care of light baking

We want to get rid of light map by clicking this in the circle

- after doing this we have to hit build again to get rid of the light maps
Now we go into Details and with light source selected, we select moveable (being pointed to)

- note how the shadows do not break / double upon moving the light
- we still now need to get global illumination here, as you can see the shadows are too dark
Now with PostProcessVolume selected, we change our global illumination to lumen

- note how much better the shadows look
Source Radius can be increased to make the shadows even softer

## Types of Lights
### Point Light
- most basic of light. it is a light that emits in all directions
- most important settings in the details panel:
Intensity will increase or decrease the strength of the light (here it is a ridiculous 100)

Source radius was just covered which makes the shadows softer. The yellow radius ball around the light here represents the Source Radius. The larger the yellow ball, the larger the source radius, the softer the shadows

Temperature needs to be checked in order to adjust it, but it enables control over how warm or cold the light appears to be

Light Color brings up this window here that can be used to change the color of the light

Indirect Lighting Intensity -- setting it to 0 will have very little bounce light

- we can change it up to ten for some very intense light bouncing

Now we will delete the point light from the scene and go over the spot light
### Spot Light
The Spot Light is very similar to the Point Light, the difference is that it is only illuminating in one direction and not in every direction

Settings are the exact same except on Spot Light we have an Inner and Outer Cone angle which can be adjusted to various angles

### Rectangle Light
This light is the same as the other two lights, except emits in the shape of a rectangle and only goes in one direction

- It's unique settings are source width and source height
### Directional Light
This is probably the light that will be used most often. This light is the sunlight. In order for us to see what it does we have to rotate it until there is illumination

### Sky Light
Captures the sky and projects it on to our world
- i kinda skipped this one
### Lumen Settings
PostProcessVolume contains Lumen settings

## ArchViz Lumen Lighting
Use architectural visualization to check out Lumen stuff and compare it to static / baked lighting
Start by opening pre made map made for this tutorial:

Add in a directional light and rotate it until we can see the lights coming in to the scene

Now add visual effects: sky and atmosphere

Now add visual effects: exponential height fog

Drag the Start Distance setting of Fog to its max, so that none of the fog shows up in our little house here

Add Skylight as well:

Set both the skylight and the directional light to moveable

Add a PostProcessVolume and turn on Infinite Exbound

Turn the Final Gather Quality of PPV up to 10

Increase Lumen Scene Detail to 4 to create soft shadows for phone and cup

Turn metering mode under exposure to Manual, turn exposure compensation up to 13.25, turn bloom itensity up to 2

These steps are the basic steps / setup to light a scene in UE5 for ARCHITECTURAL VISUALIZATOIN
- now we want to examine how to take this lighting setup and bake it uwu
## ArchViz Light Bakeu
Properly baking the lights will be more performance friendly than Luman and will look better than Lumen if baked properly
Duplicate the map we just did lighting for, then go into that map

Step 1: set directional and skylight to static

Now in PostProcessVolume we are going to disable Lumen as Global Illumination and set it to None -- we are also going to do this same thing for PPV under reflections (change it from Lumen to None)

Now we go into the Build tab and hit "Build all Levels" -- once it's done, notice how bad the lights look

Now to fix how bad it looks we go into World Settings and adjust the settings here under "Lightmass Settings"
- in general it is a rule of thumb that Static Lighting Level Scale multiplied by Indirect Lighting Quality = 1

After adjusting these settings, we go again to "Build" then "Build All Levels"
- after the build, it still looks bad *insert sadface here*

- go into Build then "Lighting Quality" and set it to Medium or High or Production
Now also go back to details for PPV and decrease Bloom intensity to 1
- also decrease exposure compensation

Build lighting and we can see that the lighting is still not the best

Now the instructor is saaying that we are getting bad lighting because of the resolution of some of our static meshes. So to see this, we go to Lit then to Optimization Viewmodes then to Lightmap Density

When we do that, we see this:

- the hotkey to view this is Alt + N + 0
- blue is not good for this. we want things to be in the green to red range
To increase the lightmap resolution of a static mesh we select the object, scroll down to Lighting in the details panel, then increase "Overwritten LightMap Resolution" from 64 to 128 or 256 or 512

Once we have adjusted all of the Static meshes, Build all levels once again. Note that the build will take significantly more time due to the fact that there is much more detail now

Now we can see the lighting has improve but there are still improvements to be made

Now in PPV turn intensity of Ambient Occlusion to 0

Exposure compensation back up to 13

Now we need to add reflections. Lumen will do reflections automatically. With Baked Lighting we need to do this through a "Sphere Reflection Capture"

- Add --> Visual Effects --> Screen Reflection Capture
Drag it into the scene. It takes a 360 degree snapshot of the world and uses that to project reflections

To get a better snapshot of the world, go up to Build again and this time hit "Build Reflection Captures"
- Can add more than 1

## Landscapes
Here we are going to create a landscape, how to sculpt it, and how to create foliage
In MyStuff, create a new folder named Maps

Drag our BeginnerMap and BuildData into the Maps folder

In the Maps folder, right click in Content Drawer, create new Level, name it LandScape

Switch into Landscape Editing mode with this drop down
- the shortcut to switch into this mode is Shift + 2

Now we have a new tab that popped up (which I re-docked from the left side of the screen) for Landscape
- instructor keeps everything at default before hitting create
- rec to use UE documentation for land sizes if altering from the defaults here

Once we create, new fields will generate in the Landscape tab

In select mode, add in a directional light and rotate it until lit
- set light to moveable

Add in a temporary cube to help us know which way the lights are going

Create --> Visual Effects --> Sky and Athmosphere

CTRL + L to move sun -- notice how the sky changes and updates in real time

Issues: black void in lower half of world, very dark shadows

Add skylight and turn on "Real Time Capture"
- this is the rec if you use skylight + directional light
- also set it to moveable

Add --> Visual Effects --> Exponential Height Fog
- the higher the widget is, the more fog there will be
This is how you light 90% of open world scenes in UE5
Now that the lighting is done we are ready to go back into Landscape mode and start editing the landscape
By default we enter sculpt. Left click raises the terrain, shift + left click will lower it

Can adjust strength other other settings here

Brush Falloff -- 0 gives a hard sculpt, 1 gives a soft one

Right bracket key will increase brush size; left will decrease it

Smooth brush will smooth stuff out (no shit)

Flatten brush will create a flat area where you brush it

~~
Creating new material M_Landscape in MyStuff

Dock it

Add Landscape Layer Blend Node to graph

Grab Grass and Rust textures in Starter Content and hook in like so

- apply
Drag M_Landscape material into the Details Tab where it designates the material. (note it cannot be dropped onto the landscape geometry in the view port, idk why)

- the material is currently blah because we need to specify where the layers of the textures are
Shift + 2 to enter Landscape mode; the layers that we need to specify on the landscape geometry are here within the landscape tab

- we need to create new layers for these
Add layer "Weight Blended Layer Normal"
Save the GrassLayer info in the default space/name (or change)

Now we have a grass layer

- repeat this for the rust (dirt) layer
The landscape is too shiny

Hold 1 + Left click on graph to add Const1 node, plug into roughness to give complete roughness

- apply changes
Not so shiny, is better. but now we add bump to it

Grab the corresponding normals for each texture

Copy layer blend node, plug normals in

Looks better

Can now blend between the two layers

Sculpt some stuff. Now in the bottom left near the Content Drawer hit add then "Add Feature or Content"

Choose the Third Person

Note the file path after adding Third Person package
Drag Human Reference on to the scene

Copy these nodes from the Master Material created earlier

Paste them into the Landscape material; hook them up like so

Now create a material instance of the landscape material, and apply it to the landscape by dragging from content browser into its designated area in the details tab of the landscape

Now we can go into the material instance and turn the scale parameter on and change the scale of landscape texture as we see fit

Now we have the problem that one parameter changes scale of both grass and dirt. we want to change them independetly of each other
To solve this, duplicate the parameters; disconnect dirt from the first group. connect rust to the duplicated group. MUST rename the const1 parameter of each group to have different names, or UE5 will treat them the same and not give you the option to control them separately

Now we can control them both for a more organic look

## Megascan Assets
Unreal comes with free assets
Use Quixel Bridge to import stuff
Get rid of landscape material we created

Add Post Process Volume with metering mode to manual and exposure comp to 10; before exposure comp works must turn on infinite exbound under PPV Settings

Access Quixel here

Can import over 13k assets to use
- each of these assets will come with their own material parameters that can be used (color, roughness, metallic, etc.)

## Foliage Mode
Shift + 3 is the hotkey to enter foliage mode
It enables quick painting of foliage and other objects around the environment
We are going to grab assets from Quixel bridge to use in foliage mode
3d plants

Download then add assets of your choosing

Can now drag into scene

MI to go over various property parameters
- note cannot be the billboard material

Play with a bunch of settings for the ferns

Can see different LODs by going directly into the object

This LOD4 is the furthest away and is the billboard material in the file download for the asset

Now in Foliage mode notice we have the ferns in there -- can drag other foliage into here

Now selecting one of the ferns will give us details that can be adjust below it

To paint, make sure you are in paint, that this blue button is blue, and activate which of the ferns you want to pain

Can have all 3 active at once

Note that UE5 will tell you how many of each thing got painted

Shift + Click to paint will erase, but it will only erase if a thing is activated in the area where we activate foliage to paint

Change the Scale X min and Max here to paint the ferns in varying scale sizes

After assets have been painted on, within foliage mode you can hit the select button, then select individual ferns

Turn this (Filter, Static Meshes) off to not paint over static meshes

(Deleted all foilage and moving on to next section)
## Nanite
Nanite Geometry -- brand new way of rendering that allows for a nearly infinite number of source polygons on our screen at any given time.
This means we can get high quality movie assets rendering in real time. Impossible before Nanite.
The instructor is using an example project that is 100gb large, so I am not going to download that and just watch / screenshot his screen and not my own.
In a scene, you can "Nanite in action" by click on "Lit" in the viewport top left corner, and selecting an option from the "Nanit Visualization" view

Must keep in mind that Nanite only works for static solid meshes that do not deform
- Epic games is working to make this apply to foliage as well; at the time of the video, it does not yet work for anything other than static solid meshes that do not deform
Also important to note that Nanite things are static meshes layered on top of each other -- they are not landscapes
Here as an example shot of a bunch of objects without Nanite active:

The frame rate is 5 fps, unplayable. We can fix this by enabling Nanite on these donuts by finding them in the content drawer.
- Select the static mesh in the Viewport
- Use CTRL + B to jump to its location in the content drawer (this may be wrong)
Activate Nanite by right clicking the object in the content drawer and simply hitting Nanite Enable

- now moving through the scene is 40 - 60 fps instead of 5 fps. yay nanite
You can visualize what has Nanite and what does not by changing Lit in the view port to "Mask" under the Nanite visualization option. Green is nanite, red is not.

When getting stuff from Quixel bridge you can select the Nanite option to download them to have those assets import into your project with Nanite already enabled

Here are the four different quality downloads you can get from Quixel

- Nanite looks the best and performs best and is highest density mesh
Wireframe comparison

CTRL + E with an asset selected will open it up directly

ALT + 2 with the asset opened up will bring you to wireframe view of it

- can examine different LODs here in wireframe. this was the method to make things with better performance before Nanite
## Blueprints / Game Programming
Instead of writing lines of code, UE5 uses blocks of nodes (thank goodness). We connect the nodes together to form logic. This logic is known as Blueprints. Blueprints is UE5's "visual scripting language." This is easier than having to write everything in C++ and requires far less time.
Duplicate our Landscape Map and rename to GameMap

In world settings, switch Game Override to BP_ThirdPerson

Now we have a Third Person character we can control with WASD

ALT + P is the shortcut to go into game Mode
Find the location of the character Blueprints

Double click on the character blueprint and dock it up

- this is the "Event Graph" of the Blueprint
This is the "Viewport" of the Blueprint

- The objects that we see are "components"
- here we have a character mesh component and a camera component
### Jump Logic

In game mode select the ThirdPersonCharacter object in the dropdown shown below, and now we can see the Blueprint nodes running in real time

- orange tells us nodes are currently being activated
We are going to practice adding in our own Blueprint functionality nodes
First we will add an event. Right click empty graph space to create
Add in Keyboard F event and a Print String node, connect them

This node setup will print the String "UwU" in purple text when the F key is pressed

It worked

Add "Set Collision Enabled (Mesh)" node after deleting the print string test node. Set the Drop down menu to "Collision Enabled (Query and Physics)"

Add Set Simulate Physics with Simulate turned on

Add Set Physics Blend Weight (Mesh) node and change the Physics Blend Weight from 0 to 1

This setup will supposedly make our character ragdoll into the ground when we press F in game mode. It works

We only need 1 Mesh reference node

Can hover over any wire and double click it to add in a re-route point from which you can extend into a new node or simply just move to organize it better

Sculpted a flat area to put an obstacle course for practice

In Blueprints folder, create Blueprint; the following screen will pop up. We choose the actor blueprint to create an obstacle
- we name it BP_Obstacle for "Blueprint obstacle"

Double click into the newly created blueprint and this is what an empty blueprint node looks like

We are going to add a Cylinder Component by hitting the add button shown here and finding cylinder in the list

Scale it like so

Add the Blueprint cylinder

We want to do an experiment where we make our character ragdoll when it runs into a cylinder
Add a Capsule Collision to the cylinder; scale it so that it matches with the cylinder

Actually the collision boundaries have to be slightly larger than the cylinder mesh

Now we want to select "On Component Begin Overlap" in the details panel of the Capsule Collision

Doing this will prompt a new Event Graph window to open. This sequence of nodes will only be called when something comes into collision with our object. However right now the event will fire whenever anything comes into contact with the capsule. We want to change that so only certain things coming into contact with the capsule trigger the event.

To cast this only to our third person character, we drag out a wire from "Other Actor" and use "Cast to BP_ThirdPersonCharacter." this will make UE5 check whether or not an object colliding with capsule is the character or not. If it is the character, the events will fire, if it is not the character, they will not.

We are going to test it with Print String "Blue Prints are dope" in red orange text 
It worked

Now we are going to go back into the Blueprint graph for the character and add a "custom event" and drag it into the start of the "F to trigger flop" sequence we built earlier
- name this custom event "Flop"

- Must now compile with the button in the top left corner and then go back into graph for the BP_Obstacle
Drag from "Cast to BP_ThirdPersonCharacter" to empty space on the graph and search for "Flop" that we just created

Add a "Add Actor Local Rotation" node in BP_Obstacle to one of the disabled event ticks in the graph that lode by default. Note that event ticks call a function at every frame.

Now when we press play we can see the cylinders spinning on the X axis in the preview

In game mode can type in command line t.maxfps30 to simulate what it looks like at 30 fps
Add Make Rotator Node

Add a Multiply node set to 100 connected to X input like so. Now this is making the BP_Obstacle spin on X at a rate of 100 (something) that does not rely on frame rate

Rotate the cylinders randomly to get them to rotate in world at different angles

Add Arrow Component to BP_Obstacle and in the viewport of it we can see there is an arrow that will indicate to us which direction the cylinders will be spinning (this will not be viewable in game mode but is helpful for us to be able to see)

Give the Arrow component a purple color, rotate it 90 degrees, lift it to be about half way up the cylinder, compile -- then see the changes in the viewport

The arrow points in this direction now

We have an arrow for each cylinder. Now we want to get the cylinders to rotate at varying speeds. In order to do this we make Variable, which are similar to making Parameters

Add Rotation Speed variable in the BP_Obstacle Event graph variable section; note that you add a generic variable that we rename to Rotation Speed

Change the Rotation speed from Boolean to Float in the top right details. Drag it from the bottom left onto the graph. Choose "Get Rotation Speed" (rather than "Set Rotation Speed) and then plug it in like so

After Compiling, can adjust rotation speed here. Also make sure to enable "Instance Editable" and "Expose on Spawn"

Now in the viewport we have rotation speed available to edit in the details of BP_Obstacle. Can select each different cylinder and set their rotation speeds now specific to themselves.

Now we want to add a goal for the player to reach. We are going to use the SM_Statue from the starter content and add it to the map. Add it, scale it up, change it from glass material default to gold material. Yaya

Now we want to build a feature where when we get to the statue, a win screen will be displayed

To do this we need a TriggerVolume. Add, Volume, Trigger Volume

Position the Trigger Volume so that the Statue fits inside of it. We want to program a win screen to pop up whenever the player mesh collides with this trigger volume. This will be programed in the "Level Blueprint"

To do this select "Open Level Blueprint" from this drop down menu

Make sure you have the Trigger Volume selected in the Level Editor. Then delete the default nodes (that are inactive) when you open the GameMap Level Blueprint. Add "OnActorBeginOverlap (TriggerVolume)" and drag out from "Other Actor" output into a "Cast to BP_ThirdPersonCharacter" and input that into Print String so we can test that the trigger volume is working.

Now that we verify it works we are going to create a User Interface which in UE are called "Widgets" -- in the content drawer navigate to Blueprints in ThirdPerson folder. Right click, then select "Widget Blueprint" from "User Interface" option.
In the windscreen editor use the palette on the left to drag in canvass and text, then edit the text to "you won the game"

Now in GameMap drag out to Create Widget. Set it to "Win Screen" widget that we just created

Now drag out to "Add to Viewport"

yay

## Castle Intro
We are going to start a new project to do everything from scratch.
Open Third Person Template

Create new folder under content called Maps and a new Level called Castle inside of Maps

Create landscape

Add Directional Light, Sky Atmosphere, Cube, and Mannequein

Add Skylight too

Also add Exponential Height Fog

Also add PPV with exposure set to Manual

Turn on Infinite Exbound for PPV; then can turn Exposure Compensation up to 10ish (next to setting for Manual)

Also add Visual Effects --> Volumetric Clouds

Now we have a basic setup. It is time for landscape! yawuwu
## Auto Landscape Mats
Open Castle Assets from the download -- in here we are going to migrate assets over to our main Castle map

Le open

Right click le assets and migrate

Now we have CastleAssets in our main Castle map

Make Castle the default map that is opened whenever this project is opened by doing this

Add M_Landscape_Inst as the material for the Landscape

Add Auto Landscape material with plus button thingy then clicking Weight something blended something layeru

The auto material makes landscape go brrr and will change based on stuff. It will also change based on things. There's lots of parameters for each of the A B C D etc. in the auto material and tahey all go brrr the same way just for different stuffs. Not taking notes on this the parameters are self evident what kind of brr'ing they do.
## Large Landscape Details
Rec for landscapes is to start with larger details before moving into smaller details. I.E.:
- start with mountains and general shape of landscape
- then move into medium range details such as trees and castle
- then smaller details like grass pebbles and shrubs
Sculpt some mountains

Set Bookmarks using the option in the drop down menu from the 3 bars icon, then you have the option to jump to the location of the bookmark from where ever you are in the map

- the shortcut to set bookmarks is by pressing CTRL + # and then where you are located becomes that bookmark
- the shortcut to jump to bookmarks is their number
Use the mountain assets in the Meshes folder of CastleAssets to drag into the viewport. Cut scale of them in half. Position them to your liking. I duplicated a few and rotated them to create different look with more background mountains. Note how small our huge map looks next to these mountain meshes. wow

Note that making this lock button go from unlocked as it is here to locked means that the X Y and Z values will lock in together so changing 1 is changing all if you have it locked where as you can unlock it to change them on their own

## Water! :)
Drag in the water mesh and resize it

- This is the old way of doing water in UE4
- the new water plugin thingy for UE5 is in beta and at the moment very glitchy so the instructor sticks to old way for now
Can open water material to change a large number of different properties

Opacity a nice one

Ripple tile and intensity nice too

In areas where land and water are coming together we want to go into landscape paint mode and use the preset C for mud

Duplicating the world at this point and working off of the duplicate copy just in case we want to go from a different direction with it from the point we are at later down the road, we have the original map we've been making to do that from

## Cliff Details
We are going to overlay some cliff static meshes over cliffs in select areas or however many areas we want to do
We are going to grab some stuff from Quixel to do this

Place stuff around and make it look nice

## Trees
1) Quixel
2) Downloaded content
3) Free assets from epic marketplace
These are the 3 ways we get files for this project. We're about to do the third using the marketplace to get Megascans trees
We have two type of trees here

Pivot Shader
Simple Wind
- more performant
- instructor recs using these
Drag all of the trees from simple wind into the scene and organize them (they will all import on top of each other)

Megascan trees are LODs
- at the time of video enabling nanite on trees was not possible, but it seems as if i can enable nanite on trees now
- nvm i was wrong you cant do that yet
- use them or RIP
Go here to do a thing

Now go here to get a thing

It is a "Tree Actor Controller"

Use the FoliageActor to control settings of the megascan trees

Setup foliage brush by dragging from content drawer into the foliage addition section

- note: from now on always working with foliage having its own window due to how weird it is to access the property settings when the window is docked
Need to play with settings when using so many trees to make sure we are not over painting them, so turn stuff down for things active in the brush

Now we have a problem of the trees angling themselves along with the landscape. We do not want this

To fix this, make "Align to Normal" false (uncheck it, by default it is checked/True)

Fixed

Put trees and other stuff into the world

## Modular Castle
Modular design is a common workflow in UE5 where you put different building blocks together to make one thing

Can use all the pieces in different ways to put a variety of finished builds together

Basically just drag stuff, duplicate stuff, be creative, place things around

## Small Details
Now we are almost done with a basic scene. First we did the large details: landscape sculpting (mountains, rivers, lakes, etc). Then we went and did the medium details (trees, castles, cliffside meshes). Now the last thing to do is handle the small details.
Small details in the context of this project are: pebbles, rocks, shrubs, trails.
- Instructor says we can get good assets to finish off the small details within Quixel bridge
This section of the video is the instructor grabbing stuff from Quixel bridge and slapping it into the scene. He's getting stuff like boulders, tree stumps, grass patches, ferns, etc. and using it to just kind of fill in the gaps of stuff (not gonna screenshot and notate as we should know what is going on by now -- just grab stuff from Quixel and throw it in to add nice touches to scenes / areas).
~~ We are done with the video! Now just make stuff and have fun :) ~~