Optimizing UE5: Advanced Rendering, Graphics Performance, and Memory Management | Unreal Fest 2024
Summary
TLDRMatt Ostle, Senior Technical Artist at Epic Games, discusses the optimization of performance and memory in next-gen graphics features. Focus is on virtual textures, Nanite, Lumen, and virtual shadow maps in Unreal Engine 5. Ostle explains virtualization as a method to use memory efficiently by only storing what is necessary. Updates in UE5.4 include better integration for virtual shadow maps, GPU-driven materials in Nanite, and improved reflection management in Lumen. The main teaching points involve understanding how streaming virtual textures and runtime virtual textures operate differently, enabling virtual texturing, and configuring project settings for optimal performance. Ostle also covers various debugging techniques and tools for identifying and solving performance issues within UE5's advanced rendering features.
Takeaways
- 🎮 Virtualization enables efficient memory use by storing only what's needed in working memory.
- 🎨 Virtual textures help manage memory demands with high-resolution graphics and features.
- 🚀 Nanite optimizes using virtual micr polygon geometry for efficient rendering.
- 🔍 Debugging tools in UE5 offer insights into performance bottlenecks in graphics rendering.
- 🌍 UE5.4 updates improve virtual shadow maps and GPU-driven materials for better visuals.
- 📊 Performance budgeting in Lumen requires careful setting of console variables for efficiency.
- ⚙️ Streamlining project settings can reduce unnecessary memory and processing overhead.
- 🔧 Virtual textures need specific project settings and material adjustments in UE5.
- 📏 Use of virtual texture stacks and sampler types can optimize material performance.
- 🎓 Understanding GPU and CPU roles is vital in optimizing virtual texturing and rendering.
Timeline
- 00:00:00 - 00:05:00
Matt Ostle from Epic Games presents on performance and memory in next-gen graphics features, focusing on familiar tools like Nanite, Lumen, and virtual shadow maps.
- 00:05:00 - 00:10:00
Discusses the need for virtualizing memory as demand for graphics features has outpaced memory growth, and introduces virtual textures as a solution.
- 00:10:00 - 00:15:00
Explains how virtual textures work by only loading necessary data, compares memory usage with virtual texturing to conventional methods, showing efficiency gains.
- 00:15:00 - 00:20:00
Provides a demonstration on how to convert textures to virtual textures using automated tools for efficiency.
- 00:20:00 - 00:25:00
Advises on project planning for virtual texturing and introduces the concept of Virtual Texture Stacks.
- 00:25:00 - 00:30:00
Discusses performance costs associated with virtual texturing, both on CPU and GPU, and strategies for efficient memory use.
- 00:30:00 - 00:35:00
Introduces new Nanite features in a recent engine update, including spline meshes and tessellation, to improve graphics efficiency and memory use.
- 00:35:00 - 00:40:00
Talks about optimization for Nanite performance in large-scale environments, focusing on overdraw and rendering efficiency.
- 00:40:00 - 00:45:00
Presents debugging techniques for Lumen reflecting lights and global illumination effects in real-time projects.
- 00:45:00 - 00:51:14
Concludes with virtual shadow maps, detailing recent improvements and outlining performance analysis techniques.
Mind Map
Video Q&A
What is virtualization in graphics?
Virtualization creates a sparse version of something, enabling storage and usage of only necessary parts in working memory.
Why is virtual texturing important?
Virtual texturing allows for efficient memory usage by streaming in parts of a texture as needed, reducing the risk of memory overload.
What updates does Nanite have in UE5.4?
Nanite spline meshes, tessellation, and GPU-driven materials are some of the updates, improving efficiency and flexibility.
How does Lumen handle reflections in UE5.4?
Lumen uses a new performance overview mode to better manage reflections and optimize rendering efficiency.
What is the role of virtual shadow maps?
Virtual shadow maps cache and update only necessary shadow parts, improving rendering efficiency.
How can virtual textures be enabled?
In the project settings, enable virtual texture streaming and adjust material sampler types accordingly.
What are the two types of virtual texturing in UE5?
Streaming virtual textures save memory with a slight performance cost, while runtime virtual textures save performance with a memory cost.
How does Nanite optimize geometry in UE5?
Nanite virtualizes micro-polygon geometry, offering near pixel-perfect LOD by simplifying clusters of triangles.
What performance considerations are there for Lumen?
Budget around 4ms for 60 FPS games and optimize using specific console variables to manage GI and reflections.
What tools help debug virtual texturing issues?
Use stat streaming and virtual texture memory stats, and utilize console variables for detailed analysis.
View more video summaries
Tony Stark & Steve Rogers Chopping Wood Scene - Avengers: Age of Ultron (2015) Movie CLIP HD
Day-3 | Virtual Machines Part-1 | Free DevOps Course | 45 days | #devopscourse #2023 #learning #vm
ITIL Process Skeleton - Part 3 of 4 - Video 004
Macroeconomics: Crash Course Economics #5
SPF Pro-SmartPhone Forensic System Professional-SOP-Downgrade Extraction
The Trading Industry Will Hate Me For Uploading This Smart Money Course
- 00:00:00hello everybody uh quick show of hands
- 00:00:03who was here for Ari's
- 00:00:06talk I'm sorry I don't have a
- 00:00:10guitar I'm not as cool as Ari no my name
- 00:00:13is Matt ostle I am but a humble senior
- 00:00:16technical artist at epic games and to
- 00:00:19the surprise of nobody I have more to
- 00:00:21say about performance and memory of our
- 00:00:24next gen graphics features uh I'm going
- 00:00:26to assume that we are all reasonably
- 00:00:28familiar with things like Nana Lumin and
- 00:00:30virtual Shadow map so I'm not going to
- 00:00:31get into the intro stuff um want to give
- 00:00:35some updates on it um show you some new
- 00:00:38things get into a little get into the
- 00:00:40weeds a little bit so to speak on all
- 00:00:41these features so
- 00:00:44um here's a general overview of what I'm
- 00:00:46going to do really quickly I'm going to
- 00:00:48throw out some project settings so Ari
- 00:00:49was talking about the Epic way there's a
- 00:00:51couple more things I wanted to add on
- 00:00:53top of that I also want to talk about
- 00:00:54virtual textures for probably longer
- 00:00:57than you would expect and obvious L
- 00:01:00we're going to talk about nanite Lumen
- 00:01:01virtual Shadow maps and maybe even some
- 00:01:04Q&A and ultimately this talk is about
- 00:01:07making efficient use of time and memory
- 00:01:09both efficient use of time and memory on
- 00:01:11the GPU and efficient use of your time
- 00:01:14and memory as developers right so in the
- 00:01:17spirit of efficiency wanted to cover
- 00:01:20some of these project settings really
- 00:01:21quickly before we get started wanted to
- 00:01:23have a slide that's a reference um and
- 00:01:26this is assuming that we are doing a
- 00:01:28full-blown bells and whistles all the
- 00:01:30features top-of-the-line ue5 title um
- 00:01:35not totally rendering related but I want
- 00:01:37to throw this one out first uh go into
- 00:01:39your project settings and set your
- 00:01:40startup map to nothing just make a new
- 00:01:42empty level save it that's your startup
- 00:01:45map it improves your editor startup time
- 00:01:47so you don't always have to load every
- 00:01:49single thing in the map every time you
- 00:01:50want to do something um and I'm assuming
- 00:01:53that we are going to be using nanite I'm
- 00:01:55assuming we're going to be using Lumen
- 00:01:56and we're going to be using uh virtual
- 00:01:58Shadow Maps so you can turn off allow
- 00:02:00static lighting because you're not
- 00:02:02baking lighting and it'll let you also
- 00:02:04use material ambient occlusion with
- 00:02:06Lumen which is nice uh probably not
- 00:02:09going to get to talk about these during
- 00:02:10the nanite section but there are a
- 00:02:12couple of project settings called
- 00:02:13reverse index buffer and depth only
- 00:02:15buffer this basically creates a version
- 00:02:17of the um vertex array for all of our
- 00:02:21static meshes in a different order so
- 00:02:23that it's more efficient to draw for
- 00:02:26reverse index if we're drawing stuff
- 00:02:27with a negative scale don't do stuff
- 00:02:29with scale please um so we can turn that
- 00:02:32one off and then if we're using nanite
- 00:02:34we nanite is going to do a lot of the
- 00:02:36stuff that it needs to do so we don't
- 00:02:37need depth only buffer and this will
- 00:02:38save us static mesh memory especially as
- 00:02:41we start using nanite resolution
- 00:02:42geometry we've got millions of triangles
- 00:02:45those things can get pretty sizable um
- 00:02:47and then if we are using Lumen for
- 00:02:49software rate tracing we want to use or
- 00:02:51for Hardware rate tracing we want to use
- 00:02:53surface cache sampling for our real-time
- 00:02:55uh projects and if we're using software
- 00:02:57rate tracing we're going to use Global
- 00:02:59traces for efficiency and of course we
- 00:03:01will set virtual textures to
- 00:03:04enabled right so just to head this off
- 00:03:07because again I I kind of I I tricked
- 00:03:10you a little bit I'm mostly going to be
- 00:03:12talking about virtual textures um but
- 00:03:15what does that mean right um I feel like
- 00:03:18there are a lot of virtualized features
- 00:03:20in the engine and we just kind of yada
- 00:03:23yada yada past the virtual part and it's
- 00:03:25really important to understand what
- 00:03:27virtualization is in order to understand
- 00:03:30what these features are doing and why
- 00:03:31they are so efficient um and why we
- 00:03:33should be taking full advantage of them
- 00:03:35so generally speaking virtualization
- 00:03:37just means creating a sparse version of
- 00:03:40something so that we're only storing and
- 00:03:42using the bits of the thing that we need
- 00:03:44in working memory and not wor really
- 00:03:47worrying about the rest that is the tech
- 00:03:49art answer so uh imagine we have a book
- 00:03:53right we've got our book and the book
- 00:03:55has pages in it and we know what we know
- 00:03:57all of these pages right but we don't
- 00:03:59want to take all of these pages and all
- 00:04:01of the text on all of these pages and
- 00:04:02load it into working memory if we are
- 00:04:05just making a book reader right we know
- 00:04:07what page the viewer is looking at and
- 00:04:10we don't really care about the rest of
- 00:04:11the pages right we can pull those into
- 00:04:13memory as we need them but maybe they're
- 00:04:16going to scroll fast scroll quickly
- 00:04:18through the book so maybe we need some
- 00:04:20information about the pages on either
- 00:04:22side of the one that the viewer is
- 00:04:24looking at but maybe not as at a high
- 00:04:26resolution and then if the page is all
- 00:04:28the way at the end of the book we don't
- 00:04:29really need any information about those
- 00:04:31pages so we can lower their resolution
- 00:04:34and now we have a more efficient data
- 00:04:37structure for storing the relevant parts
- 00:04:40of the book and displaying them to the
- 00:04:41user that's effectively what virtual
- 00:04:44virtualization is doing um and there why
- 00:04:48why did we and when I say we here I'm
- 00:04:50not just talking about epic games I'm
- 00:04:52talking about the games industry
- 00:04:54everybody working in real-time Graphics
- 00:04:56as a whole why did we need to virtualize
- 00:04:58stuff well back in the day we really
- 00:05:00only had like three things that we had
- 00:05:01to worry about right textures meshes and
- 00:05:04other and then as we started getting
- 00:05:06more advanced with our graphics features
- 00:05:08as the assets that we started generating
- 00:05:10started getting bigger um we needed more
- 00:05:13we needed more room on the on vram in in
- 00:05:17memory but it turns out that memory
- 00:05:19sizes have not been increasing at the
- 00:05:21same rate as our demands on them and
- 00:05:24then of course we're also adding new
- 00:05:25features right distance Fields loomin
- 00:05:28virtual Shadow Maps runtime virtual
- 00:05:30textures all of these features are
- 00:05:31placing demands on a not growing as
- 00:05:35quickly amount of virtual uh video
- 00:05:38memory and so we needed to virtualize it
- 00:05:40so we can make more efficient use of the
- 00:05:42memory that we have available right
- 00:05:44efficiency so the biggest offender right
- 00:05:48was textures so we virtualized our
- 00:05:50textures so that leads me to Virtual
- 00:05:53textures um we've had these in the
- 00:05:55engine for quite a while I think going
- 00:05:56back to about 422 but they are not a
- 00:05:58default feature you have to opt into
- 00:06:00these um it is it is a project setting
- 00:06:03and there's a little bit of extra work
- 00:06:04that we have to do to utilize these
- 00:06:06efficiently um but basically all we're
- 00:06:08doing is we create a page table of uh
- 00:06:11out of a texture and we're able to
- 00:06:13stream in parts of a texture at
- 00:06:15different niip levels depending on what
- 00:06:18we need we have a feedback pass that
- 00:06:20tells us uh what myip level we need for
- 00:06:22these and I've got a little
- 00:06:23visualization here this is using r.v.
- 00:06:26borders one just to help me visualize oh
- 00:06:28these are all the different FES at all
- 00:06:30the different resolutions so that you
- 00:06:31can see like even some parts of a
- 00:06:34texture are not totally visible at any
- 00:06:36given
- 00:06:37time and to give you a sense of the
- 00:06:40benefits of virtual texturing I want to
- 00:06:42take a look at the project that we've
- 00:06:43got here this is the hillside sample it
- 00:06:45is an architectural visualization and
- 00:06:47linear content project it's not for
- 00:06:49games it's not for real time rendering
- 00:06:52but importantly it is virtual textured
- 00:06:55by default and I want to look at so
- 00:06:58we've got stat streaming here here and I
- 00:07:00will zoom in on this so stat streaming
- 00:07:02right we've got our streaming pool this
- 00:07:04is the default value of 2,000 megabytes
- 00:07:06but you'll look at the required pool
- 00:07:08this is how many streaming non-
- 00:07:10virtually streamed textures that we need
- 00:07:12to load into memory into that 2,000
- 00:07:14megabyte pool and that
- 00:07:17is 95 megabytes which is not a lot right
- 00:07:21but then we go look at stat virtual
- 00:07:23texture memory and if we combine the
- 00:07:24total physical memory which is all of
- 00:07:26the different uh compression types and
- 00:07:28the page table which is is how we look
- 00:07:30up all of those different compression
- 00:07:31types we're using about 500 megabytes
- 00:07:34which is wild right 5 500 megabytes for
- 00:07:37all of the textures in this in this very
- 00:07:40high resolution scene and if we go look
- 00:07:42at the total dis size this is MIP zero
- 00:07:44of all of the virtual Textures in the
- 00:07:46project 22 gigabytes so through through
- 00:07:50the efficient use of virtual texturing
- 00:07:52we're able to take what could have been
- 00:07:55an outofmemory crash if we didn't stream
- 00:07:58any of these textures and we're getting
- 00:07:59it down we're using only 500 megabytes
- 00:08:02to draw this entire scene which is wild
- 00:08:04to me um so there are two options for
- 00:08:08virtual texturing in the engine we've
- 00:08:09got streaming virtual textures and
- 00:08:11runtime virtual textures we what we like
- 00:08:14to say is that streaming virtual
- 00:08:15textures save you memory at the marginal
- 00:08:18cost of performance and runtime virtual
- 00:08:20textures save you performance at the
- 00:08:22cost of memory and we're probably more
- 00:08:25familiar with runtime virtual textures
- 00:08:27because we've set them up on our
- 00:08:28landscape I've got a couple of videos
- 00:08:30about them up on YouTube already so I'm
- 00:08:33not going to talk about runtime I'm only
- 00:08:34going to focus on streaming today
- 00:08:35because this is the one that I think is
- 00:08:38underutilized right now um because I
- 00:08:41feel like it's a little scary it's a
- 00:08:43little different um so I want to
- 00:08:45demystify it so all we really have to do
- 00:08:48if we are uh streaming our virtual if we
- 00:08:50want to do a virtual texture we we
- 00:08:52enable it in our project settings of
- 00:08:54course and then in our texture asset we
- 00:08:57can go to Virtual and we can turn on
- 00:08:59Virtual texture streaming great we're
- 00:09:01done easy peasy thanks for coming out
- 00:09:03everybody no stick around um there's a
- 00:09:06little bit more work that we have to do
- 00:09:08and one of the things I wanted to
- 00:09:09highlight in in this section here is
- 00:09:11that this is a 2K texture and one of the
- 00:09:14misconceptions that I think people have
- 00:09:16about virtual textures is much like
- 00:09:18nanite we all thought oh it's only for
- 00:09:20high resolution geometry and then at uh
- 00:09:22unre Fest New Orleans I had to get up
- 00:09:23and say if it can be nanite it should be
- 00:09:25nanite I don't care how many triangles
- 00:09:27it is similarly with virtual te texing
- 00:09:30you can virtually virtually stream
- 00:09:33textures smaller than 4K it's not just
- 00:09:36for high resolution textures does it
- 00:09:38make it easier to use high resolution
- 00:09:39textures yes it also is efficient for
- 00:09:42lower resolution textures as well but
- 00:09:45there's a little tricky thing that you
- 00:09:46have to do when you were using virtual
- 00:09:48textures and you have to modify your
- 00:09:49materials a little bit so even though I
- 00:09:51check virtual texture streaming on the
- 00:09:54texture asset doesn't mean my work is
- 00:09:56done I next have to go to the material
- 00:09:59and this is the um this is the default
- 00:10:01material for uh for the Hillside and uh
- 00:10:05what it uses for all of its texture
- 00:10:07parameters is virtual textures there
- 00:10:10there is no option to use non- Virtual
- 00:10:12Textures in this material because the
- 00:10:14sampler type is set to a virtual sampler
- 00:10:17type so if you use a virtual texture now
- 00:10:19you can only have virtual color virtual
- 00:10:21gray scale virtual Alpha and so on and
- 00:10:23so forth so this is a this is a thing
- 00:10:25that you need to think about when you
- 00:10:27building your projects I'll talk about
- 00:10:28that in a second here but you're looking
- 00:10:30at this and go Matt that looks like an
- 00:10:32awful lot of work I have to go into all
- 00:10:33my textures I have to rightclick set the
- 00:10:36value and then I have to go into all my
- 00:10:38materials and I have to update all my
- 00:10:39sampler types and I thought you were a
- 00:10:41tech artist and you were all about
- 00:10:42efficiency well I am so I've got a
- 00:10:44little demo here where I've got two sets
- 00:10:46of textures and two uh two materials
- 00:10:49they're used in these two different
- 00:10:50material instances and they share a base
- 00:10:52material and what I want to demo here is
- 00:10:55I want to turn these textures virtual
- 00:10:58but if I then change the sampler type of
- 00:11:02the parameters that reference these
- 00:11:04textures I then have to change all of
- 00:11:06the other textures that are being used
- 00:11:08in that parameter and again this sounds
- 00:11:10like an efficiency nightmare so don't
- 00:11:12worry about it because all we have to do
- 00:11:13is say convert to Virtual texture and
- 00:11:15it's going to go up and find all the
- 00:11:17references for these textures change the
- 00:11:19sampler types and then find where all of
- 00:11:22the textures find all the textures that
- 00:11:24that parameter references and change
- 00:11:26those as well and you can set the the
- 00:11:29size threshold maybe you don't want to
- 00:11:30do a 512 you definitely don't want to do
- 00:11:32anything lower than 128 so we can filter
- 00:11:35these and I can say Okay I want all of
- 00:11:37these to be virtual I hit okay I let
- 00:11:39that
- 00:11:41convert and you see without ever having
- 00:11:44to have to touch the other assets here
- 00:11:46they are also converted to Virtual
- 00:11:48texture as well makes things a little
- 00:11:49easier on
- 00:11:50you but there are some things I want you
- 00:11:53to consider as you're building out your
- 00:11:55projects for virtual texturing um it is
- 00:11:57a little better if you plan on it from
- 00:11:58day one you know going in all right
- 00:12:00we're going to do this this is how we're
- 00:12:01going to do it then you don't have to
- 00:12:02then do this kind of post conversion
- 00:12:04step which you might miss something um
- 00:12:06you do have to make sure that you have
- 00:12:08separate default textures for virtual
- 00:12:10textures or for all the virtual sampler
- 00:12:12types so you want a default virtual
- 00:12:14color default virtual grayscale default
- 00:12:16virtual normal and so on and so forth so
- 00:12:19that you can reference those in your
- 00:12:20materials and not have hard references
- 00:12:22to Textures in all of your your parent
- 00:12:24materials and the other sort of
- 00:12:26construction consideration I want you to
- 00:12:28make is the concept called virtual
- 00:12:30texture Stacks which is basically the
- 00:12:32unique UV combinations within a material
- 00:12:35so I've got a little demo material here
- 00:12:38and I've got a texture sample that's
- 00:12:39using uv0 I've got another texture
- 00:12:42sample that uses uh a double tiling I've
- 00:12:45got my normal map that's using uv0 and
- 00:12:47I've got this other blend texture that's
- 00:12:49using a 3X tiling and what this
- 00:12:52ultimately ends up in is this virtual
- 00:12:54texture Stacks number of three there are
- 00:12:56three different UV combinations Within
- 00:12:59material and in order to get the
- 00:13:01feedback that we need about this
- 00:13:02material we have to evaluate that for
- 00:13:04each of these different virtual texture
- 00:13:06Stacks but the nice thing is that if I
- 00:13:08for example plug you know the same UV
- 00:13:11thing into my normals it doesn't
- 00:13:13increase my number of virtual texture
- 00:13:14stacks and similarly if I copy and paste
- 00:13:17this up here it's the same thing it also
- 00:13:20does not increase the number of virtual
- 00:13:22texture Stacks but then if I want to
- 00:13:23tile my normal 4X that will increase my
- 00:13:26number of stacks so a thing to keep in
- 00:13:28mind as you're building out your
- 00:13:32materials so when I say that virt
- 00:13:34streaming virtual textures save you
- 00:13:36memory at the cost of performance
- 00:13:39there's two two sides of this there is a
- 00:13:40CPU cost and there is a GPU cost on the
- 00:13:43CPU side we need to do a little bit of
- 00:13:45work to figure out which mips and tiles
- 00:13:47need to be uploaded to the GPU right
- 00:13:49that's hey what what page are we looking
- 00:13:51at um however this cost isn't really all
- 00:13:55that extreme and a lot of this work is
- 00:13:57handled off the main thread it's not
- 00:13:58handled on the game thread um one of the
- 00:14:00costs is going to be uploading stuff to
- 00:14:02to the GPU there are some console
- 00:14:04variables to control that there is r.
- 00:14:06vt. Max uploads per frame and that will
- 00:14:08affect both runtime and streaming
- 00:14:11virtual textures but with runtime
- 00:14:12virtual textures we want to keep our
- 00:14:14uploads fairly low because if we have
- 00:14:16too many uploads then uh we're rendering
- 00:14:19our landscape material too many times
- 00:14:21and we lose our performance gains there
- 00:14:23so we can separate runtime virtual
- 00:14:25texture uploads from streaming virtual
- 00:14:26texture uploads with r. vt. uploads per
- 00:14:29frame. streaming again the Sears from
- 00:14:32this are all going to be in The Links at
- 00:14:34the end of the show don't worry about
- 00:14:35writing them down so that's kind of the
- 00:14:38the the cost on the CPU side it is
- 00:14:40fairly negligible on the GPU side
- 00:14:44obviously I have to talk about this
- 00:14:45there is an additional cost to using
- 00:14:46virtual textures and the short of it is
- 00:14:49that we have to first sample the page
- 00:14:51table to figure out where in memory all
- 00:14:54of our um all of our tiles are actually
- 00:14:57stored so there's like a little layer of
- 00:14:59indirection a little bit of an extra
- 00:15:00sample so it does you do have to keep
- 00:15:03that in mind not necessarily going to be
- 00:15:06a huge issue if we've just got a bunch
- 00:15:07of regular texture samples in our
- 00:15:08default material but if you're using
- 00:15:10like a virtual texture flow map to look
- 00:15:13up another virtual texture to look up
- 00:15:14another virtual texture to look up
- 00:15:16another virtual texture and so on and so
- 00:15:18forth that can get a little squiggly um
- 00:15:20but again I really want you to profile
- 00:15:23um ultimately at the end of the
- 00:15:25day I want you to know what is causing
- 00:15:29the problem don't immediately assume
- 00:15:31that oh I'm using streaming virtual
- 00:15:33textures so I'm going to have bad CPU
- 00:15:36profile try it out learn learn from your
- 00:15:40project your project will tell you what
- 00:15:41the problem
- 00:15:44is so virtual textures are great and
- 00:15:47we're going to use them in our projects
- 00:15:49but we have to do a little bit of
- 00:15:50Creative Accounting because um I
- 00:15:53mentioned earlier right the default
- 00:15:55value for the non-virally streamed
- 00:15:58texture streaming is 2,000 megab but
- 00:16:00we're only using 100 of those right now
- 00:16:02so we've got a really we've got a really
- 00:16:04big truck that is carrying not a lot of
- 00:16:07weight right so we got to we got to move
- 00:16:09some stuff
- 00:16:10around
- 00:16:12um and maybe as we're building out our
- 00:16:15projects r. streaming. pool size can
- 00:16:17come down because we don't really need
- 00:16:19it and in fact if you hide screen
- 00:16:21messages and you lower that number the
- 00:16:22engine will tell you if something is
- 00:16:24wrong you'll get that thing in the top
- 00:16:26left corner that's like streaming pool
- 00:16:27over budget X number number of gigabytes
- 00:16:30it's going to tell you where that high
- 00:16:31water mark is as you're testing things
- 00:16:33out um similarly with virtual texture
- 00:16:36memory as of 54 we've got a we've got a
- 00:16:38fun little thing now that lets us figure
- 00:16:41out what those high water marks is um
- 00:16:44but the tricky thing with virtual
- 00:16:45textures is that each of the different
- 00:16:47compression types have their own pools
- 00:16:49it's not just one pool for all textures
- 00:16:52it's a different pool for dxt5 bc4 and
- 00:16:55so on and so forth and in 54 we added a
- 00:16:58fun new thing called uh or we added a
- 00:17:01project setting for virtual texture pool
- 00:17:03sizes and maybe you've seen this as
- 00:17:05you're flying around in your updated 54
- 00:17:07projects you'll see this like resizing
- 00:17:09virtual texture streaming pool in the
- 00:17:11bottom right corner little toast pop up
- 00:17:13so what that's asking you to do is go
- 00:17:15into your project settings and go to the
- 00:17:17virtual texture pool settings and it's
- 00:17:19going to have this transient pool list
- 00:17:22down here and that's keeping track of
- 00:17:24the high water marks and it's going to
- 00:17:25say hey copy these values into this
- 00:17:28fixed pool so transient that's only for
- 00:17:31that session fixed pool is the actual
- 00:17:33thing in your default engine ini so you
- 00:17:35can see the high water mark for dxt5
- 00:17:38that's going to be like our base color
- 00:17:39textures that was 105 megabytes okay I'm
- 00:17:43going to set my high water mark to 105
- 00:17:45megabytes bc4 we got up to about we
- 00:17:47needed about 39 megabytes before things
- 00:17:50got over subscribed and so on and so
- 00:17:51forth um I of course have turned off
- 00:17:53Pool auto grow in editor because it does
- 00:17:56hitch a little bit every time it has to
- 00:17:57do that I wanted to keep this
- 00:17:58presentation type uh and then there's a
- 00:18:00default size in megabytes so if you
- 00:18:02wanted to start out your project and
- 00:18:04have a really high value of that you
- 00:18:06could absolutely do that um but then as
- 00:18:09we get toward the end of the project we
- 00:18:10want to make sure that we are using just
- 00:18:12as much memory as we absolutely need to
- 00:18:16um so that we're again making efficient
- 00:18:18use of the of our our video memory U
- 00:18:20because again generally speaking we we
- 00:18:23don't want to use a pickup truck to
- 00:18:24carry around a pebble right that's not
- 00:18:26in efficient use of that space But
- 00:18:29similarly we also don't want to
- 00:18:32use we also don't want to use a a coupe
- 00:18:35to carry around a boulder because when
- 00:18:38we try and fit too much into a pool that
- 00:18:41cannot hold it uh we've all seen this
- 00:18:44before right we all know what this is
- 00:18:46this is a dropped myth we had to lower
- 00:18:49the texture resolution so that we could
- 00:18:50fit everything into our available space
- 00:18:53and with virtual textures sometimes
- 00:18:55we'll just drop a texture out of the
- 00:18:57pool alt together and then you start
- 00:18:59getting popping right that's not really
- 00:19:01nobody enjoys that the other thing I
- 00:19:04wanted to call out with uh virtual
- 00:19:05texture memory and and memory in general
- 00:19:07is a new tool in 54 called the render
- 00:19:10resource Vier and this is great because
- 00:19:12this is all of it um this is everything
- 00:19:14that we need to represent the scene in
- 00:19:16video memory all at once and you can see
- 00:19:18oh I've got my virtual virtual texture
- 00:19:21uh page pool I've got my nanite
- 00:19:23streaming pool my TSR history color
- 00:19:26buffer and I can see oh I've got my
- 00:19:28virtual physical textur so these are the
- 00:19:30different compression types there's also
- 00:19:32the virtual page table this is how we go
- 00:19:34reference all of that stuff in memory
- 00:19:37and this is going to give you a lot more
- 00:19:39information about all of the different
- 00:19:41features that are using memory in your
- 00:19:43project it's because it's not just
- 00:19:45textures and meshes anymore right so I
- 00:19:47mentioned
- 00:19:49um we need to do we need to get feedback
- 00:19:52from the GPU about what mips and tiles
- 00:19:55we need to load into memory at any given
- 00:19:56time and we do this in about once every
- 00:20:00one one in every 16 pixels that's
- 00:20:03controlled by r.v. feedback Factor so
- 00:20:07hey every 16 pixels we're going to
- 00:20:08Jitter this around and we're going to
- 00:20:10pick which pixel we want to test and
- 00:20:11then we'll figure out if we have the
- 00:20:13right tile for that cue the upload and
- 00:20:15so on and so forth um and pages are
- 00:20:17being stored in memory after they've
- 00:20:19last been seen because sometimes if
- 00:20:21you're looking over at the right side of
- 00:20:23the room and then you really quickly
- 00:20:24move over to the left side of the room
- 00:20:26okay we don't see those textures anymore
- 00:20:28so we can drop them and and we can we
- 00:20:30can make room for something else but
- 00:20:32then if you really quickly turn back
- 00:20:34over in the amount of time that it took
- 00:20:36me from go right to left to right I
- 00:20:38don't really have time to re-upload that
- 00:20:40texture and we still want it to be there
- 00:20:43when we look back at it so there is a
- 00:20:45basically a timer which is represented
- 00:20:47by all these little gradients timing
- 00:20:48down um that is r.v. page3 threshold and
- 00:20:52there's a weird thing that can happen
- 00:20:54where if sometimes the feedback factor
- 00:20:57and the number of St STS and the number
- 00:20:59of textures that we've got in the scene
- 00:21:01we don't quite hit everything and so we
- 00:21:03start dropping textures that are
- 00:21:05actually visible in the scene um and
- 00:21:08what you will see where this will come
- 00:21:09up is the U map requests value in stat
- 00:21:13virtual texturing will start to go
- 00:21:14really high in a scene that is static
- 00:21:17because if you're not moving your camera
- 00:21:19theoretically everything should settle
- 00:21:20right so just wanted to throw that out
- 00:21:22there a fun little Pro tip thing to
- 00:21:24watch out for with virtual
- 00:21:25texturing but how we feeling feeling
- 00:21:28good about this
- 00:21:29everybody see you use Virtual textures
- 00:21:30we're feeling
- 00:21:32great we know where our project settings
- 00:21:34are we're good to go okay so let's talk
- 00:21:38about nanite so nanite is also a virtual
- 00:21:41feature it is virtualized micr polygon
- 00:21:45geometry really quickly quick overview
- 00:21:47nanite is great it's going to give you
- 00:21:49near Pixel Perfect lotting of your
- 00:21:52geometry and what that means what I mean
- 00:21:55by that is that even though you might
- 00:21:57have 10 million trying Les in your
- 00:22:00static mesh asset in your fbx it is very
- 00:22:03rare that you will ever be rasterizing
- 00:22:05all 10 of those Millions on the GPU in
- 00:22:09the frame that you're looking at right
- 00:22:10it's trying to be efficient about using
- 00:22:14the GPU so what it does the way it does
- 00:22:16this is it pre-s simplifies your
- 00:22:18geometry from the disk in uh clusters of
- 00:22:22100 about 128 triangles and then it will
- 00:22:26simplify those clusters down so that we
- 00:22:28can okay you know these 10 clusters were
- 00:22:30together now we can simplifies those
- 00:22:32down to one cluster based on uh the max
- 00:22:35Edge uh Max edges per pixel Max pixels
- 00:22:38per Edge uh and these are basically
- 00:22:41virtual texture tiles right these are
- 00:22:43you know discret units of the geometry
- 00:22:46that we can stream in and out based on
- 00:22:48our feedback um and as an aside if you
- 00:22:51were using Nan I highly recommend also
- 00:22:53using virtual Shadow Maps those two
- 00:22:56those two systems work together uh very
- 00:22:58very well and they're meant to work
- 00:23:01together so that you get really nice
- 00:23:02high resolution Shadows fairly
- 00:23:04efficiently using nanite so there's some
- 00:23:07fun updates some fun new stuff that has
- 00:23:08come online uh with 54 that I wanted to
- 00:23:11talk about very very briefly the first
- 00:23:13is nanite blind meshes are now
- 00:23:14production ready and so I've got here a
- 00:23:16little example I've got my spline mesh
- 00:23:18and I want to conform this sidewalk to
- 00:23:20the road so what I'll use is our
- 00:23:22modeling tools and the draw spline tool
- 00:23:25I'll grab that existing blueprint and
- 00:23:26now I can click in the world and draw
- 00:23:28out a spline and it's going to conform
- 00:23:31That Sidewalk to the terrain and I'm
- 00:23:32feeling really happy about that so I hit
- 00:23:35accept and then I can go into our nanite
- 00:23:40mask
- 00:23:41visualization there we go so you can see
- 00:23:43I have a spline mesh and it is nanite
- 00:23:47huzzah the other fun thing that we've
- 00:23:49got is nanite tessellation uh this is
- 00:23:52still experimental but I do want to talk
- 00:23:54about it and Aaron Lang me is going to
- 00:23:55talk about this a lot more later today
- 00:23:57um
- 00:23:59generally speaking this is a sometimes
- 00:24:01food it does add a cost to rasterizing
- 00:24:04all of these triangles because we have
- 00:24:05to figure out how to tessellate and then
- 00:24:07displace them um but there are some
- 00:24:09interesting memory benefits that we can
- 00:24:11get out of this level of tessellation so
- 00:24:13I've got two rocks from quickel Mega
- 00:24:15scans here the one on the left is nanite
- 00:24:17resolution and the one on the right is
- 00:24:19medium resolution and to show you
- 00:24:21nothing except my sleeve here's the
- 00:24:23wireframe View mode these are the
- 00:24:24respective base resolutions of these
- 00:24:26meshes and then if I turn on on
- 00:24:28tessellation so I do r. nanite
- 00:24:30tessellation
- 00:24:321 and then if I go into my nanite
- 00:24:36triangles View mode we're going to see
- 00:24:38that they are now uniformly tesselated
- 00:24:41and the benefit here is that I can use
- 00:24:43maybe a 4 megabyte or 1 Megabyte
- 00:24:46displacement texture to displace a
- 00:24:4950,000 triangle mesh and that's going to
- 00:24:51have ultimately a lower dis footprint
- 00:24:53than a 2 million triangle base mesh with
- 00:24:56ninite so if you're worried about your
- 00:24:58Hy drive space there might be some
- 00:25:00benefits here to evaluate based on okay
- 00:25:02what resolution do I need how detailed
- 00:25:04do I need this geometry to be and so
- 00:25:06on the other fun one that I don't think
- 00:25:08a lot of us have really talked about yet
- 00:25:10is a new checkbox we added to nanite the
- 00:25:13the nanite setting struct so by default
- 00:25:16when nanite is simplifying things
- 00:25:17together to generate those clusters it
- 00:25:20will interpolate linearly the attributes
- 00:25:23of all of the vertices so as we you know
- 00:25:25collapse two vers together we want to in
- 00:25:28this is a desirable Behavior
- 00:25:30generally unless we need to do something
- 00:25:32like vertex animated textures where we
- 00:25:34need an explicit UV cordinate to look up
- 00:25:37an explicit value in a uh in a texture
- 00:25:41so what we did was we added a checkbox
- 00:25:43that said hey don't do that pick a UV
- 00:25:46value when you are interpolating or when
- 00:25:48you're collapsing that geometry down
- 00:25:50together what this means is now we can
- 00:25:52do vertex animated texture techniques
- 00:25:54using nanite and what this looks like I
- 00:25:58used theim to texture plugin on this uh
- 00:26:01on these twin motion assets to generate
- 00:26:02a little crowd and I turned the Mal to
- 00:26:05nanite and now I have a little nanite
- 00:26:07crowd which is a lot of fun uh General
- 00:26:10recommendation here though because these
- 00:26:12are all going to be programmably
- 00:26:13rasterized basically treat them like
- 00:26:15trees right we got to make sure we have
- 00:26:17wpo disabled distance set um we're
- 00:26:19probably going to want to use a fairly
- 00:26:21Uh current gen resolution character mesh
- 00:26:24we don't want to go you know 3 million
- 00:26:26triangles for each of these but this is
- 00:26:28now option for rendering things like
- 00:26:31crowds um so those are things that we
- 00:26:33have to opt into we might have to do a
- 00:26:35little bit of setup for the next couple
- 00:26:37of things I want to talk about are
- 00:26:38things that you get for free with 54 so
- 00:26:40the first one as my colleague Graham
- 00:26:41wall discusses in his recent GDC 2024
- 00:26:44talk uh nanite GPU driven
- 00:26:47materials uh the first one is that now
- 00:26:50nanite shading takes place in compute
- 00:26:52shaders so we are finally using compute
- 00:26:54shaders to shade pixels which is wild um
- 00:26:58the benefit here is that uh as I talked
- 00:27:01about in New Orleans last year if you
- 00:27:03had a bunch of uh materials referenced
- 00:27:05in your scene that weren't visible those
- 00:27:07created what were called empty shading
- 00:27:09bins empty shading bins had a little bit
- 00:27:11of a cost because we had to transition
- 00:27:12between each of those and now with
- 00:27:14compute we can compact all of those
- 00:27:16together and now we are only worrying
- 00:27:18about shading the pixels and the
- 00:27:20materials that are actually visible on
- 00:27:22screen this is great this reduces a
- 00:27:24bunch of overhead and you don't have to
- 00:27:26do anything for this uh the next one is
- 00:27:30as we as he was building all of this out
- 00:27:32we also got variably rate shaded nanite
- 00:27:34uh which is a really big Improvement
- 00:27:36because it means that now if you are
- 00:27:38shading a 2X two quad you actually get
- 00:27:40to use all of those pixels instead of
- 00:27:42doing a 2 x two quad for each pixel so
- 00:27:44that you could get the derivatives the
- 00:27:46thing you have to watch out for is that
- 00:27:48if you're using things like DDX or ddy
- 00:27:50in your materials that breaks variable
- 00:27:53rate shading so you can't use those in
- 00:27:55your materials and you're like man I
- 00:27:56really don't want to I'm not looking for
- 00:27:58to having to go through each of my
- 00:28:00materials to figure out where all of
- 00:28:02these things are don't worry I got you
- 00:28:04so all we have to do is r. nanite Dov
- 00:28:06visualize Advanced one Sears in The
- 00:28:09Links at the end of the show and that's
- 00:28:11going to give me a few more view modes
- 00:28:12for nanite and one of them is no
- 00:28:15derivative Ops so this is showing me all
- 00:28:17of the materials in blue that don't use
- 00:28:20explicit derivatives like DDX or ddy and
- 00:28:22in red all of the materials that are so
- 00:28:24now I can go find those materials and
- 00:28:26evaluate them do I really need need to
- 00:28:28be using DDX ddy um and this is going to
- 00:28:31help you make sure that you are able to
- 00:28:32variably rate shade your nanite which is
- 00:28:35great uh the other one the other New
- 00:28:37View mode that has come online with
- 00:28:39nanite that I wanted to highlight is the
- 00:28:41pixel programmable View mode so this is
- 00:28:44showing us all of the materials that are
- 00:28:46masked pixel depth offset or dynamic
- 00:28:49displacement so again there is going to
- 00:28:52be a cost to this and pixel programmable
- 00:28:54is always going to be evaluated so we
- 00:28:55got to go figure out what's going on
- 00:28:56over there um but this is going to give
- 00:28:58you a little bit more information into
- 00:29:00digging into your nanite
- 00:29:03performance which is the next thing that
- 00:29:05I wanted to talk about um I think in in
- 00:29:08New Orleans I didn't really talk about a
- 00:29:10philosophy of how to debug the
- 00:29:12performance of nanite so I wanted to do
- 00:29:14that if you'll bear with me uh because
- 00:29:16one of the things that I have found in
- 00:29:18talking to people is there is a um a
- 00:29:21sort of instinct to over optimize and
- 00:29:23and to start optimizing for problems
- 00:29:25that are not there so I want to talk
- 00:29:27about how we can look at nanite from a
- 00:29:30performance debugging point of view so
- 00:29:32Step One is it
- 00:29:35nanite uh I've talked to some people
- 00:29:37before they're debugging the scen like
- 00:29:39oh man nanite you know we really gota we
- 00:29:41really got to solve this problem with
- 00:29:42nanite nanite is causing us a bunch of
- 00:29:44performance problems like great what's
- 00:29:45your nanite budget how many milliseconds
- 00:29:47are you willing to spend on nanite in a
- 00:29:4816 millisecond frame is nanite over that
- 00:29:52great okay now we can start talking
- 00:29:54about it and there's two places that
- 00:29:55we're going to look for this um the
- 00:29:57first first one the first place we're
- 00:29:59going to look for this is programmable
- 00:30:01rasterization and this is the nanite viz
- 00:30:03buffer so if we do a GPU visualizer with
- 00:30:06control shift comma this is going to
- 00:30:07show me in the scene nanite visz buffer
- 00:30:10so this is usually where we see some
- 00:30:12problems with nanite performance this is
- 00:30:13where um and programmable rasterization
- 00:30:16specifically so if we want to see more
- 00:30:19information about that we just have to
- 00:30:20do r. nanite doow mesh draw events one
- 00:30:23and then if we do another GPU visualizer
- 00:30:26I can dig into that scene value
- 00:30:28and go to nanit Vis buffer draw geometry
- 00:30:31main pass and this is going to show me
- 00:30:33hardware rasterize and software
- 00:30:34rasterize and if I expand this out this
- 00:30:37shows me fixed function rasterization
- 00:30:39which is all of the stuff that is opaque
- 00:30:40and non-deforming and all of the
- 00:30:42materials that are programmably
- 00:30:44rasterized for whatever reason right wpo
- 00:30:47Max Materials and so on so this gives me
- 00:30:49some information and I can look at these
- 00:30:51values and go okay is is my issue in
- 00:30:55fixed function or is it in the
- 00:30:57accumulation of all of these raster bins
- 00:31:00and their various uh various evaluations
- 00:31:03right so now I can figure this out now
- 00:31:05the way that I kind of look at this if I
- 00:31:07wanted to kind of diagnose it further
- 00:31:09start figuring out the binary tree the
- 00:31:12first thing that I'm going to do is go
- 00:31:13nanite visualization evaluate wpo so
- 00:31:16this is going to show me all of the
- 00:31:17things that are going to be programmably
- 00:31:19rasterized we have to evaluate all of
- 00:31:20the the vertex Shader three times per
- 00:31:22pixel and so on and so forth if this
- 00:31:25view is mostly red and my programmable
- 00:31:27rasterization cost is high I might then
- 00:31:29assume that the issue is with um mask
- 00:31:33materials I might have a lot of mask
- 00:31:34materials in my scene and I can see that
- 00:31:36if I go into our pixel programmable View
- 00:31:39mode so wow there's a lot more pixel
- 00:31:41programmable stuff than is evaluating
- 00:31:43wpo so maybe the first thing that I'm
- 00:31:45going to look at is my mask
- 00:31:47materials right okay so maybe it's not
- 00:31:51either of those maybe you have no pixel
- 00:31:53programmable you have no no vertex
- 00:31:55programmable great so then then we start
- 00:31:58looking at fixed function rasterization
- 00:32:00which is all of the stuff that is opaque
- 00:32:01and non-deforming and the first one of
- 00:32:04the things that you might look at here
- 00:32:06is nanite overdraw and you'll notice
- 00:32:08that I've been talking about nanite
- 00:32:09performance for a bit and this is the
- 00:32:11first time that I'm bringing up overdraw
- 00:32:13because I feel like one of the things
- 00:32:15that I see a happening a lot is we go
- 00:32:17nanite visualization overdraw and this
- 00:32:20is our first Port of Call to say there
- 00:32:23is a nanite performance issue and that's
- 00:32:25not really how I want you to be using
- 00:32:27this View mode I want you to use this
- 00:32:30View mode as a I have noticed a
- 00:32:32performance problem and this is a tool
- 00:32:34to diagnose where that issue might be
- 00:32:36coming from this is not telling you
- 00:32:38there is an issue with nanite overdraw
- 00:32:40it can tell you where that issue might
- 00:32:41be and how you can resolve it so it's
- 00:32:44really easy for us to look at this View
- 00:32:46mode and go ah there are white pixels
- 00:32:48white pixels is a lot of nanite overdraw
- 00:32:50so I immediately have to start solving
- 00:32:53for that I I would prefer if you didn't
- 00:32:56um I but I want to talk about n night
- 00:32:58overdraw cuz there's a few different
- 00:32:59things that we can do when we're
- 00:33:00building our content to mitigate the
- 00:33:03issue out of the gate so that we never
- 00:33:05have to worry about that or or we can
- 00:33:07worry about it less so we've got these
- 00:33:09shipping containers here and I want to
- 00:33:11talk about these so we go into wireframe
- 00:33:13we can see that these are really long
- 00:33:16thin triangles which is not really great
- 00:33:18for nanite and one of the reasons for
- 00:33:20that is we go to nanite visualization
- 00:33:22clusters you can see that the whole side
- 00:33:25of this shipping container uh is
- 00:33:27comprises a few clusters and those
- 00:33:30aren't going to partially ude right and
- 00:33:32one of the really cool things about
- 00:33:33nanite is we can ude clusters we don't
- 00:33:35have to rasterize clusters that aren't
- 00:33:38visible but if these clusters are
- 00:33:39partially visible you can see this
- 00:33:41shipping container is almost totally
- 00:33:43overdrawing this other shipping
- 00:33:45container because those clusters are
- 00:33:47partially visible so even if I go along
- 00:33:49here right I can see that top Edge so I
- 00:33:51have to rasterize all of the stuff
- 00:33:53underneath right so maybe there's a
- 00:33:55better way we can be building our
- 00:33:56content so that we can uh better
- 00:33:59leverage things like we we can improve
- 00:34:01our nanite overdraw without necessarily
- 00:34:04going in and immediately over optimizing
- 00:34:06everything so what I've got here is a uh
- 00:34:09I used our geometry scripting tools to
- 00:34:11somewhat crudely remesh these and
- 00:34:13uniformly remesh these so I could
- 00:34:14demonstrate a thing that you can do as
- 00:34:16you're building out your content um so I
- 00:34:18can go to my clusters View mode and you
- 00:34:20can see that now I've got individual
- 00:34:22clusters scattered all over the surface
- 00:34:25so that if I go into nanite overdraw
- 00:34:29what we'll see is that the shipping
- 00:34:31container behind is being partially uded
- 00:34:34right as we move around as those
- 00:34:35clusters become invisible we're not
- 00:34:38rasterizing them this is this is great
- 00:34:39we want this um and you can also see
- 00:34:42that even even the the one shipping
- 00:34:44container itself is more effectively
- 00:34:46partially uding itself this is right we
- 00:34:49can build our content thinking about
- 00:34:51cluster culling and it'll give us more
- 00:34:54efficient anti overd drop performance
- 00:34:56there are a couple of things that we we
- 00:34:57can do to cause more problems with
- 00:34:59nanite overdraw and its interpenetration
- 00:35:01so if I Jam a bunch of static meshes
- 00:35:04together they're partially overlapping
- 00:35:06clusters are called based on bounds so
- 00:35:08if you have stuff that's really closely
- 00:35:10stacked like these shipping containers
- 00:35:12we can't call those clusters and so we
- 00:35:14get even more overdraw so as you're
- 00:35:16building out your worlds making sure
- 00:35:18that you're not jamming a bunch of
- 00:35:19static meshes together we can ensure
- 00:35:22that we are not going to um run into
- 00:35:24these kind of overdraw issues right so
- 00:35:26this is a preventive
- 00:35:28measure um the other thing that I see a
- 00:35:31lot with uh with nanite is GBL right I
- 00:35:33want to scatter a bunch of stuff over my
- 00:35:35sci-fi spaceship or something like that
- 00:35:38uh I have very crudely mocked up an
- 00:35:39example here with some new assets from
- 00:35:41quickel Mega scans that look a lot like
- 00:35:44GBL uh but if I go into nanite overdraw
- 00:35:46you might think like oh man that's going
- 00:35:48to cause a lot of overdraw but because
- 00:35:50they're sitting on a really a large flat
- 00:35:52surface that large flat surface is going
- 00:35:54to olude everything underneath so we
- 00:35:56don't end up with a huge stack of nanite
- 00:35:59overdraw which is actually kind of nice
- 00:36:01um but we do you know maybe if we get
- 00:36:03down to a glancing angle we can get some
- 00:36:05hot spots but those hot spots are going
- 00:36:07to be isolated to that kind of parallel
- 00:36:09um parallel onside view okay so finally
- 00:36:14so now we've gone through nanite Vis
- 00:36:16buffer now we're getting to nanite base
- 00:36:18pass and the the short of it is um prior
- 00:36:22to uh uh variable rate shading and
- 00:36:25compute shading this gets more compa it
- 00:36:27does get a little trickier but the short
- 00:36:29of it is if if nanite base pass is out
- 00:36:32of the budget that we have defined for
- 00:36:34nanite base pass because we're defining
- 00:36:35our budgets early uh there are two
- 00:36:37things this could be it is either the
- 00:36:39number of shading bins so you have a few
- 00:36:41thousand of those we can always see that
- 00:36:42with uh nanite stats so if I just do a
- 00:36:45little nanite stats that's going to
- 00:36:46bring bring up these numbers I love
- 00:36:48numbers and I can see the total number
- 00:36:50of shading bins I can then subtract that
- 00:36:52for the empty for the number of empty
- 00:36:53shading bins and I can start figuring
- 00:36:55out all right how many shading bins like
- 00:36:57how many draw calls am I doing
- 00:36:59effectively right so I'm going to do
- 00:37:00nanite stats off the other possibility
- 00:37:02here is your materials are expensive
- 00:37:04right this is when we are filling the
- 00:37:06pixels with nanite or when nanite is
- 00:37:09drawing the materials to all of the
- 00:37:11pixels that it rasterized so then we
- 00:37:13could finally start talking about
- 00:37:14material
- 00:37:19performance okay so really quickly I'm
- 00:37:22going to talk about Lumen um quick
- 00:37:24refresher this is a performant realtime
- 00:37:26rate Trace global illumin and reflection
- 00:37:28system it is tracing uh pixels per Ray
- 00:37:31not Rays per pixel like a normal Ray
- 00:37:33Trace system so that we can do things
- 00:37:35more efficiently I want to talk really
- 00:37:37quickly about some performance
- 00:37:38considerations and demo a little bit of
- 00:37:40debugging with Lumen issues so uh in
- 00:37:44October last year I said if you were
- 00:37:46going to do a 60 frames per second game
- 00:37:48you should budget about 4 milliseconds
- 00:37:50for for Lumen if you're doing a 30
- 00:37:53frames per second game you should budget
- 00:37:55about 8 milliseconds and I left it at
- 00:37:56that and I yada yada yed past it and I
- 00:37:58didn't really explain what I meant by
- 00:38:00this so what I'm and it gets tricky
- 00:38:03because Lumen is running asynchronously
- 00:38:05on consolle so it's hard to give
- 00:38:07specifics here and Nan or and Lumen also
- 00:38:10comprises multiple passes and features
- 00:38:13Lumen scene lighting diffuse indirect in
- 00:38:15AO Reflections lights and so on so what
- 00:38:17I mean by this what I actually mean by
- 00:38:20this is if you turn Lumen off r. Dynamic
- 00:38:23Global illumination method z r.
- 00:38:25reflection method Z you should see
- 00:38:27frames that are about four or 8
- 00:38:30milliseconds faster so what can we do
- 00:38:33about that um there's a couple of things
- 00:38:35I talked about in in uh October last
- 00:38:38year right we can move stuff out of the
- 00:38:40Lumin scene set things to visible and
- 00:38:41Ray tracing false set things to um set
- 00:38:45things to affect Dynamic and direct
- 00:38:48lighting false those kinds of things are
- 00:38:49are are things that we can do to make it
- 00:38:51more efficient to render the Lumen scene
- 00:38:53but maybe we want to talk about
- 00:38:54Reflections because one of the things I
- 00:38:55talked about was r. Lumin . reflections.
- 00:38:58Max roughness to trace because if our
- 00:39:00reflection cost is really high we got to
- 00:39:01figure out what's going on there well
- 00:39:03great news in 54 we added a new View
- 00:39:05mode which is the performance overview
- 00:39:07mode and this is showing me all of the
- 00:39:09pixels that are tracing dedicated
- 00:39:11reflection rays and I might look at this
- 00:39:13and go wow why are all of the trees so
- 00:39:16uh things that are in green are um are
- 00:39:20using the uh subsurface or two-sided
- 00:39:22foliage shading model those have a
- 00:39:24separate console variable r. lin.
- 00:39:26reflections. Maxx roughness to trace
- 00:39:27four foliage and I'm like wow why are
- 00:39:30all of these trees casting dedicated
- 00:39:33reflection Rays I'm like oh the weather
- 00:39:36Shader is making them low roughness
- 00:39:39because they're wet cuz it just rained
- 00:39:41well I don't really need to trace
- 00:39:42dedicated reflection Rays for these
- 00:39:44trees right I'm not going to see
- 00:39:45anything in those Reflections so I can
- 00:39:47go r. Lumen do Reflections
- 00:39:51dot Max roughness to trace for foliage
- 00:39:55maybe I set that to zero I don't trees
- 00:39:57to reflect anything and now I'm I'm
- 00:39:59tracing fewer reflection rays and then I
- 00:40:02look at the rest of the scene and I go
- 00:40:04wow for what I'm looking at that is a
- 00:40:08lot of dedicated reflection rays and
- 00:40:10that's not maybe the most efficient use
- 00:40:12of my GPU time and so I can start to
- 00:40:15look at this and go r. Lumen do
- 00:40:18Reflections reflections. Max roughness
- 00:40:21to trace maybe I set that to 2 and I
- 00:40:24notic you know maybe my puddles got a
- 00:40:26little smaller but those puddles had a
- 00:40:28really high roughness fall off so that
- 00:40:30we were getting that value but maybe I
- 00:40:31might go into that material and kind of
- 00:40:33clamp it down so that I'm only you know
- 00:40:36I have a bigger area for those puddles
- 00:40:38but like the side of this building over
- 00:40:40here this building was tracing
- 00:40:42reflection Rays that's a bit silly to me
- 00:40:44maybe we don't need to do that so if
- 00:40:47your Lumin Reflections are pretty high
- 00:40:49that's a place to look um we can talk
- 00:40:51more about it there's also a Lumin
- 00:40:53performance guide that is in The Links
- 00:40:54at the end of the show that's going to
- 00:40:55go into way more detail than I have time
- 00:40:57for uh I also wanted to talk very
- 00:40:59briefly about how we can debug Lumen
- 00:41:01where we can look to figure out where
- 00:41:04why a problem is happening with Lumen
- 00:41:05and how we might resolve it um not going
- 00:41:08to get into Super specifics we are
- 00:41:09running out of time but I wanted to give
- 00:41:11you a little hint about where we can
- 00:41:12start looking so maybe the keyy among
- 00:41:14you have already noticed this
- 00:41:16issue right there so keep your eyes
- 00:41:19right there you see that subtle flicker
- 00:41:21there's just like a you know on off on
- 00:41:26off right
- 00:41:27I'm pretty sure it's Lumen so what I
- 00:41:30might do to figure out if it's it's
- 00:41:31Lumin Dynamic Global illumination would
- 00:41:33be r. Dynamic Global illumination method
- 00:41:36zero and now I'm not using any Global
- 00:41:39illumination oh I know why that doesn't
- 00:41:41work we'll talk about that later so
- 00:41:44um see me after class so I know that
- 00:41:47this is a lumen issue uh and I want to
- 00:41:50figure out what it is well there are two
- 00:41:51different ways that Lumen traces rays
- 00:41:54and gathers information for its Global
- 00:41:55illumination there are screen traces and
- 00:41:58World traces screen traces are look are
- 00:42:00just grabbing values from pixels on the
- 00:42:02screen World traces are pulling values
- 00:42:04from the Lumen scene and I and the first
- 00:42:06thing that I recommend you do if you're
- 00:42:07debugging Lumen is figure out which is
- 00:42:09which right what is the binary search
- 00:42:11tree so I'll go into show I'll go to
- 00:42:13Lumen and I can turn off screen traces
- 00:42:16and if I turn off screen traces and the
- 00:42:17issue goes away I know it's screen
- 00:42:19traces right and this is where I might
- 00:42:21start looking at at console variables
- 00:42:23like r. lomin scene. probe screen probe
- 00:42:26gather which are too innumerable to list
- 00:42:29um the other possibility is that it is
- 00:42:31going to be Global traces so going to
- 00:42:33turn our screen traces back on and where
- 00:42:36I might start looking here is in the uh
- 00:42:39Lumen Lumen scene View mode I might look
- 00:42:41at this and see wow there's some stuff
- 00:42:43some of the stuff is maybe too black I
- 00:42:45would expect some of this stuff to be a
- 00:42:47little bit more visible why is that
- 00:42:48happening so I can go then look at the
- 00:42:50surface cache View mode and everything
- 00:42:53that is in yellow Lumen said I don't
- 00:42:55need to worry about this I'm going to
- 00:42:56drop out of the Lumen scene everything
- 00:42:58that is in purple was drawn into the
- 00:43:01Lumen scene but those pixels were not
- 00:43:03rendered too because maybe our surface
- 00:43:06cards were not set up correctly or our
- 00:43:08mesh is too multivariant and complex and
- 00:43:11so nothing Lumen wasn't able to draw to
- 00:43:14those pixels which is why something like
- 00:43:16you know the side of this catwalk over
- 00:43:18here is not showing up correctly in the
- 00:43:20Lumen
- 00:43:21scene okay I think I think I'm going to
- 00:43:24do it all right got to talk about
- 00:43:26Shadows can't can't not talk about
- 00:43:28Shadows um virtual Shadow maps are our
- 00:43:31new system for for ue5 uh instead of
- 00:43:34writing out a bunch of Shadow depth
- 00:43:35Cascades every frame we virtualize those
- 00:43:38Shadow Pages which lets us cache these
- 00:43:40pages and only update the parts of the
- 00:43:42Shadow map that we actually need uh to
- 00:43:44give you a a overview of that right we
- 00:43:46talked about virtual textures those have
- 00:43:48tiles similarly virtual Shadow maps have
- 00:43:52um have pages and each of these little
- 00:43:55squares we can think of as a effectively
- 00:43:57a virtual texture
- 00:43:59tile so uh couple of quick things I
- 00:44:02wanted to mention about this uh new to
- 00:44:0454 there's an update to static versus
- 00:44:06Dynamic caching so if you're unfamiliar
- 00:44:09by default virtual Shadow Maps will say
- 00:44:12all right I've got things that are
- 00:44:13static they are not invalidating the
- 00:44:14shadow cache every frame so those get
- 00:44:16drawn into the static pages and then I
- 00:44:18have stuff that do invalidate cache
- 00:44:21pages and those are going to go into a
- 00:44:23dynamic uh virtual Shadow map cache so
- 00:44:25they're separate right um but if
- 00:44:28something ever prior to 54 if something
- 00:44:31ever invalidated cash page it would
- 00:44:33always be treated as Dynamic so if I
- 00:44:36walk up to a tree it invalidates cash
- 00:44:38Pages great it's Dynamic but then if I
- 00:44:40walk far away from the tree Beyond its
- 00:44:42wpo disabled distance because we set our
- 00:44:44wpo disabled
- 00:44:45distances it's not invalidating cache
- 00:44:48pages but it is still being treated as
- 00:44:50Dynamic and it's still going to be drawn
- 00:44:52into Dynamic cache Pages even though it
- 00:44:54doesn't actually need to be so um
- 00:44:57we've got a console variable for that
- 00:44:59which is r. shadow. virtual. c. static
- 00:45:01separate. frame static threshold seears
- 00:45:05in the links um and this is similar to
- 00:45:08the r. vt. page threshold this is
- 00:45:10basically saying okay how long should
- 00:45:13something not invalidate cach Pages
- 00:45:15before I turn it to static because when
- 00:45:17I turn it to static there's a little bit
- 00:45:19of cost there when I turn it back to
- 00:45:20Dynamic there's a little bit of cost
- 00:45:22there the other one the other change to
- 00:45:24Virtual Shadow Maps is how we treat the
- 00:45:26wp disable distance so I set up this
- 00:45:29Ferris wheel here it is totally
- 00:45:31animating with wpo so that I could
- 00:45:32contrive this example and I've set a
- 00:45:35really short wpo disable distance on it
- 00:45:37so I can demo this so wpo disable
- 00:45:40distance if I get far away from this
- 00:45:42thing it will stop animating and it will
- 00:45:46then then of course it will stop
- 00:45:47invalidating Shadow cache Pages which is
- 00:45:49desirable
- 00:45:50Behavior but what would happen prior to
- 00:45:5354 is if we had this thing casting a
- 00:45:56really long Shadow like at dok or Dawn
- 00:45:59if it was close to us it would
- 00:46:01invalidate cache Pages all the way out
- 00:46:04the length of its shadow which is kind
- 00:46:06of counterintuitive that's not really
- 00:46:08how we would want to do this we would
- 00:46:09think that the wpo disable distance
- 00:46:11would have an effect on how far it can
- 00:46:15invalidate cach Pages which is what we
- 00:46:17did for 54 so let's go back to that
- 00:46:20let's get closer to it to get it
- 00:46:21animating and so what the new system
- 00:46:24does is it it takes the wpo disabled
- 00:46:26distance it rounds up to the nearest
- 00:46:28clip map level which if we look at clip
- 00:46:32map mask level so we can see all right
- 00:46:34so it's going out to here out to here
- 00:46:35out to here and then I'm going to round
- 00:46:37up to green from green to red and then
- 00:46:40if the shadow is casting into red don't
- 00:46:42invalidate any of the red cache Pages
- 00:46:44there's a l bias to this so it'll
- 00:46:46actually go out a little bit further
- 00:46:48just to make sure that you don't see the
- 00:46:49artifact that I'm about to show you
- 00:46:51because I want to show you what this
- 00:46:52looks like so if you ever see it you
- 00:46:53know what it is so I've got the wpo
- 00:46:57disable distance set really short the
- 00:46:59LOD bias on the uh wpo disable distance
- 00:47:03is set to three so we're going to go
- 00:47:05three beyond that by default but then if
- 00:47:07I do r. shadow. virtual. clip map. wpo
- 00:47:12disable distance. L bias and I set that
- 00:47:15to zero hopefully you can see uh half of
- 00:47:19the Shadow stopped animating do y'all
- 00:47:20see that right so if you ever see this
- 00:47:23like artifact where just like half the
- 00:47:26shadow is moving and the other half
- 00:47:27isn't that's what is going on here it's
- 00:47:29a combination of the wpo disable
- 00:47:31distance on the Primitive and the L bias
- 00:47:34in that console variable so it gives you
- 00:47:35a little bit of control there so I'm
- 00:47:37going to bring that back but I contrived
- 00:47:39this example um short wpo disabled
- 00:47:42distance set that uh SAR really really
- 00:47:44low not necessarily what you're going to
- 00:47:46do in production but thing to watch out
- 00:47:48for uh other thing I want to talk about
- 00:47:50is virtual shadat performance and again
- 00:47:52kind of how we want to debug that uh
- 00:47:54firstly before you start optimizing vs
- 00:47:56Ms and cach invalidations and things
- 00:47:58like that start with the nanite viz
- 00:48:00buffer
- 00:48:02because if we go into our GPU visualizer
- 00:48:05I can go to shadow depths and we can see
- 00:48:08that in render virtual Shadow Maps
- 00:48:11nanite nanite draw geometry this is also
- 00:48:14a nanite visz buffer pass so if you
- 00:48:17optimize your nanite viz buffer you will
- 00:48:19also have benefits When You're rendering
- 00:48:20virtual Shadow Maps which is great um
- 00:48:23the other thing that you can do again as
- 00:48:25we're debugging the Nan visualization
- 00:48:27tree uh as we're debugging our nanite
- 00:48:30programmable rasterization there's a
- 00:48:32virtual Shadow map nanite overdraw View
- 00:48:34mode for virtual Shadow maps from the
- 00:48:37perspective of the directional light and
- 00:48:39you're going to see like not everything
- 00:48:40is rendering in this view because only
- 00:48:43those cache pages are the ones that are
- 00:48:44being
- 00:48:46invalidated okay uh and of course like I
- 00:48:49said I'm a numbers guy I want to show
- 00:48:51you some numbers so one of the things
- 00:48:52that we can do with virtual Shadow Maps
- 00:48:54r. Shader print one and then we can do
- 00:48:57r. shadow.
- 00:48:59virtual. show stats one and this is
- 00:49:02going to give us a bunch of numbers on
- 00:49:04our screen that's going to show us the
- 00:49:05number of physical Pages um the amount
- 00:49:09of non- nanite geometry that we're
- 00:49:11that's being drawn which is fairly
- 00:49:13expensive with vssm the number of static
- 00:49:15pages that are being invalidated the
- 00:49:17number of dynamic pages that are cached
- 00:49:18and invalidated this is going to give
- 00:49:20you some numbers to help you figure out
- 00:49:22where to look should I be focusing on
- 00:49:24dynamic invalidations or static
- 00:49:25invalidations and so on so turn that one
- 00:49:30off okay so what have we learned today
- 00:49:34well we learned some project settings
- 00:49:35that are going to make things a little
- 00:49:36easier for us we learned about setting
- 00:49:39up virtual textures and the
- 00:49:40considerations that we're going to need
- 00:49:41to make as we are building them out uh
- 00:49:44we also learned how we can debug nanite
- 00:49:46performance we learned about some of the
- 00:49:48new features with nanite like
- 00:49:49tessellation and spline meshes uh we got
- 00:49:52some tips for debugging Lumen right
- 00:49:54setting our screen traces or World
- 00:49:56traces or which console variables we
- 00:49:58might want to look at and we learned uh
- 00:50:00some fun things about virtual Shadow
- 00:50:01maps and how we might debug some of
- 00:50:03those issues so that we can figure out
- 00:50:05the extent of our invalidations uh very
- 00:50:07very quickly there are some other talks
- 00:50:08I want you to go to so if you leave
- 00:50:10right now you might be able to make it
- 00:50:11to uh adding a rendering fast path
- 00:50:13without breaking Unreal Engine uh you
- 00:50:15might also want to go to optimizing
- 00:50:17survival games for mobile or again Aaron
- 00:50:19Lang me is doing an artists guide to
- 00:50:21using nanite tessellation uh tomorrow I
- 00:50:23just love talking about PCG so
- 00:50:25definitely check out firstep to advance
- 00:50:27development there's also optimizing the
- 00:50:29game Thread game thread from our friends
- 00:50:31at Tanglewood games and of course
- 00:50:33performance budget budgeting in a post
- 00:50:35poly count world because asking how many
- 00:50:38triangles you can have for nanite is the
- 00:50:40wrong question so definitely go check
- 00:50:42that talk out all right we are at time
- 00:50:44so um I'm going to give you a choice it
- 00:50:48is lunchtime I know we're all hungry if
- 00:50:51you would like to leave for lunch feel
- 00:50:53free to leave but nobody's in this room
- 00:50:56for the next hour so I am happy to keep
- 00:50:58taking questions so if you want to leave
- 00:51:00feel free if you want to ask questions
- 00:51:02head up to the
- 00:51:03microphones on that that's all I got
- 00:51:05thank you all so much for coming out I
- 00:51:06really appreciate your time you have
- 00:51:09been a lovely audience
- Virtualization
- Performance Optimization
- Virtual Texturing
- Nanite
- Lumen
- Unreal Engine 5
- Graphics Features
- Rendering Efficiency
- Memory Management
- Debugging Techniques