appwiki:unreal

Reading

Unreal 5 Basic Workflow

  • Install and launch unreal 5
  • choose Games > Blank template
  • choose options, then create
    • blueprint/C++ based game development method,
    • also platform+quality preset
    • no starter content
  • Edit > Project setting: for project publish name and etc

Core Concept

  • unreal like unity, has some template to get setup fast at start, but you can also use without them
  • unreal also has function extension called plugins, like Unity package system;
    • and they are project based as well, means you need to install for each project due to project uniqueness
  • all unreal object has its component, which can be find in its definition code in C++, while in Unity, definition is C#
  • unreal content browser is at bottom, like Unity Asset Manager
    • you can create special Asset object like Prefab in Unity (reuseful instance master object), and material and so on, and be ready to use
  • Game use real-world scale, 1m as default cube size, transform is in cm unit
  • Unreal Level = Unity Scene

Basic Operation

  • unreal use QWER for select, move, rotate, scale
    • unreal use Z axis as Up axis, like blender, not maya
    • after move, hold V key to snap to vertex
    • snap to ground (End)
  • duplicate object (ctrl+w or alt+move/rotate/scale tool drag)
  • toggle object world/local space mode (ctrl+`)
  • focus selected (f)
  • RightMouseButton hold to view around + WASD key to move like FPS Game + Q/E for up/down (+LeftMouseButton for pan)
  • MiddleMouseButton to pan and zoom, + WASD key to move like FPS Game
  • LeftMouseButton to dolly in/out
  • LeftMouseButton + alt = rotate view like Maya
    • in top/side/front view:
      • RightMouseButton to pan around
      • MiddleMouseButton to measure
  • ctrl+shift+h: Show Frame Rate (it has its shortcut because it is important to optimize for speed)
  • in-3dview menu > high res screen shot allow you to up-res screenshot
  • G: enter Game Mode view (like Unity Game tab), it hide gizmode+icons
  • F10: Full Editor View
  • F11: Full screen view

Edit Window

  • Tool:
    • Select (shift+1): select objects
    • landscape (shift+2): build landscape
    • foliage mode (shift+3): build grass + trees
    • mesh paint mode (shift+4): mesh paint mode, like painting mud tex/grass tex for grounds
    • modeling tool (shift+5)
    • fracture tool (shift+6): breka stuff
    • brush tool (shift+7):
    • animation tool (shift+8):
  • Viewport bookmark
    • set view bookmark (ctrl+0-9)
    • go to view bookmark (0-9)
  • camera icon: Perspective/top/left/front
  • display mode icon:
    • lit: shaded view
    • unlit: flat shade view
    • wireframe and so on
    • Game Setting: uncheck to disable auto explosure in viewport
      • Note: to change auto exposure behavior in depth setting,
        • go Outliner > Volumes > GlobalPostProcessVolume
        • go Details panel > Exposure tab
        • check metering mode:manual; then set Exposure compnesation to like 10
        • if you know photography and EV value, you will have better idea of measure guide of environment brightness,
          • street light night like EV5, subway platform like EV6, cast day like EV12, hot middle sunny day EV15
  • show filter icon: show/hide global gizmo object display
  • Viewport Icons:
    • Select/Move/Rotate/Scale object icon
    • operate in world/local mode toggle (ctrl+`)
    • operate snap to other object toggle
    • operate grid snap toggle
    • angle snap toggle
    • scale snap toggle
    • viewport navigate (camera move) speed control
    • single view/quad view toggle

Content Browser/Drawer to add Quixel Bridge Content

  • open content drawer (ctrl+space)
  • First, make sure you have a Epic account, normally you already have when download the Unreal Engine
    • if you use Google Account to login automatically, make sure, go epic website, login, under password, create a new password
    • the login will be you gmail address and that password when Quixel pop up for login with Epic account
  • note, with Epic account login, you automatically got unlimted plan, which allow you to use all asset in the Quixel library, but license only allow you to use asset within unreal unless you bought other plans from Quixel
    • double click asset in content browser to open asset in seperate viewer

Common Task in Unreal

set default level in unreal, so when built, it load the default one

  1. Edit > Project Setting > pop up panel - Maps Mode tab > Default Maps section > set Editor+Game default map

build unreal project into game

  1. Edit > Project setting > Description tab > Displayed section
  2. put displayed title as your game name
  3. set default map as mentioned above
  4. File(4.x) / Platform drop-down in toolbar > Package project - choose target platform to make
  5. choose the output folder and it will run the process

