Forum

Author Topic: How to find the optimal texture resolution ?  (Read 688 times)

cyrilp

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
How to find the optimal texture resolution ?
« on: January 26, 2022, 03:02:04 PM »
I'm using 8k textures.

How can i find how many of them i need for a model to get the best result ?

using too few is obviously not giving a good result.

but i have noticed that too many gives a worse result too so it's important to have a way to find the right number.

jenkinsm

  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: How to find the optimal texture resolution ?
« Reply #1 on: January 26, 2022, 11:36:01 PM »
I'm using 8k textures.

How can i find how many of them i need for a model to get the best result ?

using too few is obviously not giving a good result.

but i have noticed that too many gives a worse result too so it's important to have a way to find the right number.

What worse results are you getting by using too many textures? And how would you define "too many"?

I tend to generate 16K or 32K textures and use a few for huge models, or one for smaller ones. Seems to work great for my purposes.

Maybe instead of generating more texture atlases, try generating larger ones.

Vladimir Denisov

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: How to find the optimal texture resolution ?
« Reply #2 on: January 26, 2022, 11:38:18 PM »
I think the resolution of the original images should be sufficient to produce acceptable results.

Bzuco

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: How to find the optimal texture resolution ?
« Reply #3 on: January 27, 2022, 11:38:18 AM »
Before metashape creates UV on model, you can't know how big or how many textures you will need.
For creating UV I am using external app (RizomUV) where after creating UV islands I see what is the texel density for certain resolution.
Second parameter I know is what is the pixel density on my photos(roughly calculated). Then it is easy decision if make the final texture larger/smaller or for really big project how many textures will be needed.
In attachment example 16k texture after packing of UV islands was ~enough to keep pixel density of original photos.

jenkinsm

  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: How to find the optimal texture resolution ?
« Reply #4 on: January 31, 2022, 12:53:39 PM »
Before metashape creates UV on model, you can't know how big or how many textures you will need.
For creating UV I am using external app (RizomUV) where after creating UV islands I see what is the texel density for certain resolution.
Second parameter I know is what is the pixel density on my photos(roughly calculated). Then it is easy decision if make the final texture larger/smaller or for really big project how many textures will be needed.
In attachment example 16k texture after packing of UV islands was ~enough to keep pixel density of original photos.


How do you calculate the pixel density and once you have that number, what do you do with it? I'm working on a large scale project for VR gaming and I want to preserve as much detail as possible, so I'd like to learn and apply your method for determine the number of textures I'll need (they'll all be either 16 or 32K)

Bzuco

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: How to find the optimal texture resolution ?
« Reply #5 on: January 31, 2022, 02:19:58 PM »
@jenkinsm

I am keeping roughly the same distance from objects/walls when I am taking photos.
So if some object on my photo has 394 pixels height and real height 460mm, then I know that pixel density of my photo is ~ 0.856pixels/mm.

If software you use doesn't tell you what is the texel density of unwrapped object, you need to calculate it:
Be sure, that all unwrapped UV islands has normalized size and are not stretched or compressed.
Then choice some polygon island in UV editor and measure its width/height in UV range (0.0 - 1.0). For example groups of polygons of some wall in UV editor has min. 0.452 and max. 0.687 in U direction - so you know the width is 0.687-0.452 = 0.235 and that is 1925 texels if you will be using 8k textures (8192 * 0.235 = 1925). In reality the size of that polygons on wall is e.g. 2400mm - so you know that the texel density of your unwrapped object on 8k texture is ~ 0.802 texels/mm , which is slightly lower than pixel density on photo...so you should make the groups of polygons in UW editor 1.067x larger to make texel density the same as photo pixel density.

For your VR project it would be good to use many smaller textures if you want to achieve maximum performance. Keep all details is sure thing. You should unwrap the whole environment in way, that all surfaces which are close to each other in reality, will be on the same one texture. This is good in terms of how GPU is sampling textures when rendering some part of the image. If some groups of pixels(e.g. square of 50x50 pixels on your screen) is using one texture and that texture(or it's required MIP level) is also small (1k or 2k) is highly likely that GPU will transfer that texture from VRAM to L2 cache and will be sampling it from cache(many times faster) and not from VRAM.
Check what is the size of L2 cache on your GPU you will be using and then choice the right size and compression of textures(1k DXT5 is 1.3MB, 1k DXT1 is 0.7MB, 2k DXT5 5.3MB, 2k DXT1 2.7MB, etc. ...).
There is no simple exact rule, how big textures should be, because the overall performance depends on your screen resolution, camera fov, object distance from camera => required texture MIP level,...but with smaler textures the chances are better.

So try to avoid large textures and when unwrapping the whole object or environment try to avoid that on one texture will be parts of real environment which are far away from each other.

You will need some good unwrapping software (I mentioned RizomUV), you will probably spent some time unwrapping your objects/environment to several UDIMs and then jump back to metashape bake the final textures  :).