>> Welcome to another Unreal Engine Tips & Tricks.
In today's episode, we are going to take a look
at how to deal with the Texture Streaming Pool Over Budget warning
that you can see here in the top left hand side of my viewport.
If you are seeing some blurry textures in your scene,
this may be a result from that warning.
And this is because I am over budget on my Texture Streaming Pool.
The Streaming Pool is the maximum amount
of video memory available to display streaming textures.
The system basically ensures that you get the best visual quality
of those textures while also managing the available texture
memory on your video card for those displayed textures.
Now, the way it all works is in the back end
there are some calculations done by the Unreal renderer
based on the texel size and the world bounds
to determine the best texel to pixel ratio
for all of the display textures on the screen.
And then Unreal has to determine whether they all
fit inside that amount of memory that is available.
If they don't fit inside the allocated
memory inside the Streaming Pool, Unreal
will start to go down in the different mip levels
to find a smaller texture that will fit
that can still be drawn on the screen with the best possible quality.
And it will keep doing this until everything fits safely
in that Streaming Pool.
Now, we can get a little bit more information
using a STAT command by going up to the window,
going down to Developer Tools selecting Output Log.
Now here in my console command line, I'm going to type in stat streaming.
Now the first thing to take note of is the Streaming Pool line,
which is set to 200 megabytes here.
Now, this is the max amount of VRAM or video memory
that we can make use of.
By default, Unreal Engine's high scalability settings
have this value set at 1,000 megabytes.
But I've gone ahead and changed this value to a lower value
so that we can get our warning message and see what to do.
Now keep in mind, any changes that we make here
are going to depend on your target video card's available RAM.
So in other words, we don't want to increase this value beyond what
our video card can handle.
But we're definitely going to need more than 200 megabytes.
So below this, we have our Required Pool here, which is 1,341.
So that's going to be 671% over that 200 megabyte.
So we are overflowing our budget by quite a lot.
We're going to want this number to be below 100.
Now before we go any further, let's first take
a look at how our textures are being used inside the project.
To do that, I'm going to go up to the window on the top left hand side.
Go down to Statistics.
And you're going to want to make sure that the Texture
Stats is selected here.
Now, you'll see we have a lot of different information here.
So we can take a look at the Max Dimension
and the Current Dimension of the textures inside our scene.
We also have our Fully Loaded Memory, how many times the textures are
used, and the Current Memory, which is what
we're going to take a look at today.
So if you click on this, it's going to enable
you to toggle between ascending and descending orders.
Now, we can see that there are many textures here
that could be optimized.
So one option would be to reduce the number of textures
we are using in the scene or reduce the size of those textures
if I look at the dimensions, you'll see
that I have a lot of 4K textures.
Now for this project, I've used a lot of Quixel Megascans.
I have my export settings set to 4K.
That's great for the foreground.
But I probably don't need that 4K for every single texture in my project.
Now, sampling higher resolution textures
is more expensive on the GPU.
So I'm going to go ahead and reduce some of these textures.
So here we're seeing the textures that take up the most memory.
Now, we can adjust each of these textures individually.
I could do this by double clicking here where it says Normal--
double clicking on this texture.
This is a Normal map for my foliage.
So I absolutely do not need this to be 4K.
So here, underneath Maximum Texture Size, I could lower this.
I'll go ahead and set it to 1024.
Hit Enter and Save.
Now I can refresh my statistics.
And you'll see that it no longer pops up.
Now, this can be time consuming depending
on how many textures you need to change.
So rather than doing that one at a time,
a quick trick is to select all of the textures in the Content Browser.
So to do that, I'm going to go to the Content folder.
I'll select the Filters button down below.
I'll go up to Materials & Textures, select Texture.
I'll go down to Other Filters.
Select In Use By Level.
I'm going to click on the first texture.
Scroll down on the right hand side.
Hit Shift on my keyboard.
Select that last texture.
Now I'm going to right click.
Go up to Asset Actions.
And select Bulk Edit via Property Matrix.
Now, we'll be using this to change texture information.
However, there are a lot of different settings
that you can change in a bulk manner.
Now if I go up to the Maximum Texture Size,
I could go in here and type 1024.
And it's going to change all of the textures I had selected.
Now, we may want to curate our texture resolutions a little bit.
For instance, some we may want to be at a 4K
texture, others at a much lower.
So I can hit the Pin icon next to Maximum Texture Size.
And you'll see that a column pops up here.
Now, a good rule of thumb would be to keep Albedo numbers at full res,
normal maps at about half the resolution,
and roughness maps at a quarter of the resolution.
So in order to do that, I'm going to scroll down
to where it says Normal here.
In this last column, I'm going to type in 1024 and hit Enter.
Now I'm going to select that cell.
Hit Control C on my keyboard.
Go down to the next line.
Scroll down, and using Shift on my keyboard,
select all of those Normals.
And then hit Control V on my keyboard to paste that texture
size into all of them.
Now I'm going to do the same thing for the roughness.
I'll set this to 512.
Copy and paste this number for all of the roughness textures.
Now I can go hit File, Save, to save all of them.
Now you may have noticed that the numbers
I am referring to for the texture sizes are power of twos.
This is important for mip generation--
so something like 512 by 512 as opposed to numbers
like 2,000 or 4,000.
If you do not do that, Unreal will not
be able to generate mipmaps for that texture.
These textures with no mips will affect what's loaded into VRAM
but are not streamed.
So this can still cause crashes if you
are trying to load too many of these textures at once.
Now, mipmap generation happens during importing of the texture
and creates a mipmap chain for the texture.
So the mipmap chain consists of multiple levels
of the sample image, each half the resolution
of the level before, which means the graphic card can render faster when
using the lower mips and also reduces the texture aliasing,
or shimmering, that becomes visible when having detailed texture
in certain distances.
The mips that are created are resolution dependent.
So the higher resolution textures will want higher mips.
Now, the engine will only go down the mip chain
to find a resolution that fits all of the heuristics of required
resolution, streaming pool, et cetera, which
is why you might be getting some blurriness in your project.
Because sometimes the Engine needs to use lower mips
than desired in order to fit everything inside of the Streaming
Pool.
Now, there may be moments where you do not want to generate a mipmap.
We will cover that information another day.
For now we've saved the new texture resolutions.
Let's go ahead and double check everything that we have.
I'll go ahead and close out of this window.
Now I'm going to go back to my Output Log and type in start streaming
to turn off those stats.
Now I'm going to go up to my View mode
and select Optimization Viewmodes.
Go down and select Required Texture Resolution.
Now, you'll see everything is a dark gray here.
We will need to specify a texture for it to give us information about it.
So go ahead and select this table that I have here.
I'll go up to Textures.
And since we changed the Normal and the Roughness,
I'll go ahead and double check my Roughness texture
and make sure that the resolution we apply
is indeed an appropriate resolution for this texture.
So here when I click it, you can see we're getting a gradient color.
So this is showing the ratio between the currently streamed texture
resolution and the resolution wanted by the GPU.
So you'll see that here in the foreground,
this is a good ratio for the resolution.
And in the back, it's going into that green territory,
saying that the resolution is higher than we need back there.
Now for this texture, it might be something
that we're willing to give up since it is in the foreground.
However, if we take a look at another texture, say at this gold pendant
here--
if I take a look at the Albedo, everything comes in green here.
So since this isn't an important part of the design,
there's not a lot of detail, it doesn't take up
a lot of pixels on the screen, I'm going
to go ahead and lower that texture size.
To do that, I'll go over to the Details panel on the right hand
side.
I'll scroll down to the Materials.
Hit the magnifying glass next to the Gold.
And I'm going to pull up that Albedo texture.
And you'll see that it's imported here at 2,048,
displayed at 2,048 in the game.
So I'm actually going to set this texture size to 128.
You can save that.
Close out of it.
And you'll see that the texture is still green.
Now, I could keep lowering this until it gets to white.
But I wanted to showcase how you could really curate specific memory
usage this way.
So you'll see that we reduced the texture size for this material.
But it won't be reducing the quality for my desired look for this scene.
So now that we've made some changes, let's
go back and look at the differences.
I'll go back to my Output Log.
I'm going to type in stat streaming.
Now we see that a Required Pool Size here is now 898.
So this is 449% over.
And that's over that 200 megabyte that I
had changed prior to this video.
So the default number for this is 1,000.
So let's go ahead and change that Streaming Pool Size back to 1,000.
To do that, I'm going to go down to my Output Log.
And I'm going to type in r.streaming.poolsize, space,
and then the value that I'll be setting it to, which is 1,000.
And I'll hit Enter on my keyboard.
Now our warning at the top left hand side has gone away.
And if we look at the Required Pool, this is now below 100 at 90%.
So let's summarize working with the Streaming Pool today and the options
we have available.
The steps that I showed you today are pretty general.
Depending on your use case and your industry,
you may take different steps to get to a Stream Pool
setup that works for you.
But let's review the steps we talked about today.
We can reduce the total number of visible textures in our scene.
Also, we can reduce the resolution of those visible textures.
So by bringing both of these things down,
we can help to eliminate the amount of memory needed by our Texture
Streaming system.
And then finally, we can increase the Streaming Pool
size, which will allow us to have more texture memory in use.
Now, we will want to make sure that those textures are powers
of two in generating mipmaps.
And then finally, we can increase the Texture Streaming Pool
size, which allows us to have more texture memory in use.
And this is going to be limited by the video card for your target
system.
So I'd advise you to double check your VRAM before moving forward.
If you raise the number too high and try
to fit more into VRAM than the video card can handle,
it will result in a crash.
Now, there's one more option available
that you might want to check out on your own.
And that's to use virtual textures.
This system streams only the required parts of a texture
from the disk, which can reduce the overall memory
burden of a given texture.
This Tips and Tricks video will not be covering those.
But feel free to look that up in the Unreal Documentation
for additional information or check out the video link located
in the description of this video.
All right, that's going to do it for this Tips & Tricks episode.
I hope you enjoyed it and found it useful.
We'll see you next time.