1
$\begingroup$

How can I properly optimize a scene at a material level? For example. I have 2 different versions of the same rock texture in different resolutions, 1k for the background and 8k for the foreground. Would I just create 2 different shaders of the same rock texture with 1k and 8k maps? Or is there a clever or alternate way of doing this?

$\endgroup$
5
  • $\begingroup$ Hello, I'm not sure to understand your question, if you give the same name to the image you can reload it in the Image Texture, just put your mouse cursor in the Shader Editor and press Alt R? $\endgroup$
    – moonboots
    Commented May 9 at 9:21
  • $\begingroup$ Hey thanks for your response, maybe if I explain my scenario it'll be easier to understand. I have several versions of a rock texture, in 1k, 2k, 4k, 8k resolutions. I want to be able to switch from different resolution per each model such as a rock in the background can have the 1k version of the shader and a rock in the foreground can have the 8k version. The obvious answer for me is to make variations of the shader in each of it's resolutions. My question is if there's an alternative way to do this without creating several different resolution versions of the shader. Does this make sense? $\endgroup$
    – elistuff
    Commented May 10 at 15:37
  • $\begingroup$ Oh ok, but i don't think it will make any difference in terms of render time if this is what you're thinking about $\endgroup$
    – moonboots
    Commented May 10 at 15:43
  • $\begingroup$ Yeah I'm trying to optimize any scene I create so render times don't go too crazy. I did a quick test just rendering a plane with a 1k vs 8k texture and it took half a second longer with all setting just the same on a single frame. I'm assuming that would snowball if I didn't optimize a scene accordingly. $\endgroup$
    – elistuff
    Commented May 10 at 17:11
  • $\begingroup$ Half a second is well within tolerance-- your computer is doing a lot of stuff differently from moment to moment (and optimizing under-the-hood for what you just did a second ago, and responding to changing thermal conditions, etc.) Your biggest issues here are with memory usage. Using a single material for all rocks will optimize for that. Use the 8k mat, and Blender will downscale at a distance automatically, that's what texture filtering is for. $\endgroup$
    – Nathan
    Commented May 11 at 17:39

1 Answer 1

2
$\begingroup$

Take everything I say with a grain of salt as there is no clear documentation on how Blender handles this all, but if I am not wrong: Blender does MIP Mapping, it should generate and use lower resolutions depending on the distance.

See: Mip Mapping - polycount

We don't have control over fading distances and whatnot, nor proper mipmapping support off .tx files: Tiled and MipMapped .tx textures support ⁠— Right-Click Select

Aside from that, Blender doesn't have an easy way to let you specify resolution variants of a texture. It's probably doable using python, but since nodes are shared across identical material, it would also mean to make new materials for each distance zone. Which would work only on static renders and also might not be the best time saver, especially in Eevee which needs to compile each shader too.

I did a quick test just rendering a plane with a 1k vs 8k texture and it took half a second longer with all setting just the same on a single frame. I'm assuming that would snowball if I didn't optimize a scene accordingly.

Yes and no. You load textures in memory, which takes some time, but then it's reused as-is for the whole frame at any place using the same texture, and even across frames if you enable Persistent Data.

But definitely be smart about which resolution you load. No need to load 8k textures if you only see that material from afar, even if some are closer than others.
And even for close objects, distance isn't the only factor in chosing texture resolujtion: are they in focus? Are they the center of attention? Do they move? Is a higher resolution even doing much? Try to consider any aspect that might make a justification - or lack there of - for more resolution.

And there isn't just resolution to save memory and render time. Channel packing and bit depth for example. Hence I highly recommend reading the following:

$\endgroup$
1
  • $\begingroup$ Thanks so much for your detailed response! I will definitely take some time to go over each of the points you made and research them further! $\endgroup$
    – elistuff
    Commented May 10 at 19:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .