Navigating Huge UE4 Rendering Code for Games

Navigating Huge UE4 Rendering Code for Games
Slide Note
Embed
Share

With over 14 million lines of C++ code in UE4, understanding the tools, types of knowledge, and common rendering strategies like Forward Shading and Deferred Shading is essential for game graphics development. Learn about the big picture expectations and how to make changes to large software systems effectively.

  • UE4
  • Rendering
  • Game Graphics
  • Code Development
  • Tools

Uploaded on Feb 15, 2025 | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Navigating huge (UE4 (rendering)) code UMBC Graphics for Games

  2. UE4 is BIG BIG For the 4.20.2-release tag in github C++ (*.h, *.cpp) 51,074 files 14,494,615 lines of C++ code C# (*.cs) 1813 files 496,550 lines of C# code Shaders (*.ush, *.usf) 332 files 86,359 lines of HLSL code

  3. Navigating large software Mostly not really just about UE4 or just about rendering At some point, you will need to make changes to a large pre-existing software base Tools and strategies are the same

  4. Tools of the trade Paper or text editor for notes IDE Know how to bookmark / set breakpoints Know how to step through & examine code For UE4, VS extensions in Engine/Extras File search VS Find in Files / Xcode search VS Visual Assist extension (VAX) External search tool like ripgrep

  5. Types of knowledge Big picture Basic idea of what it is doing Don t sweat the details Local view How does one thing work Usually to make changes there or create something similar Find & understand the local code Understand who calls it, and with what assumptions Understand what it calls, and what they do (but not necessarily how)

  6. Big picture: Know what to expect What algorithms do you expect to see? What data, inputs and outputs? For rendering, this class

  7. Example Two common rendering strategies Forward shading Deferred shading UE4 supports both

  8. Forward shading Compute per-pixel shading while rendering objects Redundant shading computation for pixels that are overwritten More per-object control over shading Supports transparency for sorted objects Usually limits on type and number of lights

  9. Deferred shading When rendering objects, just save shading parameters per-pixel In later passes, apply shading and lighting computations per pixel Culling lights by coverage allows tons of lights Base shading code needs to be similar for all objects Rise of Physically Based Shading in games Transparent objects in a separate forward pass

  10. Big picture: Look for documentation Rendering overview docs.unrealengine.com/latest/INT/Programming/Rendering/Overview Some independent blog posts interplayoflight.wordpress.com/2017/10/25/how-unreal-renders-a-frame medium.com/@lordned Ask someone who knows

  11. Big picture: See what it does PC: RenderDoc Install RenderDoc Enable plugin Restart UE4 UE4: r.CompositionGraphDebug Shows all passes Use vis console command to see pass outputs

  12. Big picture: Step through the code Constrain to the level you care about Optimizers make life hard Reorder code, eliminate variables, limit variable lifetime, Turn off optimization in just one file VS: #pragma optimize( "", off ) Xcode: #pragma clang optimize off DON T CHECK THIS IN!!! Breakpoint & step FDeferredShadingSceneRenderer::Render FPostProcessing::Process

  13. Details: Where to start Find a starting point in the code Build your understanding out from there Keep the window small You re changing a black box in a chain of black boxes Just be sure to honor the interfaces and assumptions

  14. Details: Finding code Find in files VS: Solution search box, Ctrl-Shift-F, Ctrl-T Xcode: Magnifying glass, search bar Limit by path, file type, previous search results Try a few different words Looking for a page or two of results. Too many isn t useful. If you know a log string or cvar name, start with that. For blueprint or material node, look for node name Given several choices, look for the more unique one

  15. Details: Understanding code you find Read the code Add breakpoints Look at the call stack on break Step through May help to add ONETHREAD command line argument For shader compiler, bAllowCompilingThroughWorkers=False

  16. Details: Finding something similar How to make a material node Find a uniquely named one, similar to what you want Copy & rename everything it does Modify to new purpose How to make a blueprint node Find a uniquely named one , similar to what you want Copy & rename everything it does Modify to new purpose How to make a new postprocessing pass Find a uniquely named one , similar to what you want Copy & rename everything it does Modify to new purpose

More Related Content