Presentation is loading. Please wait.

Presentation is loading. Please wait.

Navigating huge (UE4 (rendering)) code

Similar presentations


Presentation on theme: "Navigating huge (UE4 (rendering)) code"— Presentation transcript:

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

2 UE4 is 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 File search
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 Local view
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 UE4 supports both
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 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 How to make a new postprocessing pass


Download ppt "Navigating huge (UE4 (rendering)) code"

Similar presentations


Ads by Google