• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

free pin uv normalizer - fix SKP export too many texture of the same matirial

Messages
89
Country
israel
A small plugin I made with the CheatGPT to help me saving time on fixing model after I finish modeling and finding out that the export been braking some of the textures into too many of the same texture, usually it happens when you doing advanced texturing and somehow moving free pins or somehow using the yellow pin incorrect so instead of a flat texture you get triangulated texture that the exporter exporting as a new texture

so I ran some tests, on my currently terminal building of a project I'm working on I got 1300 textures but I used only 360 materials with textures.
after running the plugin the export gave me 360 textures instead of 1300
on close look nothing in the model look broken
after that I did another text for a ground poly of the project
60 materials been exported to 80 textures
after running the plugin the number drooped to 60

basically what the plugin doing is removing the yellow pin and force SKP to reconstruct the yellow point correctly
  • It reads the four real texture-tile corners using SketchUp’s uv_tile_at.
  • It keeps Red, Green, and Blue in their existing positions.
  • It removes the Yellow pin from the mapping.
  • SketchUp then reconstructs Yellow
just drop the plugin inside your plugin folder
to use the plugin navigate the the extension bar
don't forget to backup

and right now it's version 2 of the plugin
need to fix the logic of the normalization and also make sure it not skipping groups and components
it should now allow you to work with ThruPaint or other uv tools that you had problem exporting your textures or to save you time after you worked for days, weeks or months and at the end you find out that you got to many broken textures and as you know it gonna take you days to find this textures in the model and fix that instead of going to the next step in your project

also I'm currently working on other plug that should retitel/rename all the texture so they won't be overlapping names at the export time (as you know, if the materials has the same name only one of them will be exported and then you got texture errors in the exported model)
 

Attachments

Hi Felix:

Many thanks for sharing your work in Sketchup 3D modeling- and Ruby plugin script coding- with us.


IIUC, this is able to be used in Sketchup version 21.1 and newer. :pushpin:


Does it also work with the PBR multi-texturing options in Sketchup 2025 and newer ? :scratchch


Are there any plans to offer an equivalent version compatible with Sketchup 2017 ?

Some here at FSDEV still use Sketchup 2017 'Make', as it is free and not restricted from commercial use.

If you did offer a version for use with Sketchup 2017, would it also work with the Samuel Tallet multi-texturing PBR Ruby plugin script ?


FYI: Google AI says this regarding equivalent coding methods in Sketchup 2017:


"Important Compatibility Note

The uv_tile_at method was introduced in SketchUp 2021.1.

Because you referenced SketchUp 2017, this method does not exist in that older version.


To manipulate or read UV coordinates in SketchUp 2017, you must use the Sketchup::UVHelper class instead.

You can retrieve it by calling:

uv_helper = face.get_UVHelper(front_side, back_side)"


Thanks in advance for your further work with this, and a status on any possible Sketchup 2017 and PBR multi-texturing compatibility. :)

GaryGB
 
Last edited:
Hi Felix:

Many thanks for sharing your work in Sketchup 3D modeling- and Ruby plugin script coding- with us.


IIUC, this is able to be used in Sketchup version 21.1 and newer. :pushpin:


Does it also work with the PBR multi-texturing options in Sketchup 2025 and newer ? :scratchch


Are there any plans to offer an equivalent version compatible with Sketchup 2017 ?

Some here at FSDEV still use Sketchup 2017 'Make', as it is free and not restricted from commercial use.

If you did offer a version for use with Sketchup 2017, would it also work with the Samuel Tallet multi-texturing PBR Ruby plugin script ?


FYI: Google AI says this regarding equivalent coding methods in Sketchup 2017:


"Important Compatibility Note

The uv_tile_at method was introduced in SketchUp 2021.1.

Because you referenced SketchUp 2017, this method does not exist in that older version.


To manipulate or read UV coordinates in SketchUp 2017, you must use the Sketchup::UVHelper class instead.

You can retrieve it by calling:

uv_helper = face.get_UVHelper(front_side, back_side)"


Thanks in advance for your further work with this, and a status on any possible Sketchup 2017 and PBR multi-texturing compatibility. :)

GaryGB

