:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::
Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Mon Apr 23, 2018 7:29 am
All times are UTC + 0
 Forum index » Featured Tools » CnC Editing Tools
Image Shaper
Moderators: CnC Editing Tools Developpers
Post new topic   Reply to topic Page 2 of 2 [78 Posts] View previous topic :: View next topic
Goto page: Previous 1, 2
Author Message
tomsons26lv
Tiberian Fiend


Joined: 30 Dec 2009
Location: Latvia

PostPosted: Fri Dec 15, 2017 1:29 am    Post subject: Reply with quote

If you can find a file that has the first byte of the header not 0 then i will try to look into it.
My theory is it might have been a type specification could also had been global shape flags, as these are things Westwood did previously.

That said i don't have any files to show this or found the code that reads this byte at all, it's also worth noting it might not be a byte but a word.

As for the forth byte in AverageColor, its probably padding.

Oh yea also note on AverageColor generation, it's essentially just what you get when you do Average in any image editor, but there is one difference, you need to discard the 0x0 index pixels, it averages the nontransparent pixels only, while in image editors even if you make the background transparent internally it will still fill it with white or black and then average it.
Don't quote me on this that it should be like this but as far as code goes on a quick google after a few pages i found https://www.compuphase.com/graphic/scale3.htm which seems to be a sane way to go about it. Ill have to look into it tomorrow myself see if i can find anything like that in shapeset.
_________________
Tiberian Dawn, Red Alert, Tiberian Sun ,Red Alert 2,Renegade, Command & Conquer 3,Tiberium and Tiberium Wars and Westwood related image & video archive
https://picasaweb.google.com/113361105083292812413?noredirect=1

Skype live:tomsons26
Don't forget to state who are you otherwise i'll ignore the invite

Back to top
View user's profile Send private message Visit poster's website
E1 Elite
Cyborg Commando


Joined: 28 May 2013

PostPosted: Sat Dec 16, 2017 5:15 am    Post subject: Reply with quote

Is the image processing (worker threads) necessary before making SHP
if there are images in only one column? Are these processing only for
combining images or these do something before making SHP?

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Sat Dec 16, 2017 12:08 pm    Post subject: Reply with quote

they are necessary for the time consuming color conversion.
The Euclidean calculation may be fast for one color, but it still needs to find for every single pixel in the image the corresponding palette color.
And for this there is the slow
for x=0 to bitmap.width
for y=0 to bitmap.height
{
getPalettePixelColor(x,y)
}
function necessary.

Each row is an image conversion (and combining) job, and the number row-jobs are equally split among the threads.
You can see the result of the row-jobs if you enable the temp image output, as then the threads save the converted image in the palette indexed file.


The converted (and combined) images are collected (thus the big memory usage after conversion) and then saved as SHP in the main thread, which is the only time the interface freezes, as i didn't want to put this in separate thread as well.
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
E1 Elite
Cyborg Commando


Joined: 28 May 2013

PostPosted: Sat Dec 16, 2017 12:35 pm    Post subject: Reply with quote

OK fine.

Back to top
View user's profile Send private message
deathreaperz
Commander


Joined: 20 May 2013
Location: Creativity Corp, ID Division

PostPosted: Sun Dec 17, 2017 3:14 am    Post subject: Reply with quote

Index was outside the bounds of the array.

I got this while combining Images. Any clues on how to fix this?
_________________
Quote:
Humans were born for two things,
to pray and be productive.


Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Sun Dec 17, 2017 9:54 am    Post subject: Reply with quote

i need more infos than that.
-program version
-which images do you used? (size, color format etc) Best upload them so i can recreate the issue
-how many images
-at which point do you got the message (during image processing? while shp saving?)
...
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Fri Dec 22, 2017 1:23 pm    Post subject: Reply with quote

new version uploaded

Version 01.01.00.07
-(bugfix) loading palette indexed images was not supported. Now loaded directly without any color conversion.
-(bugfix) SHP frames loaded in the 2nd or 3rd imagelist caused an exception
-(update) images with 32bpp ARGB, 24bpp RGB and 8bpp palette indexed color formats are directly supported. All other image color formats are converted to 32bpp ARGB before processing image in color conversion.
-(update) added options to optimize canvas size
-(update) BitFlags added
-(update) option to calculate average radar color added (ignoring all transparent background pixel)
-(update) Routine to identify SHPs changed to be less strict. Previously anything with a BitFlag value of >3 was discarded as invalid SHP.

@deathreaperz
No clue if your problem is fixed with this update. I didn't had my crystal ball at hand to see what went wrong in your case.
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
E1 Elite
Cyborg Commando


Joined: 28 May 2013

