Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / Colourize Kay - Colourize models published by Kay Lousberg

Author
Message
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 8th Oct 2022 06:32 Edited at: 5th Nov 2022 23:18
Colourize models created by Kay Lousberg

This utility will colourize models from Kay Lousberg who worked for Kenny for a bit i think.

In general it will colour any .obj model that has a .mtl file.

It will adjust the UVs and product a "texture" file which is the name of the output folder.png

IMPORTANT NOTE: IF THE MODELS HAVE MORE THAN 16 COLOURS IN TOTAL IT WON'T WORK. I will see if i can fix this

Requires MadBit File explore plugin

Attachments

Login to view attachments
James H
15
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 8th Oct 2022 15:59 Edited at: 8th Oct 2022 17:19
I wanted to take a peek at this but that plugin I cannot get to work...there are some pretty exact instructions in a read me text file which when followed only throws errors, the errors received are ones mentioned on page one of the thread yet mine is dead in the water, both classic and studio. Classic copies the dll's over on compilation but then throws an error telling me it can't open the file dialogue listing one of those strange strings needed in the commands text file. Studio copies nothing, just throws the errors mentioned on page one of the thread.

Studio compile errors:
Error: Failed to open file "/Plugins/FileExplore/Commands.txt" for reading, write path: "C:\Users\user\Desktop\ColourizeKay/", read path: "C:\Program Files (x86)\Steam\steamapps\common\AppGameKit Studio\"
main.agc:1:Error: Failed to load plugin command list from /Plugins/FileExplore/Commands.txt for plugin FileExplore
dialog.agc:162:Error: "value" is not a valid field for type "control"
this is followed by 7 errors that are variations of:
main.agc:472:Error: "f" is not a valid field for type "face"

Classic runtime eror:
Failed to load "?ChoseFileDialog@@YAPADPBD0H@Z" function from plugin "File Explore"

Is there something I am missing that is obvious outside of making a post on the plugin thread? I have not run anything else - the plugin did not come with examples. I also have zero interest in rummaging through pages of the thread for something that should be detailed in the first post, speaking for myself of course i simply don't have the time as a hobbyist to keep jumping through hoops each time I pick something up that should be straight forward!

It's ok if this is going to prove a headache, its no biggie to miss out, quick question though - I am more curious than anything - don't suppose you have an AppGameKit screen shot?

Edit: I have it working now - there are 2 versions of the plugin...initially I thought it was all one line! The first version I have working not the later one

Edit2: Having downloaded a pack I have converted and reloaded - the normals are no longer present in the output file, I have compared files and vn is missing altogether so the models although textured correctly have no real lighting, must be default to apply white ambience/emmisive or something if normals not present in agk? I have checked with kenney's own models and same situation. Copying them over directly messes things up - I suspect you are maybe changing the format in the conversion?
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 8th Oct 2022 22:52 Edited at: 15th Oct 2022 08:51
Quote: "Having downloaded a pack I have converted and reloaded - the normals are no longer present in the output file, I have compared files and vn is missing altogether so the models although textured correctly have no real lighting, must be default to apply white ambience/emmisive or something if normals not present in agk? I have checked with kenney's own models and same situation. Copying them over directly messes things up - I suspect you are maybe changing the format in the conversion?"


Thanks for taking a look at it

blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Oct 2022 08:51
Apparently you can have as many verts in a poly as you want. I learn something new every day.

1. Normals added
2. Always produces a combined palette

First post updated
James H
15
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 16th Oct 2022 00:14 Edited at: 16th Oct 2022 00:16
I couldn't get objects to load successfully from this version, converting to memblock results in a memblock size of zero, also reports zero meshes for the object and zero polycount drawn to scene...yet the data is there, it loads successfully into blender!

I did manage to catch the other version you uploaded with the "normals added" fix...that turned out to work the same as the original "no normals" version, but the normals came out bad - kind of looked like every other triangle was zeroed out.

Oddly enough, of the 3 versions the first works best for me. Simply importing and exporting each model in blender was enough to generate new face normals(important to ensure double sided option is off - back face cull option also off). I did find some UV issues but they where modeller based, not your code - some originally exceeded float range 0 -1 and that obviously gets carried through. Should be possible to put a check in for when values exceed range and then simply remove the integer part prior to calculating which colour tile to reposition at? In any case your first version cuts a bunch of work out, I am not sure what is going on with the normals in version 2 and as I say version 3 fails for me altogether.