Thank you for letting me know, did a quick test on old SKP and noticed that it's doesn't supported, so I asked the cheat to create a version that will do the same thing under SKP 2017
I didn't tested it on 2026/25 with the new PBR, I'm doing PBR outside SKP because I still haven't find a way to export the PBR settings out of the SKP, and also I don't like the stability of SKP 2025/26 so I'm still using the 2022
 

Attachments

Hi again:

Many thanks as well for the latter 2017 version, which I plan to test soon. :)

Regarding the use of PBR in Sketchup versions 2017 through 2024, AFAIK, Samuel Tallet's Ruby plugin script uses Khronos 2.0 glTF file format.

Samuel Tallet (aka "Centaur" in forums) wrote a glTF exporter in consultation with some who develop / maintain glTF format at Khronos.

Samuel Tallet's Ruby plugin script PBR texture Material ORM 'method' is compatible with those used in MSFS SDK.

If you are interested, you can use this query at Google to learn more about Samuel Tallet's Ruby plugin scripts:

Code:
Sketchup PBR plugin Samuel Tallet


Sketchup 2017 et seq now has both glTF importers and exporters that inherently support use of PBR texture Materials.

Sketchup glTF PBR exports (as you may know), can be imported to MCX and/or Blender (or 3DSMAX etc,) to implement MSFS JSON extensions.

GaryGB
 
I tested it on 2020 and right now it didn't work
wonder if it work under 2017, let me know
trying another version of the plugin now
 
Hi Felix:

I just did a quick test in Sketchup 2017 Make on a 3D model, and the 2017 plugin version worked.

I have not "done the math' yet on 3D model statistics, but can say the result appears to show no processing failure overall.

I note the 3D model Z-Y orientation was swapped, but I do not recall if the original import source had that to begin with.

I shall test further to offer more feedback as time permits. :)


BTW: IIUC, you are formatting output of texture Material in "Affine Parallelograms". :scratchch

Some Sketchup users utilize:

* Sketchup default "Make Unique Texture"

...and/or:

* Sketchup Ruby plugin script by Aerilius: "Make Unique Texture++"

...and/or:

* Sketchup Ruby plugin script by Aerilius: "Texture Resizer"

...to 'clip' texture excess at the Sketchup 3D model Face Edges.


IIUC, this ensures UV Coordinates are as precise as can be at 0,0 for glTF UVW maps.

It also reduces the cumulative burden of 'unused' pixels for UVW-mapped source texture file sizes (in bytes / MB; this is now worse with PBR).


I wonder if your plugin's enforced 'quasi-rectangular' texture Material UVW output format is as precise as can be at 0,0 for glTF UVW maps ?

I would like to be certain whether texture Material UVW output format is as precise as can be at 0,0 for glTF UVW maps.


The good thing IIUC, about a 'quasi-rectangular' texture format Material, is ImageMagick can use it to make a grid type Texture Atlas sheet.

IIUC, that grid type method places the texture images adjacent to each other in Columns / Rows as seen in many FS2Kx default textures.


AFAIK, Texture Atlas sheets have the potential to further reduce the number of 'loose' textures (and DrawCalls) in Sketchup 3D models.


Do you plan to code a plugin to process texture Materials output by the script above, to make a Texture Atlas sheet via ImageMagick ?


AFAIK, MCX' DrawCall Optimizer Texture Atlas sheet UVW coordinates are not readable by Sketchup on 3D models exported by MCX.

I hope Arno can modify MCX' 3D model processing output to be more compatible with import by Sketchup in the future.

GaryGB
 
Last edited:
sounds great, will also do the same tomorrow under SKP16
on 2020 it's failed to work, but I understands why 2017 is so impotent because it was the last free sketchup as desktop

no, I'm building all the texture in sketchup and exporting them as they are, after that I'm using blender and MCX to do some PBR
and I'm still using the MCX to create the atlas, that why I generated this plugin is to save time on fixing broken UV maps so if you have 65 materials in the model, you will get the 65 textures in the exported model and not 300 :)
also it can be time consuming searching for this broken parts
 
sounds great, will also do the same tomorrow under SKP16

I just today noticed that Samuel Tallet now supports Sketchup 2016 with his PBR and Materials Browser plugins; IIRC it was 2017+ only.


Although I use Sketchup 2017 most of the time, because Trimble broke "Combine Textures" for vertical Faces, I do that in 2016.

I'll need to test whether broken UV maps result in PBR textures when I use "Combine Textures" for vertical Faces in 2016. :scratchch