Add UI widget to game viewport

  1. unreal engine has a UI framework called UMG (Unreal motion graphics), contains pre-built button, sliders, etc
  2. to use those, you need to create a widget blueprint (a definition structure of the UI object)
    • right click menu on content browser, > User Interface > Widget Blueprint, choose User Widget as base
  3. in left panel, drag Canvas Panel into the designer area
  4. then you can put layout element like Vertical Box into canvas
  5. then put those UI elements into that Vertical Box
  6. once done, in tool option bar - hierachy shape icon > open Level Blueprint
    1. right click in graph and Create Widget node, in class option, choose your UI widget class name
    2. right click on return value and Promote to Variable, give a variable name for it
    3. drag set blue dot to create new node Add to Viewport
    4. link on start to create widget node, done
  7. now game starts, it will create the widget

Make mouse can be visible to interact with UI

  1. once you done above, when you start game, you mouse it is interactive with viewport navigation and you can't interact with UI
  2. in the UI widget blueprint graph, you need to setup to let mouse is free with interact with UI
    1. in Event Contruct node of widget blueprint, link to set Show Mouse Cursor (true),
    2. create Get Player Controller to link to target input of set Show Mouse Cursor
    3. after that, your mouse is visible in both viewport and UI, and can interact both
    4. (extra optional) if you want the mouse only interact with UI
      1. after set Show Mouse Cursor (true) node, create node Set Input Mode UI only node, plug Get Player Controller to Player control input, and Self node to In Widget to Focus, that way, you now can only interact with UI
      2. you may also use one of UI button to start game interaction with Set Input Mode Game Only node.

Add a C++ function code to the project

  1. in Content Browser, navi to C++ classes > project name, right click to Add C++ class
  2. choose Common classes > Blueprint Function Library,
  3. give a name BlueprintFunctionLibraryX, create
  4. do your code, in VS top bar, develop editor, and local debug build, (if fail, close unreal and re-run local debug, it will launch unreal automatically)
  5. Ctrl+Alt+F11 to live reload changes from your code to unreal
  6. (extra note) if you start project as blueprint project, you can use Tool menu > add C++ Class to add C++ code into your project
    1. then it will pop Visual Studio, and you need to close unreal, and start unreal like above with visual studio
    2. also the C++ class folder will show up in content browser

ref: Getting into C++ with Unreal Engine

Unreal Engine 5 Problem and Solution

  • Texture Streaming Pool Fix
    • in cmd, type (8000 is your MB of your GPU memory size)
      r.Streaming.PoolSize 8000
  • video memory has been exhausted:
    • some features improving the visual quality can increase video ram usage, like
      • nanite - real-time high detailed geo render
      • lumen global illumination system
      • temporal upscaling features for more details in realtime
      • texture streaming and texture quality
      • scene layer in editor
  • temporily disable nanite in project
    • Edit Project setting > Engine > render : nanite check

Unreal Asset - from Blender to Unreal

  • export fbx: forward = x, up = z

Unreal Animation - Camera and Level Sequencer

  1. create CineCameraActor, (for render and level sequencer use)
    1. set filmback, lens focal length
  2. clip icon > create level sequence (now you have a timeline) AS_main_animation
  3. add main_cine_cam actor from outliner into timeline
  4. animate the camera
  5. for render, plugin > enable Movie Render Queue
    1. add AA setting
    2. add png output, switch off jpg out
    3. set render config, and save preset
  6. Local render

ref: https://www.youtube.com/watch?v=GHFq4Dj7sVs

  • sub-level is set to streamming and movie render queue is not rendering out sub-level.
    • solution:
      1. in Sequencer window, add new Track > Level Visibility track
      2. once new Level Visibility track is there, click + icon to add Visible property layer
      3. right click on visible property layer > Edit Section > Level visibility tab - Level Names array
        • click array + to add new level name slot, and put each sub-Level name in the scene, (yes, you have to manually type out each sub level names)
        • then it should make render works
  • Settings:
    • anti-aliasing:
      • spatial sample means sampling repeat at same time multiple times and merge
        • good for static objects
      • temporal sample means sampling at different time slice within a time interval multiple times and merge
        • good for in-motion objects for motion blur
      • total sampling = spatial samples x temporal samples, if total > 8, you need to disable AA checkbox below them, and use None for AA.
      • console variables
        r.AmbientOcclusion.Denoiser.TemporalAccumulation 0
        r.GlobalIllumination.Denoiser.TemporalAccumulation 0
        r.Reflections.Denoiser.TemporalAccumulation 0
        r.Shadow.Denoiser.TemporalAccumulation 0
        r.BloomQuality 5
        --fog
        r.VolumetricFog.GridSizeZ 256
        r.VolumetricFog.GridPixelSize 2
        r.VolumetricFog.TemporalReprojection 1
        --?
        r.DepthOfFieldQuality 4
        r.ScreenPercentage 125
        r.MotionBlurQuality 4
        r.ShadowQuality 5
        r.RayTracing.GlobalIllumination.ScreenPercentage 50
        
        Unreal Engine makes real-time ray tracing possible through the use of denoising techniques that may rely on temporal history.
        When using high-resolution tiling or when disabling Temporal anti-aliasing, you may need to adjust the following console variables for better results
        
        r.AmbientOcclusion.Denoiser.TemporalAccumulation 0
        r.GlobalIllumination.Denoiser.TemporalAccumulation 0
        r.Reflections.Denoiser.TemporalAccumulation 0
        r.Shadow.Denoiser.TemporalAccumulation 0 
        
        Setting these variables to 0 will help the denoiser converge better without temporal history. You may also want to consider disabling the following Denoisers entirely if you have a high enough sample count (64+)
        
        r.AmbientOcclusion.Denoiser 0
        r.DiffuseIndirect.Denoiser 0
        r.Ray tracing.SkyLight.Denoiser 0
        r.Reflections.Denoiser 0
        r.Shadow.Denoiser 0 

