unit transparency
-
- Posts: 7
- Joined: Sun Apr 19, 2020 11:29 pm
unit transparency
I'm dabbling in mapmaking and unit making, and am trying to import new sprites for a few new units. I'm using Oak, but I can't seem to figure out how to specify which color represents transparency. I've tried making and importing an alpha mask bitmap too, but that doesn't seem to work either (I get an error about the filename not matching, even though it does match the original bitmap filename).
Can someone please help, I've figured everything else out but it is not good if my units have a blue box around them :p
I have photoshop, if that is helpful with this.
PS Been playing the Myth games since their original release. My brother and I have been playing multiplayer a lot together since COVID19 began - we're very pleased to see a community is still supporting the game!
Can someone please help, I've figured everything else out but it is not good if my units have a blue box around them :p
I have photoshop, if that is helpful with this.
PS Been playing the Myth games since their original release. My brother and I have been playing multiplayer a lot together since COVID19 began - we're very pleased to see a community is still supporting the game!
-
- Posts: 7
- Joined: Sun Apr 19, 2020 11:29 pm
Re: unit transparency
Well I figured it out. For future reference here's the workflow I'm using. I'm working off of Sprite sheets:
1. Load sprite sheet in Photoshop, save as a PSD
2. Set Image->Mode->RGB Color
3. Select and Delete the background if it isn't already transparent (magic wand can make this easy)
4. If working with a sprite sheet, use Slice tool to slice individual frames
5. File->Export->Save For Web
6. Select the slices to export, output format should be
9. Fire up Oak, do Tools->Build Standard Collection
For Step 8, importing the collection, follow this that I found in another thread:
1. Load sprite sheet in Photoshop, save as a PSD
2. Set Image->Mode->RGB Color
3. Select and Delete the background if it isn't already transparent (magic wand can make this easy)
4. If working with a sprite sheet, use Slice tool to slice individual frames
5. File->Export->Save For Web
6. Select the slices to export, output format should be
- PNG-24
- Transparency box checked
- Convert to sRGB box checked
- myunit/walk
- myunit/stand
- myunit/attack
- etc
Code: Select all
mogrify -extent 312x198 -background none -gravity center -define png:format=png32 *.png
For Step 8, importing the collection, follow this that I found in another thread:
Melekor wrote:If you have rendered all of your sequences from the same camera position, so that all of your renders are lined up, you can use Oak's "build standard collection" tool (in the Tools menu). It handles almost all of the collection building process for you, including indexing.
Basically, the tool wants the renders arranged in a folder structure, one folder per sequence (animation).
e.g.Then you select the "myunit" folder in the tool, fill in the options and click OK.Code: Select all
myunit/walk/ myunit/attack/ myunit/taunt/
The images in each folder are sorted by filename and then the frames and views are filled out in order from the sorted images. The tool defaults to 8 views per sequence, meaning the images are ordered like thisIf you tick the checkbox for "frames then views ordering", then they are ordered asCode: Select all
views frames 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (etc)
If the number of views for your unit isn't the default of 8, you will have to use the script mechanism to specify it for each sequence. This is done by creating a text file that goes into the folders that the tool will read.Code: Select all
views frames 1 9 etc 2 10 3 11 4 12 ..
The script should be named "script.txt" and it can be placed in the root folder myunit/script.txt as well as in each animation folder, myunit/walk/script.txt etc. If a folder has no script, it inherits the script from its parent.
An example script file showcasing all the possible parameters:The first parameter is called the "frame mapping" which can be used to permute or duplicate frames.Code: Select all
(3 3 2 1 2) Frames 5 Views 5 BitmapOrder FramesThenViews
BitmapOrder can be either FramesThenViews or ViewsThenFrames.
Frames and Views - self explanatory.
The reg. point X, Y fields are used to specify where the bottom of the sprite is. This is typically somewhere between a unit's feet - check out other collections in the editor to see where you should set this.
Last edited by spicysaltysquid on Sun Apr 26, 2020 5:39 pm, edited 1 time in total.
Re: unit transparency
Glad you were able to get the process working! Hope you will share the new units with us when they are finished
-
- Posts: 7
- Joined: Sun Apr 19, 2020 11:29 pm
Re: unit transparency
Hi @Melekor I definitely will share everything I make.
One more piece I haven't figured out - how do I add shadows to the Sequences using Oak?
One more piece I haven't figured out - how do I add shadows to the Sequences using Oak?
- paladin MAIK
- Posts: 339
- Joined: Mon Aug 06, 2012 12:31 am
- Location: (Russia)
- Contact:
Re: unit transparency
Hi spicysaltysquid. You can add shadows simply by copying a bitmap from another collection (warrior, for example). This is the easiest way, since almost everyone collections has the same shadows.
-
- Posts: 7
- Joined: Sun Apr 19, 2020 11:29 pm
Re: unit transparency
Thanks paladin MAIK, that is what I was planning on doing but I can't find a way to get the shadow attached to the sequence.
In Oak I can go to Shadows and do "Add Shadows from File" and they get added, but after that how do I bring that shadow bmp into one of the sequences?
Or is there a way to bring them in using the Build Standard Collection tool?
In Oak I can go to Shadows and do "Add Shadows from File" and they get added, but after that how do I bring that shadow bmp into one of the sequences?
Or is there a way to bring them in using the Build Standard Collection tool?
Re: unit transparency
I'm not sure if there is a more automated way using the collection builder, but you can manually add shadows to a sequence. Just open the sequence you want to edit, and then switch the main collection window to the shadows tab. You need to then click the grid button to change the view, and then you should be able to drag and drop.
-
- Posts: 7
- Joined: Sun Apr 19, 2020 11:29 pm
Re: unit transparency
Oh I can't believe it is that easy! Heh I was using the list view and just could not find a way to make it work!
Wow that makes substituting bitmaps so much easier for me, I was rebuilding my collection each time.
Thanks a bunch hmp!
Wow that makes substituting bitmaps so much easier for me, I was rebuilding my collection each time.
Thanks a bunch hmp!
Re: unit transparency
I have some code laying around for autogenerating shadows but I never got around to integrating it into the UI. Should really do that at some point, real shame to let it go to waste.
Re: unit transparency
Can you upload your folder structure for the auto tool somewhere? I want to use it for testing while I integrate shadow generation. Don't have any lying around, it's been literally years since I looked at this stuffspicysaltysquid wrote:Hi @Melekor I definitely will share everything I make.
One more piece I haven't figured out - how do I add shadows to the Sequences using Oak?
-
- Posts: 7
- Joined: Sun Apr 19, 2020 11:29 pm
Re: unit transparency
Hey Melekor, sure here's a folder for one unit with all the script.txt files in place; auto-shadows sounds great
https://drive.google.com/open?id=1gB5I- ... WdAbTMk2zu
https://drive.google.com/open?id=1gB5I- ... WdAbTMk2zu
- paladin MAIK
- Posts: 339
- Joined: Mon Aug 06, 2012 12:31 am
- Location: (Russia)
- Contact:
Re: unit transparency
Looks like a supermutant from fallout 2
Re: unit transparency
Perfect, thanks!spicysaltysquid wrote:Hey Melekor, sure here's a folder for one unit with all the script.txt files in place; auto-shadows sounds great :-)
https://drive.google.com/open?id=1gB5I- ... WdAbTMk2zu
Re: unit transparency
Melekor Dynamic shadows.... DYNAMIC SHADOWS ...DYNAMIC SHADOWS!... DYNAMIC SHADOWS!!! Implementing dynamic shadows would be the bomb !
if one does not learn from the failings of the past they are likely to suffer its return.
Re: unit transparency
Time flies, hard to believe it's already been almost a month since I promised to add shadow generation. I finally had a few hours to sit down and do this today.
New alpha up on the builds page including the shadow functionality. I also added support for specifying a lot more stuff in script.txt, here is an example that shows most of the options:
I have not extensively tested this stuff so it could be buggy. Let me know if any of the options don't work or if you run into any issues.
New alpha up on the builds page including the shadow functionality. I also added support for specifying a lot more stuff in script.txt, here is an example that shows most of the options:
Code: Select all
RegPoint (160,140)
BitmapOrder FramesThenViews
ObjectScale 1.0
Radius 25
Top 90
Bottom -10
TicksPerFrame 4
KeyFrame 0
LoopFrame 0
FirstSoundTag
KeySoundTag
LastSoundTag
TransferPeriod 2
TransferMode None
GenerateShadows True
GenerateShadows.SunElevationAngle 35
GenerateShadows.SunYawAngle 45
GenerateShadows.MaxFalloff 0.5
GenerateShadows.MaxDarkness 0.8