I also keep Sketchup 8 installed for use with the occasional legacy plugin that has not yet been updated for 2016 et seq..

Reportedly, Ruby plugins running on SketchUp 8 must manually calculate or parse texture coordinates using older exposed methods or helper classes like Sketchup::UVHelper rather than relying on uv_tile_at.

So I shall test your plugin on my Sketchup 8 install as well.


on 2020 it's failed to work, but I understands why 2017 is so impotent because it was the last free Sketchup as desktop

It is indeed highly capable, and I think of it as "impudent" since it does nearly all things newer versions do ...for free, via plugins.


no, I'm building all the texture in Sketchup and exporting them as they are, after that I'm using blender and MCX to do some PBR
and I'm still using the MCX to create the atlas, that why I generated this plugin is to save time on fixing broken UV maps so if you have 65 materials in the model, you will get the 65 textures in the exported model and not 300 :)
also it can be time consuming searching for this broken parts

Are you able to export a 3D model from MCX after use of DrawCall Minimizer, then import it properly mapped back into Sketchup ?

Thus far, I have not. :banghead:


I shall endeavor to more fully understand the concept of 'broken UV maps' soon. :coffee:

GaryGB
 
Last edited:
I did a test on SKP2016 and look like it's not working for me
at least as I intended for it to work
I using combine textures only for flat surface when I want to project them, let's say roofs, never tried it on a braking surface like walls and floors

about MCX, it's one way ticket the moment the model been exported from sketchup, like I never bringing them back as they are from MCX back to SKP
if I need to make changes to the base model it start over redefining all the settings in the MCX for the exported model, that why I asked once Arno to make an option to replace model in MCX so I don't need to set up all the materials from 0, I see that there will be a problem after minimizing the drawcalls and creating an atlas so at least there can be a mid stage where I can save the model with all the defined materials and if I need to change the model I can replace it without losing the PBR defined materials and after replacing the model to more correct one I can do darawcalls minimization

also what you are telling here about bringing back the model to SKP, you can fix all the meshes at once with remove triangulation that can be applied at once
but if you export it back probably the PBR wont work and you need to set it up once again

just gonna tel you that I mange to reduce the texture count on my EHEH terminal from 1300 to 300 (also the drawcalls has doped down by this amount)
 
I also keep Sketchup 8 installed for use with the occasional legacy plugin that has not yet been updated for 2016 et seq..

Reportedly, Ruby plugins running on SketchUp 8 must manually calculate or parse texture coordinates using older exposed methods or helper classes like Sketchup::UVHelper rather than relying on uv_tile_at.

So I shall test your plugin on my Sketchup 8 install as well.

Hi Felix:

I installed the "free_pin_uv_normalizer_v2_SU2017.rb" into C:\Program Files (x86)\Google\Google SketchUp 8\Plugins, and restarted Sketchup 8.

I made a 10x10x10 cube and textured it self-tiling with the Sketchup 8 default Blinds Material (which IIUC, is a texture image rather than a 'color' graphic pattern)

I then selected one Face, with intent to run "free_pin_uv_normalizer_v2_SU2017.rb"


In Sketchup 8, I was not able to see "free_pin_uv_normalizer_v2_SU2017.rb" listed in:

Sketchup Menu >:

* Plugins (aka 'Extensions')

* Window > Preferences > Extensions

* View > Toolbars


I tested a direct Ruby plugin script execution via:

Sketchup Menu > Ruby Console > [enter this string:]

load "free_pin_uv_normalizer_v2_SU2017.rb"


The Ruby console log showed this after pressing <Enter> key:

Code:
load "free_pin_uv_normalizer_v2_SU2017.rb"

Error: #<SyntaxError: (eval):144:in `load': C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/free_pin_uv_normalizer_v2_SU2017.rb:62: odd number list for Hash

        faces_found: faces.length,

                    ^

C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/free_pin_uv_normalizer_v2_SU2017.rb:62: syntax error, unexpected ':', expecting '}'

        faces_found: faces.length,

                    ^

C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/free_pin_uv_normalizer_v2_SU2017.rb:63: syntax error, unexpected ':', expecting '='

        normalized: 0,

                   ^>

(eval):144

(eval):144

I am not certain if the above procedure tested the 3D model configuration that the script is intended to process.