Unreal Engine 5 to Unity Conversion (FBX method)

  1. Unreal Engine:
    1. select model asset that need to be exported IN outliner (so not supported item like volume can be skipped and clean export)
    2. File > Export Selected (LOD: uncheck will use highest res, collision: check if you need those collider proxy geo)
    3. Bake asset materials
      1. select a asset in scene, double click its material in detail panel > Material to check its channel color info links
      2. in detail panel > Material > Advanced, click Bake button, based on the connection link to add required material property in baking list (like Diffuse, Metallic, Roughness, Normal), also set the texture size
      3. once baked, refresh Content Browser, baked virtual texture files will be shown as T_M_objectName_id
      4. select those textures in asset browser, right click menu > Asset ACtion > Export and use TGA image format
      5. (note: baking texture will solve issue of mult-channel-one-file type of texture file, as some texture store metallic+specular+roughness in 1 file, baking will seperate them into individual file) ref: https://gamefromscratch.com/exporting-from-unreal-engine-tutorial/
  2. Blender to combine FBX model and TGA texture
    1. in blender preference > addon > check Node Wrangler
    2. import FBX model, go shading tab, select the asset to setup texture relinking
    3. select Principle BSDF node, press Ctrl+Shift+T to open file browser to load those TGA texture files, once loaded, texture will be linked automatically to color channels
    4. repeat for all other asset, (good thing is instance asset will be setup automatically if same material)
  3. Result comparision of Unreal and Blender
  4. Once done setup in Blender, export whole scene as FBX, drag FBX + tex folder (the texture folder) into Unity asset browser
  5. Result comparision of Unreal and Unity HDRP

Python Script in UE 4.25

  • from UE 4.19, python is supported
  • in Edit > Plugins : Script Tab, there is new Python Script support, enable it and restart;
  • Then show it in Windows> Develop Tools > Output Log, you can switch the cmd to Python in the command box
    • check its python version with
      pyMode = '.'.join([ str(n) for n in sys.version_info[:3] ])
      print("Python: {0}".format(pyMode))
    • it is 2.7.14,
  • the Python path is at UE version installed folder
    \your_install_path_to_UE_sub_version\UE_4.25\Engine\Binaries\ThirdParty\Python\Win64
  • pip module is built-in with the python in UE, so you can install PySide/PySide2 using pip
  • cd to UE4 python directory as above, use print(os) to see its path, run cmd
    .\python.exe -m pip install -U pip
    .\python.exe -m pip install PySide
  • run the custom widget directly with UI creation, need create QApplication
    import unreal
    import sys;myPath='/python_to_tool/TmpTest/';myPath in sys.path or sys.path.append(myPath);import TmpTest;
     
    unreal_app = QtGui.QApplication.instance()
    if not unreal_app:
        unreal_app = QtGui.QApplication(sys.argv)
    single_TmpTest = TmpTest.TmpTest()
    unreal.parent_external_window_to_slate(single_TmpTest.winId())

UDK Quick Use Guide (outdated)

  • Unreal working speed-up tips
    • view > detail mode : low
    • view > enable particle system LOD
    • make perspective view smaller
    • make perspective view in “unlit mode” (alt+3)
      • or check “unlit movement” for static lit in view drop-down menu
    • toggle off real time (ctrl+r)
  • navigation (right mouse button centered control)
UDK game style Maya view style Maya selected style
walk LMB ?
rotate view RMB U+LMB
pan view LMB+RMB U+MMB
zoom view LMB U+RMB
view select home
  • orthographic view
    • LMB: pan view
    • MMB scroll: zoom view
  • toggle view
    • persp: alt+f
    • top: alt+g
    • front: alt+h
    • side: alt+j
  • viewport hide and show configure
    • toggle volume [bounding box] (o)
    • toggle terrain (t)
    • toggle static mesh [static dynamic] (w)
    • game view [hide all] (g)
  • move object
    • lock to camera: pick up mode

UDK creation

  • L+LMB click: create light

rebuilt required for every BSD brush change

UDK pipe

UDK import:

  • t3d, dxf, asc, ase
  • appwiki/unreal.txt
  • Last modified: 2024/01/25 10:23
  • by ying