PostPosted: Fri Dec 22, 2017 4:21 pm    Post subject: Reply with quote

The average color should be checked on by default, as we don't know
what else it is used for apart from radar color. Also its last used status is
not saved.

The optimize canvas checkbox should be unchecked by default and when
making it checked, by default the keep center should be checked. Let the
user uncheck the keep center checkbox manually.

Have you checked if the resultant SHP is not affecting position in game
relative to its selection box? It should be safe in all conditions like a
structure would be having more than a single shp like buildup, animations
to accompany the main structure, this option shouldn't result in having
SHPs rendering at different alignment.

Back to top
View user's profile Send private message
ApolloTD
Commander


Joined: 19 Nov 2003

PostPosted: Sat Dec 23, 2017 12:22 pm    Post subject: Reply with quote

E1 Elite wrote:

Have you checked if the resultant SHP is not affecting position in game
relative to its selection box? It should be safe in all conditions like a
structure would be having more than a single shp like buildup, animations
to accompany the main structure, this option shouldn't result in having
SHPs rendering at different alignment.


I think you realise the app merely adjusts according to provided art and force its dimension to smallest possible will not work with separate same building shps despite keeping center at the moment when processing singular shps. As is, canvas optimization is more for the pros at this point than average joe that may not realise the potential inconsistencies.

Buildings wise this would need possibility of inserting all building shps in and then use them together for the measurement but still split like originals were, else you'd be forced to split them yourself afterwards. Adding all in single list now seems not to apply the canvas optimization in my test when giving multiple shps despite makes common shp.

Also some minor bug, i tried dragging shps into the image lists and 3rd image list would not put at the first frame (put a lot of blank frames instead first) when dragging shp in unless you  use the load function(?)

Back to top
View user's profile Send private message
E1 Elite
Cyborg Commando


Joined: 28 May 2013

PostPosted: Sat Dec 23, 2017 1:43 pm    Post subject: Reply with quote

The canvas crop feature could be dropped altogether as it won't make
much difference when using compression in SHP. Or it could be made
available in some expert mode. For now it could be kept unchecked
by default.

Drag and drop on the first empty row of the column that you desire.
It works for first row of 3rd column as well.

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Sat Dec 23, 2017 4:23 pm    Post subject: Reply with quote

D&D always checks where exactly you drop. Only if there are no rows present, it starts inserting the images from top.

This is because the tool can combine images, where you might want to combine images 64-96 with something, so you would drop your additional 32 images on the 64th cell, not the first cell.
Same is true with load images, which also checks the cell location where you right clicked and inserts the images in the that column starting from that row.


It could be that "opt. canvas" alone (keep centered unchecked) is not keeping the image at the correct place ingame.
I have to do some more tests with optimize canvas and check how ShapeSet optimized the canvas.

However, with "keep centered" checked, it works as it should and optimizes the canvas fine.


\Edit
opt. canvas with "keep centered" off works the same as ShapeSet.
however if the colored pixel where off center yet correct positioned ingame, they get misaligned due to the canvas optimization.

In ShapeSet, WW used a simple rectangle drawn on the first frame to set the canvas. The same could be done in Image Shaper if you have "keep centered" off.

Attached is a sketch showing the canvas optimization methods.
In the 3rd case the image gets misaligned, since it lost its relative position to the center as offset is set to 0,0.

Note: when the SHP is saved, each frame has it's own minimal sized canvas set. In the example the SHP would store only data for the 18x24 big image.


SHPcanvas_optimization.png
 Description:
 Filesize:  3.2 KB
 Viewed:  1273 Time(s)

SHPcanvas_optimization.png



_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
E1 Elite
Cyborg Commando


Joined: 28 May 2013

PostPosted: Sat Dec 23, 2017 5:51 pm    Post subject: Reply with quote

If you did test with a single SHP case like infantry, then could try like
a turreted building where the base, buildup, turret and its anim have
different non transparent dimensions.

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Sat Dec 23, 2017 6:59 pm    Post subject: Reply with quote

should work fine if you select opt. canvas and keep centered
-you should only make sure buildup and base have same dimensions
-turret and anims can have different dimensions
as long as they all are kept centered, there isn't a problem in minimizing the canvas
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon Dec 25, 2017 10:49 pm    Post subject: Reply with quote

new version uploaded
next to some new functions, this one has a few optimizations in the interface to speed up the work with the tool. Mainly you don't have to right click selected files anymore to set the frame specific settings like radar color.

