Optimizing UE5: Advanced Rendering, Graphics Performance, and Memory Management | Unreal Fest 2024

00:51:14
https://www.youtube.com/watch?v=dj4kNnj4FAQ

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.

Show more

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

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