Agisoft Metashape

Agisoft Metashape => General => Topic started by: 3D_Scan_Fan on March 11, 2020, 04:39:24 AM

Title: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 11, 2020, 04:39:24 AM
Hi,

As the subject states, my generated textures are coming out really bad i.e. stripy, glitchy, virtually usable.

This happens after I bring the mesh back into Photoscan/Metashape from 3ds max after applying new UVs (a very simple cylindrical layout covering the mesh) and "Keep UVs" within the software.

The result is not what I've experienced before years and years ago, thus I'm pulling my hair as to why this is happening.

I've attached an example, you can see the stripes for this one.

Does anyone know or have experienced such matters?? I would really appreciate it if anyone can help me on this! :(
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 12, 2020, 02:24:04 PM
Anyone at all may I ask?

I've tried it again on a different mesh but still getting the same result! 🙁

I just want to have good working textures and I can't progress if this is happening 😢
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: Alexey Pasumansky on March 12, 2020, 03:52:39 PM
Hello 3D_Scan_Fan,

Is it possible to share any sample project (with aligned cameras and imported mesh with UV layout) and some source images for texture blending, so that we could observe similar behavior on our side and investigate the problem? If so, please send the download link to support@agisoft.com.
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 13, 2020, 03:32:13 AM
Hello 3D_Scan_Fan,

Is it possible to share any sample project (with aligned cameras and imported mesh with UV layout) and some source images for texture blending, so that we could observe similar behavior on our side and investigate the problem? If so, please send the download link to support@agisoft.com.

Hi Alexey,

I have just sent you a WeTransfer of this project, it should have everything you need.

Please confirm that you've received it.
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: wojtek on March 13, 2020, 11:09:45 AM
Anyone at all may I ask?

I've tried it again on a different mesh but still getting the same result! 🙁

I just want to have good working textures and I can't progress if this is happening 😢

Is the UV layout messed up (mesh -> view mesh UVs) or only the texture map?
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 13, 2020, 01:12:13 PM
Anyone at all may I ask?

I've tried it again on a different mesh but still getting the same result! 🙁

I just want to have good working textures and I can't progress if this is happening 😢

Is the UV layout messed up (mesh -> view mesh UVs) or only the texture map?

It's only the texture map.

This happens when applying a new UV layout in 3ds max, exporting that mesh and then importing it back into Photoscan  :(
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: Alexey Pasumansky on March 13, 2020, 05:07:28 PM
Hello 3D_Scan_Fan,

Thank you for sharing the project.

I've noticed that there are some UV coordinates which are negative and which are over 1.0 value. Was it intentional?
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 13, 2020, 05:21:32 PM
No, I don't quite understand that actually.

The new UVs were done in 3ds max with a Cylindrical map applied, also made to "Fit" the mesh. Thus it should've covered it.
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: Alexey Pasumansky on March 13, 2020, 08:16:12 PM
Hello 3D_Scan_Fan,

I have checked the OBJ file that you are importing (with UV coordinates), it contains 3D texture coordinates (UVW) - but such representation is not supported by Metashape model importer. 2D UV coordinates are expected.
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 13, 2020, 08:20:04 PM
But I've done this years ago and I never had this problem before. I think it was version 1.1 of Photoscan.
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: Alexey Pasumansky on March 13, 2020, 10:27:07 PM
Hello 3D_Scan_Fan,

PhotoScan never supported 3d texture coordinates, the third column has been omitted as it is in the current Metashape version.

Also you should do something with the wrong UV coordinates which are outside the 0 - 1 interval. I've made a simple script which fixes the outliers for u and v (new OBJ is created):

Code: [Select]
import Metashape

path = Metashape.app.getOpenFileName()
output = open(path + "-2.obj", "wt")
file = open(path, "rt")

eof = False
f = False
while not eof:

line = file.readline()
if line.startswith("vt"):
vt, u, v, w = line.split()
u = float(u)
v = float(v)
w = float(w)
if u < 0:
u = 0
elif u > 1:
u = 1
if v < 0:
v = 0
elif v > 1:
v = 1
line = "vt {:0.6f} {:0.6f} {:0.6f}\n".format(u, v, w)
output.write(line)

else:
output.write(line)

if line.startswith("f"):
f = True

if f:
if line.startswith("#"):
eof = True

output.close()
file.close()

print("done")
Then imported this model and blended the texture. The result of the texture atlas is attached.
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: Alexey Pasumansky on March 13, 2020, 10:27:48 PM
Also I've made a quick test with the spherical parametrization available in Metashape:
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 13, 2020, 10:59:54 PM
That looks good but in older version they won't have that feature hence why we go externally.

How would I be able to do that in 3ds max?
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 14, 2020, 05:15:31 AM
Okay Alexey, I've done a quick test myself.

I went ahead and hunt down the version I used many years ago, that being Photoscan 1.1.4.

I actually rebuilt everything from the source images with the masks. I have noticed that every step was notably faster than any of the new versions.

Created a texture from newly applied UVs done in 3ds max and voila! Exactly how I remembered it!

No stripes or artifacts.

Nothing was done different.
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: Alexey Pasumansky on March 14, 2020, 08:59:07 PM
Hello 3D_Scan_Fan,

So it is a different mesh, which has different UV parametrization?

If you open the old project in Metashape and import the model with UV (that you also have from old version), do you get the same result without stripes?
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 14, 2020, 09:37:19 PM
Hi Alexey,

It is a mesh built from the ground up but within version 1.1.4. (the same for Sparse and Dense cloud).

The same UV parametrization was applied from 3ds max (exact same procedure!).

I have opened the project into Metshape and re-built the texture on a separate chunk, and I do get the same result, no stripes.
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: Alexey Pasumansky on March 15, 2020, 04:43:14 PM
Hello 3D_Scan_Fan,

Negative texture coordinates are still present in the model that you have imported to 1.1 version of PhotoScan. But this time no values above 1. The difference seems to be related to the orientation of the model in the coordinate system space. In one case Y is pointing "up, in another - "down".

And I still see artifacts by the sides of the texture atlas, see below (but now they are not crossing the picture, seems to be related to the orientation of the model):
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: 3D_Scan_Fan on March 17, 2020, 12:43:32 AM
Thanks for your response, all of which has been really helpful!

Before continuing, I've now encountered a new problem. I have been getting this vector<T> too long error when building textures.

I've tried making small changes to the region box but sometimes it still persists! :(
Title: Re: [Help!] Textures coming out really bad! Why? :(
Post by: Alexey Pasumansky on March 19, 2020, 07:42:59 PM
Hello 3D_Scan_Fan,

We were able to reproduce the problem with "vector<T> too long" error, it will be fixed in the next version update.