mwl4 / ConverterPIX

Conversion tool that is able to convert from the game binary formats (.pmx) to the middle formats (.pix) in Euro Truck Simulator 2 & American Truck Simulator.
https://truckersmp.com/
GNU Lesser General Public License v3.0
67 stars 28 forks source link

Stream for Color2 not processed #44

Closed madman271 closed 2 years ago

madman271 commented 2 years ago

Color2 processing code supposed to be there in /src/model/model.cpp:1294 (right after "if (currentPiece->m_color)" block) but missing. This is causing a .pmg file containing Color2 attribute producing the output .pim with missing stream for "_FACTOR" tag. SCS Binary Converter gives error regarding to mismatch "StreamCount" in Piece block due of missing one stream. Hope this is fixed, thank you.

mwl4 commented 2 years ago

Hello,

could you please provide path to PMG that contains that color2 attribute (actually factor).

Thanks in advance

madman271 commented 2 years ago

Thanks, @mwl4 Here the download link, containing 3 models. They are taken from ATS Utah DLC, no file has been modified.

View: [cut]

Direct download: [cut]

These models will trigger "incorrect number of Piece streams" error when converting back the .pim file to the binary form (.pmg) using SCS Converter tool. The "us_cross_left_column_ut.pim" file has missing Color2 stream ("_FACTOR" tag) at Piece index #0. The "us_cross_single_mirror_ut.pim" has similar problem at Piece index #0. The "us_light_single_only_ut.pim" has similar problem at Piece index #1.

mwl4 commented 2 years ago

Thanks. I will remove links, as it is proprietary data.

I will come with fix soon.

mwl4 commented 2 years ago

Issue has been addressed in https://github.com/mwl4/ConverterPIX/commit/baa41477b92045520ff91b47bb98301aae51278c Keep in mind though, that _FACTOR is not imported by SCS Blender Tools, so most likely it will be not re-exported from Blender.

To test changes I did conversion of us_cross_left_column_ut from pim to pmg by new version of ConverterPIX, and back to pmg via pim2pmg from SCS conversion tools. Both pmg files in hex editor had the same factor attributes.

madman271 commented 2 years ago

Thank you for the revised code, @mwl4

About the conversion process, I'll take care of it. This color factor may very important maybe SCS decides to put additional tweak to vertex color. I've been stripped color factor to object in original asset that supposed to have it, the results are disaster with random polygons floating around. So yes, color factor still required regardless it's available in Blender or not. Thanks.