Version 01.01.00.08
-(bugfix) optimize canvas failed when empty frames were included
-(bugfix) when using "RLE_Zero" compression, the bitflag wasn't set in the SHP
-(update) last used average color checkbox value stored in ini
-(update) when enabling "optimize canvas", "keep centered" is enabled by default as well
-(update) option added to use a custom color as transparent background color during color conversion
-(update) option added to copy only the transparent pixel when combining this image with a base image
-(update) changes in the "Image/Frame Settings" are instantly applied to the selected images/frames


"combine transparent pixel"
this option is for those who use different render passes, where one is some kind of mask, with the mask defining the area that should be kept and all other pixel set transparent.
e.g.
you have 2 render passes, one with heavy blur anti-aliasing into the background, one without anti-aliasing and sharp borders.
-load in ImageList 1 the anti-aliased blurred images which alone would give a dark outline during conversion
-load in ImageList 2 the sharp aliased images and set on these "combine transparent pixel"

Now the transparent pixel of the mask are copied onto the blurred image.
This way you can remove the dark outline, while keeping the blurred or anti-aliased inner part.
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
pchote
Cyborg Soldier


Joined: 06 Feb 2015

PostPosted: Fri Dec 29, 2017 3:18 pm    Post subject: Reply with quote

Blade wrote:
I wasn't trying to force your hand or anything, most people won't even be interested in the code in this community and its not like the OpenRA team or even Olaf are really likely to pursue the matter and they are the only ones who would have standing to do anything about enforcing the GPL on you. As it is, if I can't rebuild the entire tool, a bit of the source isn't exactly useful.

You should be careful about incorporating open source code in your tools if you don't intend to play by the open source rules though, the GPL requires you make the entire source available for a binary you distribute that contains some GPL code, not just the bit of GPL code you happen to use.

I personally think its just the right thing to do to open source tools for modding. I am aware that I have released tools myself without source because they were based on code I couldn't just okay the release of on my own, but if I could have I would.
I'd like to second this.  It's awesome that people want to build stuff based on OpenRA, but it is only fair and is a condition of the license that you don't restrict that same right from others.
The GPL doesn't force you to post the code publically, but it does require you to give all the code that makes up the binary to anyone who asks for it.

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Thu Jan 11, 2018 8:44 pm    Post subject: Reply with quote

new version uploaded
Version 01.01.00.09
-(update) create images expanded with SHP(TS) file format, allowing each frame to be saved as SHP
-(update) create images filename can now use an asterisk *, to keep the original filename for the single frame

This basically allows to convert single images into single frame SHPs, like a batch process.


@pchote:
The source for the SHP creating routine is uploaded on the previous page.
If someone wants the complete program source code, he can write me a PM and i'll send it.
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Graion Dilach
Defense Minister


Joined: 22 Nov 2010
Location: Iszkaszentgyörgy, Hungary

PostPosted: Fri Jan 12, 2018 8:43 pm    Post subject: Reply with quote

Haven't tried the new release yet, but the source-request-by-PM sounds fair to me already. GJ LKO regardless, tool's useful.
_________________



AS Discord server: https://discord.gg/7aM7Hm2

Back to top
View user's profile Send private message Visit poster's website
Nolt
Cyborg Firebomber


Joined: 25 Apr 2012
Location: Chile

PostPosted: Fri Jan 19, 2018 2:59 am    Post subject: Reply with quote

Hm, I ran into a big issue when trying to import a construction yard I am doing into the shp builder, assume 700 frames, 320x240 each, the SHP builder was simply incapable of importing such amount of files, freezing it for more than 20 minutes, by then I just had to kill the process, on the other hand, your program takes little to no time. Thanks man, at a first glance, it seems to work great.
_________________

Creator of Shattered Paradise and Nomad Galaxy. WARNING, there are tons of gifs on both pages.
ORA Discord invite link https://discordapp.com/invite/tuhp9m6

Back to top
View user's profile Send private message Send e-mail Skype Account
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Fri Jan 19, 2018 12:58 pm    Post subject: Reply with quote

glad to hear it works as it should Smile

Though 20 min for SHP Builder isn't unusual. After an hour i would have said it stopped working, but the import in SHP Builder can really take that long. It's also normal for SHP Builder that the interface freezes, but it still works in the background.
When it crashes due to too many frames/memory usage it'll usually throw an exception.
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Nolt
Cyborg Firebomber


Joined: 25 Apr 2012
Location: Chile

PostPosted: Fri Jan 19, 2018 3:01 pm    Post subject: Reply with quote

I noticed something, when loading images, the program takes more time to display the image list on the main window than loading the rest of the images. (Think, the frame had 29 frames while the the whole list was had 682 files)

Another thing, a request, did you ever thought of adding an option to process all the frames after an x number as shadow frames (All pixels asigned to a single color)?

The most logical option would be to render the second half of the frame list, but please dont do that, ORA allows more flexibility on where you can put the shadows.
_________________