If you are inclined to edit the above Ruby plugin script for full Sketchup 8 (32-bit) compatibility, here is a link to the "official" last Google-coded installer:

https://www.oldversion.com/windows/google-sketchup/google-sketchup-8-0-4811/


A small plugin I made with the CheatGPT to help me saving time on fixing model after I finish modeling and finding out that the export been braking some of the textures into too many of the same texture, usually it happens when you doing advanced texturing and somehow moving free pins or somehow using the yellow pin incorrect so instead of a flat texture you get triangulated texture that the exporter exporting as a new texture

I just today noticed that Samuel Tallet now supports Sketchup 2016 with his PBR and Materials Browser plugins; IIRC it was 2017+ only.


Although I use Sketchup 2017 most of the time, because Trimble broke "Combine Textures" for vertical Faces, I do that in 2016.

I'll need to test whether broken UV maps result in PBR textures when I use "Combine Textures" for vertical Faces in 2016. :scratchch

I shall endeavor to more fully understand the concept of 'broken UV maps' soon. :coffee:

Can you please attach / link an example Sketchup 3D model and screenshots showing the "triangulated" anomaly and Yellow Pin offset as described in the OP above ?

Thanks again. :)

GaryGB
 
Last edited:
Are you able to export a 3D model from MCX after use of DrawCall Minimizer, then import it properly mapped back into Sketchup ?

Thus far, I have not. :banghead:

About MCX, it's one way ticket the moment the model been exported from sketchup, like I never bringing them back as they are from MCX back to SKP.

If I need to make changes to the base model it start over redefining all the settings in the MCX for the exported model, that why I asked once Arno to make an option to replace model in MCX so I don't need to set up all the materials from 0.

I see that there will be a problem after minimizing the drawcalls and creating an atlas, so at least there can be a mid stage where I can save the model with all the defined materials and if I need to change the model I can replace it without losing the PBR defined materials and after replacing the model to more correct one I can do drawcalls minimization.


Also what you are telling here about bringing back the model to SKP, you can fix all the meshes at once with remove triangulation that can be applied at once
but if you export it back probably the PBR wont work and you need to set it up once again

IIUC, this may be addressed by use of MCX' ability to 'save out' a custom template unique to each 3D model's current Material mapping and properties.

AFAIK, you may be able achieve an option to save the state of workflow in MCX prior to export in a 3D exchange format that Blender or Sketchup can import.

You might wish to do a Google search using this query string:

Code:
site: www.fsdeveloper.com arno ModelConverterX MCX save MMT file video

You may wish to create a custom Material Template in MCX Template Editor immediately upon import of glTF PBR mapped 3D models to re-apply Material Properties.

IIUC, that may allow retention of all mapped Material Properties in an MCX imported 3D model, at the current state of that objects 'build'.

That also may allow restoring Material Properties for a 3D model upon re-import, after already exported for editing in another 3D modeling application etc.

Thus, one may create a "Before"- and "After"- DrawCall Minimizer MCX object backup set of MCX Material Template *.MMT files. :wizard:


A YouTube video "ModelConverterX | Material Editor" by Arno may prove rather interesting to you if you navigate to this URL: :idea:

Code:
https://www.youtube.com/watch?v=Vv6oxAFVe6o

(see 1:40 elapsed time)


BTW: MCX Material Editor Properties dialog can add MSFS proprietary JSON extensions for Material Types otherwise applied via Blender or 3DSMAX. :pushpin:

https://docs.flightsimulator.com/msfs2024/html/3_Models_And_Textures/Textures/Materials/FlightSim_Materials.htm?rhhlterm=materials material&rhsearch=Materials


For an example of adding a MSFS proprietary Material attribute to a glTF 3D model via Material Editor > Material Properties pane, use this Google query string:

Code:
site: www.fsdeveloper.com ModelConverterX MCX ClearCoat



You may also use a (per-MCX-numeric-version) option to save 3D model 'builds' with both geometry and mapped texture Materials via MCX Object *.MOB files:

https://www.scenerydesign.org/2026/02/modelconverterx-object-format/


Just gonna' tell you that I managed to reduce the texture count on my EHEH terminal from 1300 to 300 (also the drawcalls has dropped down by this amount)

That is quite a substantial improvement ! :)

GaryGB
 
Last edited:
Back
Top