In both version 1 and 2 I noticed that you increased the number of indices data by twice as much. Importing/exporting in blender fixes that back to original values(although blender imports the bad normals from version 2 .obj's and fixing them is a nightmare for some objects in blender - better to go with version 1 which generates nice new ones when imported).

Also notable is that, with for example kenney's pirate ship, there are a bunch of duplicate triangles as well as extra vertices. Importing using blender but ONLY AFTER using your apps 1st version allowed me to quickly remove doubles without issues, readjust uv's so they where all in same tile of atlas(due to model having out of range uv values), then export. Looked exactly in agk as the screen shot from kenney's site and the mesh data showed the indices as minimal and a smaller size of memblock than that of one generated by the original model.

There was mention on previous versions of anything greater than 16 colours would be an issue. I actually tested the first version for 25 colours on an icosphere which came out fine - I did however only test using your app with the .obj/.mtl in a folder on their own but with shared atlas option checked.

I did find issues with not creating enough materials in the icosphere to satisfy a fully filled square atlas. From a creation point of view we can simply create enough materials to satisfy that rule, put them on an object in the same scene as the object we want to work on and that first "pallette" object can later get removed in agk, am thinking 2 meshes as root and child then split it up in agk deleting the object produced from the child "limb"
.
I suppose overall it might be best to make your first version available once more?
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 16th Oct 2022 23:05
Can you post a model please?
James H
15
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 17th Oct 2022 16:40
Here you go
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E

Attachments

Login to view attachments
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 18th Oct 2022 22:47 Edited at: 18th Oct 2022 22:50
That looks like the output from the utility. Can i get the input model amd th material file a well please?
James H
15
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Oct 2022 01:27
Ah yes it is, here's the source
Win 10 Home 64, Intel(R) Core(TM) i5-10300H, 8GB DDR4, NVidia GeForce GTX 1650 4GB GDDR6

Attachments

Login to view attachments
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Oct 2022 06:28 Edited at: 19th Oct 2022 08:17
I ran your last model through the converter and the normals for the new object are the same as the input object.

I did find one issue though. If the model does not have normals then it was setting all the normal pointers to zero and causing AppGameKit to crash

I updated the first post

I will also implement removing duplicate faces, scale and centering in this product over the next week

Attachments

Login to view attachments
James H
15
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Oct 2022 08:16
Okay so yes there was something wrong my end...it would appear I had been loading in .x not .obj! Here is the mad thing, no .x existed yet the failure was silent - so agk still reports object ID as being used.

Basically in the load back project I usually just change the file name by double clicking name in editor, recompile and just reuse the exe over and over and just keeping the same name for file export in blender until it is time to change again... but I had previously been testing a 25 material icosphere .x export and forgot I needed to change the extension back to .obj, and yes it is terrible that I didn't even read it, silent fails on agk's part don't help. So I am really sorry about that. Hope I haven't caused you a lot of trouble and time

Win 10 Home 64, Intel(R) Core(TM) i5-10300H, 8GB DDR4, NVidia GeForce GTX 1650 4GB GDDR6
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 24th Oct 2022 22:23 Edited at: 24th Oct 2022 22:24
Not a problem at all.
I have uploaded a new version with scale, centering and duplicate face culling.
New version in in the first post.
James H
15
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 30th Nov 2022 00:48
Well you're going to learn to hate me lol - I don't seem to be able to get the scale to work...I have tried it with kenney's pirate models with the duplicate vertices and center option set to as on and off, all the vertices are output at zero's. When I went back to repeat and change the scale I could not change it. I assume I was supposed to click and type? Or am I assuming too much and Kay's models are the only ones for support?
Win 10 Home 64, Intel(R) Core(TM) i5-10300H, 8GB DDR4, NVidia GeForce GTX 1650 4GB GDDR6
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 30th Nov 2022 11:05
I will investigate. Thanks for the feedback. If you could post the models or a link to the models that would help
James H
15
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 30th Nov 2022 15:01 Edited at: 30th Nov 2022 15:01
https://www.kenney.nl/assets/pirate-kit
I have uploaded both input and output rar files as well just in case.

Also I don't believe I ever took to the time to say thanks, so a big thank you from me
Win 10 Home 64, Intel(R) Core(TM) i5-10300H, 8GB DDR4, NVidia GeForce GTX 1650 4GB GDDR6

Attachments

Login to view attachments
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 30th Nov 2022 23:08
The .obj files in "kenneys pirate" folder appear to be already processed by the converter
James H
15
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 2nd Dec 2022 23:59 Edited at: 3rd Dec 2022 00:17
While changing setting and trying again because I couldn't figure out how to change the scale option(still haven't), I must have re-selected the same path or something for the output. Sorry about that.

I have deleted that from my system, restarted process after double checking source is original, same issue for output of zero's for vertices.

Correct files attached.

Edit:
Okay it works now - I removed a json file from AGKApps folder in user/AppData/Local folder that was in the media folder - had not realized just how important these folders are, really annoying!
So basically I was not seeing a value of 1 in the scale option prior to removing that file. The wording within the path options(the white section) also changed - previously the instruction read the same in each option, now they read differently(I don't recall what they read previously but I assume matched that of the previous version).

Sorry once more to have wasted your time, its working spot on now, thanks again
Win 10 Home 64, Intel(R) Core(TM) i5-10300H, 8GB DDR4, NVidia GeForce GTX 1650 4GB GDDR6

Attachments

Login to view attachments
blink0k
Moderator
9
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Dec 2022 00:38
Awesome. Glad to see you sortd it. Thanks for using the proggy
fubarpk
Retired Moderator
18
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Dec 2022 11:09
Great stuff blink, a very hand utility great to see it so well polished
and very hand for me as I have purchased most of Kenney's library
of models and software
PK

Login to post a reply

Server time is: 2023-02-06 20:43:32
Your offset time is: 2023-02-06 20:43:32