Sketchup generates too many textures

Hello,

I am digging the way Sketchup is handling textures and I feel that there is some case were it generates too many textures.

The current test has been made under Sketchup 2017 but it also fails on Sketchup 2019.

Ancre1_2017.skp (474.2 KB)

  • Open Ancre1_2017.skp
  • Export the mesh to a third party format.

The exported texture folder contains 11 elements.

  • Now change the material to one face of the mesh as shown in the capture.
    (I use the a brick texture and fill one face with it).

  • Export again the mesh to collada.

The texture folders now contains 285 textures : one per faces!

Sketchup internally loses the texture reference and generate under some circumstances too many textures. The problem is shown through the collada export, but I suspect this is a deeper problem as I suspect Sketchup to really have in memory 285 textures images.

Am I right?

Thanks,
Manuel

I recommend working on the model further first.

Make it the minimum number of components and use solid inspector to make sure they are all solid.

Also Window>model info>statistics>purge unused.

I too have incurred this problem. Exporting to .fbx

NOTE that the OP has filed an issue in the official tracker …

No, SketchUp does support perspectivic texture transformation (4 texture pins freely placed) and internally keeps a single texture. But under some circumstances, namely export, it assumes the export format supports only affine texture transformation (3 texture pins freely placed, 4 texture pins always form a diamond). Then SketchUp makes textures on faces with perspectivic transformation unique.

  • You could keep discipline and avoid perspectivic transformation altogether (use only red, green, blue texture pins, never touch the yellow one).
  • The Collada exporter also does not support arbitrary texture transformation unless for “projected textures” (projected from another face). If you at most use texture projected from another face and export to Collada instead of fbx, you could also avoid the problem.
  • You could use this conversion script that tweaks perspective distortion to become affine (depending on the mesh it has a more or less visible effect).
  • You could also search for another exporter (extension, commercial extension, e.g. maybe the Simlab ones) that properly exports perspectivic texture transformation.

Maybe SketchUp 2020 should feature updated exporters that export perspectivic texture transformation without texture writer whereever the fileformat supports it (this can be a checkbox in export options).
In case of using texture writer, SketchUp 2020 could have the option (also in the API) to bake the texture shards all into a single texture atlas.

3 Likes

Thanks for the details.

No, SketchUp does support texture transformation (4 texture pins freely placed) and internally keeps a single texture

That’s a good point that only one internal texture is used.
I also understand that the model could be better and is worst quality.
Another exporter or tweaking on the model could also help.
Good news that Sketchup 2020 will improve all this!

But the goal of my post is to understand why there is 200 more textures between the first and the second export.
Between the two export, the only operation is to fill one face with another material.
I can’t figure it out. It seems that filling one face has an impact on the whole face set.

Note: I use Sketchup API and my goal is to minimize the generated texture using SUTextureWriter.
This is why I also write another post in the SDK section.

Thanks for your help!
Thanks for the script!

I wish you knew whether this will be true, because I don’t know of anything. We users don’t even know whether there will ever be a SketchUp 2020. But it “could” happen.

Most formats store UV on vertices. I’m actually not aware of what formats might support UVQ or UV-matrices per face. If you know if any I’d love to hear. I can then forward to the team.

When you use the texture writer to export texture it will generate a new affine texture for any non-affine-mapped faces. This preserve visual appearance for formats/systems that only support affine UV data.

If the target format support non-affine UV mapping, are able to handle UVQ mapping, then you don’t need to use the texture writer and you only get as many textures as is stored in the SketchUp model.

Some will opt to “normalize” UVQ to UV and live with the possible texture distortion that might appear. The visual artifact will depend on the UV mapping and shape of the polygon. In many cases the visual discrepancy will be negligible.

3ds Max stores UVW for example, but there is only one transformation material matrix per object whereas Sketchup is able to store a different matrix transformation for each face. Having UVQ is one thing, but if I am right, the problem is that without the material matrix transformation for the face, you cannot convert correctly UVQ to UV.
From my knowledge, I don’t know any format that stores such information in per-face way.

I already try UVW normalization, but depending on the model, this can be awful.

Anyway, at least if the texture writer can limit the exported texture, when this is not needed, as originally explained in the post, that would be great !

1 Like

So it would be useful for you to have access to the UV matrix? Would it make things easier for you when parsing the SketchUp models?

That could be useful to get this information, even if I don’t know any format that use it.
Most of format are able to attach a transformation matrix to a material, but not to a single face.
Guess this is a Sketchup specificity!

Anyway, there is something strange to provide UVQ but not the matrix. UV would be enough if no matrix is provided. Am I wrong?

I don’t know why the matrix was never exposed, the current Texture/UV API was done long before me. But there are gaps, with for instance projected textures etc. So that I think it would be good to look into the whole topic of Texture/UV in SU. Exposing the matrix sound sensible to me.