api-issue-tracker icon indicating copy to clipboard operation
api-issue-tracker copied to clipboard

Difference in textures' images after import (SketchUp SDK 23.0.397.0 vs 2024.0.484.0/2024.0.553.0, Windows)

Open bohdansadovenko opened this issue 1 year ago • 3 comments

After updating SketchUp SDK from 23.0.397.0 to 2024.0.484.0 textures were changed (same behavior for 2024.0.553.0).

After import all the data from sketchup file I’m trying to save appropriate textures’ images to files via next code:

SUTextureRef texture = SU_INVALID;
const auto get_texture_result = SUMaterialGetTexture(i_su_material, &texture);
if (get_texture_result != SU_ERROR_NO_DATA) {
  if (get_texture_result != SU_ERROR_NONE)
    throw std::runtime_error("unable to get texture from material");
  MSUString texture_file_name;
  if (SUTextureGetFileName(texture, &texture_file_name.Access()) != SU_ERROR_NONE)
    throw std::runtime_error("unable to get material name");
if (SUTextureWriteToFile(texture, i_file_name) != SU_ERROR_NONE)
  throw std::runtime_error("unable to store");

But results are different between different versions of SDK. Output images are visually similar but if I’m trying to compare them pixel-wise (each channel separately) difference can be more than 10 units from 255 for color channel. Expeccted result (23.0.397.0): expected Actual result (2024.0.484.0): actual

Visually difference looks insignificant, but on the whole model difference is easier to notice.

In latest SketchUp I found a flag that makes behavior exactly as same as in my workflow:

  • if flag is “enabled” (default behavior during opening file) - behavior looks similar to SketchUp API 2023
  • if flag is “disabled” - behavior looks similar to SketchUp API 2024 As you can see “color”/texture is changed: flag

But I didn't find anything similar (I mean any flags, setters, etc.) in C-API. At least for me it looks like a bug cause behavior was changed in new version of the SketchUp SDK.

bohdansadovenko avatar Sep 10 '24 06:09 bohdansadovenko

There was a few noticeable changes between SU23 and SU24. We changed the underlying library that handled images. That caused some very subtle differences. For instance +/-1 in the RGB channels for some pixels etc.

However, that should not cause the visual change in the viewport that you are seeing. That might be related to the new rendering engine. I'm not entirely sure. But if you can provide a sample model/code snippet to reproduce I can forward this internally for investigation.

thomthom avatar Sep 11 '24 12:09 thomthom

Here you can find code which I use to reproduce. Just saves all the textures for input file: CodeToReproduce.txt

Here you can find example of textures that differ: Wood_Board_Cork_new Wood_Board_Cork_old

Can't attach skp file - is there any other way to share it?

bohdansadovenko avatar Sep 23 '24 11:09 bohdansadovenko

Hmm, a bit strange way to share input file - but :) example.txt (replace extension to *.skp and it should be needed one)

bohdansadovenko avatar Sep 23 '24 12:09 bohdansadovenko