Creator of Shattered Paradise and Nomad Galaxy. WARNING, there are tons of gifs on both pages.
ORA Discord invite link https://discordapp.com/invite/tuhp9m6

Back to top
View user's profile Send private message Send e-mail Skype Account
E1 Elite
Cyborg Commando


Joined: 28 May 2013

PostPosted: Fri Jan 19, 2018 3:23 pm    Post subject: Reply with quote

Nolt wrote:
I noticed something, when loading images, the program takes more time to display the image list on the main window than loading the rest of the images.

I noticed that too, that when populating the onscreen list, it seems to take
a little longer as if it is refreshing the viewable list on adding every list item.
When it starts loading the offscreen list it goes fast. It started happening
only with v01.01.00.06 onwards. But the delay is negligible.

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Fri Jan 19, 2018 3:59 pm    Post subject: Reply with quote

Nolt wrote:
Another thing, a request, did you ever thought of adding an option to process all the frames after an x number as shadow frames (All pixels asigned to a single color)?

The most logical option would be to render the second half of the frame list, but please dont do that, ORA allows more flexibility on where you can put the shadows.

a) yes, but deliberately not implemented any automatism, because it's just a few clicks to assign the shadow frames their own customized palette
and an automatism could work wrong in several cases (e.g. explosion anims without shadows).

I might add a way to apply the custom shadow palette a bit faster, removing some repetitive steps.

b) nah, wouldn't have done this in such a imprecise way anyway, due to issues mentioned in a)


c) i'll see what i can do about the image loading performance issue
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
cxtian39
Tiberian Fiend


Joined: 11 Feb 2016
Location: The United States of China

PostPosted: Thu Jan 25, 2018 9:16 am    Post subject: Reply with quote

It saves time!
_________________
+1s +1s +1s

Back to top
View user's profile Send private message
cxtian39
Tiberian Fiend


Joined: 11 Feb 2016
Location: The United States of China

PostPosted: Tue Feb 06, 2018 12:19 am    Post subject: Reply with quote

Fail to convert


unittem_greenremap.pal
 Description:

Download
 Filename:  unittem_greenremap.pal
 Filesize:  768 Bytes
 Downloaded:  0 Time(s)


mk.zip
 Description:

Download
 Filename:  mk.zip
 Filesize:  111.14 KB
 Downloaded:  3 Time(s)


_________________
+1s +1s +1s

Back to top
View user's profile Send private message
E1 Elite
Cyborg Commando


Joined: 28 May 2013

PostPosted: Tue Feb 06, 2018 1:39 pm    Post subject: Reply with quote

A single pixel on any row in the last frame (c 0039.png) is causing problem
with the RLE_0 implementation in this tool. Uncompressed works fine. Also
SHP Builder works fine.

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Tue Feb 06, 2018 10:38 pm    Post subject: Reply with quote

new version uploaded

Version 01.01.00.10
-(bugfix) RLE-Zero encoding algorithm crashed when the encoded result data was bigger than 2 times the uncompressed data (RLE encoded worst-case is 3 times the size as uncompressed)
-(bugfix) imported files ignored the "fixed Backcolor" setting
-(update) faster file import in datagridview (now refreshes only once after import is complete)


The problem was the RLE_Zero encoder.
In SHP Builder it constantly raises the byte-array size while it creates the encoded data.
Since arrays in C# need several performance heavy steps to be resized and i didn't want to use the slower List, i simply had the byte-array for the RLE-result preallocated and scaled 2 times the size as the uncompressed byte-array, thinking it would be sufficient.
Unfortunately the worst case for RLE-Zero compressed data can make it 3 times the size as the uncompressed data, in case of a single pixel.
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
E1 Elite
Cyborg Commando


Joined: 28 May 2013

PostPosted: Wed Feb 07, 2018 12:30 pm    Post subject: Reply with quote

Could have put refresh after loading 500 or 1000 images. Loading 64k
images works but in the meantime it shows the application as Not
Responding and the grid view area is blank.

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Wed Mar 21, 2018 8:24 pm    Post subject: Reply with quote

new version uploaded

Version 01.01.00.11
-(update) JASC Palette format supported
-(update) loading files now done in a separate thread to prevent/reduce freezing interface
-(bugfix) when loading multiple SHPs, an empty cell was added after each SHPs last frame
_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 2 of 2 [78 Posts] Goto page: Previous 1, 2
View previous topic :: View next topic
 Forum index » Featured Tools » CnC Editing Tools
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only one of the following words: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

Wildcard SSL Certificates
[ Time: 0.4387s ][ Queries: 15 (0.0910s) ][ Debug on ]