Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Mar 28, 2024 3:29 pm
All times are UTC + 0
C&C1 Fading Table (.mrf) Generator
Moderators: Community Tools Developpers
Post new topic   Reply to topic Page 1 of 1 [19 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Sat Aug 23, 2014 4:02 pm    Post subject:  C&C1 Fading Table (.mrf) Generator Reply with quote  Mark this post and the followings unread

As I already somewhat announced in the other thread (the .mrf viewer), I have been making a tool to create .mrf files for C&C1 (RA seems to generate these tables in memory rather than keeping them as files). These files are basically palette remapping tables, used in the game to make colour effects like shadow, map shroud edges, stealth darkening (though not the actual effect), the targeting flash when giving attack / repair / dock commands, and a bunch more. Since they are relative to the theater's palette, they are a vital step to fully customizing terrain.

Download:
FilterCreator_v1.11.rar - The tool, plus all of the mrf creation projects. (requires .NET framework 3.5)
All icons used in the program (except the actual program icon) are based on the Fugue Icons 16x16 pack by Yusuke Kamiyamane (Copyright (C) 2010)

Test data:
FilterCreator_testdata.rar - All .mrf files in C&C, plus example screenshots to test on.

Source code:
FilterCreator_src_v1.11.rar (Visual Studio 2010 project)


Now, on to the tool itself.

The actual main tool's purpose is to recreate the existing filters in the game using brightness / contrast / colour balance / etc filters. However, since I already reconstructed all filters in the 11 .mrf files C&C1 needs for a theater, you can just go to [File] -> [Write multiple .MRF files...] and simply generate all the tables you need for a new theater.

All you need to do for that is selecting the folder with finished projects that comes with the tool, the palette of your new theater, and an output folder.

This sub-tool can also be started directly by starting FilterCreator from a shortcut with the command line parameter "-mrfui" Wink

---

The current included projects are obviously just my own reconstructions. They were created to quickly allow people to make new theaters, but they're probably far from perfect.

So, if you want to try your hand at it, or if you simply want to view existing .mrf files, here's the overview of the UI functions of the main tool:

Right pane: the preview of the original .mrf file. It shows the filename of the loaded mrf file, and the amount of filters inside the file.

Left pane: the project to recreate the filters. The filename of the loaded project is shown in the title bar of the program.

The controls get more specific as you go down on the left pane. Top is the project description... a completely optional field, really. Below that is the filters dropdown. Each filter is a "sub-project".

The three palette buttons allow you to manipulate the final palette in three ways. In all three cases, a yellow asterisk will indicate if anything is customized in the three options.

The first one, "Manual Remap", allows you to force certain colours to certain other colours before applying the filters. This can be used to make index tables as some mrf files have, or just to change certain colours before adding filters to them. Practically all existing filters seemed to have changed the animated water colours to white before applying their effect, so you probably need to use it for the same thing.
Notes:
-The specific indices set in this way are only preserved as that specific index if no effects are applied to it later.
-To set colours here that are not affected by the effects on the filter, you need to also set them in the third function, "Never remapped".

The second, "sub-palette", allows you to exclude colours from the palette. This is usually used to exclude index #0 black from the used colours. Note that this can also used in reverse, to select specifically the only colours to use for generating the palette. This is used for the unit shadow and some other filters like it, which use specific colours on the palette.

The third palette option is the "never remapped" list. This will allow you to select colours on the palette that will always remap to their own index (unless set to another index by option #1). These indices cannot be affected by the effects in the filter.

And, the last palette option, located at the top, next to the "enable filter" one, is the "Match back to palette" checkbox. If this is not enabled, you will see the filters as applied to the image, without taking into account the palette to remap back to. This also means it ignores the selected sub-palette, though force-remap and never-remapped entries are taken into account.


Under "Options", you can find an option to synchronize the filter between the left and right pane if possible, so that when you load the .mrf that corresponds to the project, it'll always show you the right filter from the file.

Then we have the effects. Available effects are Brightness, Contrast, Gamma correct, Colorize, Saturation change, Luminance change, and a combined Hue/Sat/Lum adjustment control. All effects you add to the list stack up to create the final filter. Since their order often makes a lot of difference, you can move effects up and down in the list.

Below the effects you see the actual effect sliders. The preview on the image is instant, though it might lag a little if you drag it around while "match back to palette" is enabled, because every small change will need to recalculate the remap table and apply it to the image.

That's it, I guess. The options in the menus should be pretty straightforward.



filtercreator.png
 Description:
The Filter Creator tool
 Filesize:  111.79 KB
 Viewed:  1386 Time(s)

filtercreator.png



bulkconvertor.png
 Description:
The bulk converter function
 Filesize:  6.48 KB
 Viewed:  1386 Time(s)

bulkconvertor.png



_________________

Last edited by Nyerguds on Wed Nov 24, 2021 10:54 am; edited 18 times in total

Back to top
View user's profile Send private message Visit poster's website Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Sat Aug 23, 2014 10:43 pm    Post subject: Reply with quote  Mark this post and the followings unread

Additional note: the best way to start a project is normally the "Create project from .mrf" option in the File menu. It'll allow you to select the .mrf to recreate in the project, and will automatically make all the filters, create the index table if it has one, and automate a bunch of the colour-excluding and subpalette-detection for you (if you select the options to do that).

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Matthias M.
Stealth Laser Trooper


Joined: 15 Jun 2012
Location: Germany

PostPosted: Sun Aug 24, 2014 8:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

What was the use case for these MRF files in the original?

Back to top
View user's profile Send private message
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Sun Aug 24, 2014 9:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

Use case?

They are used for generating colour effects, like the shadow under units, the fade to black in the map shroud edges, the white flashing of targeted units/buildings, the pale circles that appear on the ground when giving a move command, and a bunch more.

There are a lot of these .mrf files that contain multiple filters. These seem to start with an "index table", which is a filter filled with "255" values, on which the values 0, 1, 2, 3, 4, etc determine which palette index on the SHP represents which of the filters following the index in the mrf file.

Notably, units.mrf has an index which determines that the green colour at index 4 is the colour on the SHP that is turned into unit shadow. So, yes, that's not hardcoded in the game. It's determined by these .mrf files Wink

The same system is used to determine which colours in the shroud edges shp file are actually the different darkening filters forming the fade to black.

This also means that by editing units.mrf and adding additional filters, you could probably add more effects for unit/building SHPs on other colour indices Smile



units_index_4.png
 Description:
The index of tunits.mrf
 Filesize:  143.5 KB
 Viewed:  1384 Time(s)

units_index_4.png



_________________

Last edited by Nyerguds on Wed Nov 24, 2021 10:55 am; edited 1 time in total

Back to top
View user's profile Send private message Visit poster's website Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Mon Aug 25, 2014 9:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

I finished all filters. They're included in the new v1.04. Making new theaters for C&C1 should be peanuts now Smile

Mind you, I haven't actually tested the effects of my versions ingame. After all, they're only reconstructions of the original effects Very Happy

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Tue Aug 26, 2014 2:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

Filters in action: the edge shroud on the old TDX "pirates" terrain experiment fixed.
(don't mind the trees and tiberium; they're obviously messed up because they were never adapted to the new palette Wink)



shroudedges_error.png
 Description:
Unfixed (using Temperate .mrf files)
 Filesize:  116.46 KB
 Viewed:  1389 Time(s)

shroudedges_error.png



shroudedges_fixed.png
 Description:
Fixed, with .mrf files regenerated with my tool:
 Filesize:  111.49 KB
 Viewed:  1390 Time(s)

shroudedges_fixed.png



_________________

Last edited by Nyerguds on Wed Nov 24, 2021 10:51 am; edited 3 times in total

Back to top
View user's profile Send private message Visit poster's website Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Tue Aug 26, 2014 3:47 pm    Post subject: Reply with quote  Mark this post and the followings unread

v1.5 released: Added the ability to use the program as command line tool to generate a .mrf file out of a .mrp project and a palette file.

Syntax:
FilterCreator.exe projfile.mrp -mrf palfile.pal mrffile.mrf

I also included a .bat file that allows bulk-producing all the .mrf files needed for a C&C1 theater from the included completed filters Smile

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Tue Aug 26, 2014 9:30 pm    Post subject: Reply with quote  Mark this post and the followings unread

Right. Batch file was a dumb idea. v1.6 adds a UI for the bulk-create Smile

This means that using the included finished projects, creating the necessary filters for a new theater becomes a very simple operation. In a few clicks, you got all the required .mrf files generated.

You can start MrfCreator in this export mode directly with the with the command line parameter "-mrfui".



bulkconvertor.png
 Description:
 Filesize:  6.48 KB
 Viewed:  1387 Time(s)

bulkconvertor.png



_________________

Last edited by Nyerguds on Wed Nov 24, 2021 10:52 am; edited 1 time in total

Back to top
View user's profile Send private message Visit poster's website Skype Account
Matthias M.
Stealth Laser Trooper


Joined: 15 Jun 2012
Location: Germany

PostPosted: Sat Sep 06, 2014 4:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

Nyerguds wrote:
Filters in action: the edge shroud on the old TDX "pirates"  terrain experiment fixed.
(don't mind the trees and tiberium; they're obviously messed up because they were never adapted to the new palette Wink)

Unfixed (using Temperate .mrf files)


Fixed, with .mrf files regenerated with my tool:


Interesting, those look like the rocks from Dune 2000.

Back to top
View user's profile Send private message
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Sat Sep 06, 2014 6:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oh, they were made by Raminator. I had to do a lot of fixing for this test though since he didn't align them correctly to the existing tile foundations -_-

It's kind of a pity the whole project died... especially since these .mrf files were one of the reasons it died. I should've made this tool years ago Embarassed

_________________

Last edited by Nyerguds on Thu Jul 28, 2016 12:37 pm; edited 1 time in total

Back to top
View user's profile Send private message Visit poster's website Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Mon Sep 08, 2014 9:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

Released v1.8:
-Fixed errors when using the filters' palette functions with no image loaded. This will now generate a dummy palette to show in the dialog.
-The forced remap editor now disables selection-related buttons if no colour indices are selected, to prevent getting a "paint selected" colour picker that won't actually do anything.
-The "clear selection" button is removed for the colour picker of the forced remap editor, since it only allow selecting a single colour anyway.

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
raminator
Commander


Joined: 04 Oct 2005
Location: Bierkasten

PostPosted: Tue Sep 09, 2014 6:57 am    Post subject: Reply with quote  Mark this post and the followings unread

Matthias M. wrote:
Nyerguds wrote:
Filters in action: the edge shroud on the old TDX "pirates"  terrain experiment fixed.
(don't mind the trees and tiberium; they're obviously messed up because they were never adapted to the new palette Wink)

Unfixed (using Temperate .mrf files)
http://nyerguds.arsaneus-design.com/project_stuff/2014/FilterCreator/images/shroudedges_error.png

Fixed, with .mrf files regenerated with my tool:
http://nyerguds.arsaneus-design.com/project_stuff/2014/FilterCreator/images/shroudedges_fixed.png


Interesting, those look like the rocks from Dune 2000.


Yes. This version of the Cliffs were Dune2000.

_________________

just a simple logo by bricks @ raminator, on Flickr

Back to top
View user's profile Send private message
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Thu Sep 11, 2014 7:44 am    Post subject: Reply with quote  Mark this post and the followings unread

Well, I got it all on my hard disk now. Besides some cliffs that don't quite align to their passability grid, and some rivers that have the beach around them not lining up, all that's missing from it now are the bridges, really :-\

Well. And the SHP stuff that isn't on the adapted palette, like bibs and trees and tiberium and such. This was mostly just compiled as test for the map shroud filter, so I kinda already put more work in it than needed. But I just really like this terrain set... it'd be really neat to see it finished #Puppy dog

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Tue Sep 16, 2014 7:55 am    Post subject: Reply with quote  Mark this post and the followings unread

Released v1.9; I was missing a small functionality in the forced remap editor and it kinda annoyed me #Tongue
(the added function is "paint all unpainted"; basically a 'colour fill' function that only affects previously unspecified palette entries)

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
ApolloTD
Commander


Joined: 19 Nov 2003

PostPosted: Tue Sep 16, 2014 10:21 am    Post subject: Reply with quote  Mark this post and the followings unread

Shame the system is discarded (seemingly?) from newer games, I assume this would allow the so called palette shifting method (which was famous in 80s to 90s) to animate even still image by just changing the colors on the fly instead of game having to draw countless frames.

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


Joined: 26 Apr 2003
Location: Somewhere in Germany

PostPosted: Tue Sep 16, 2014 2:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

Nyerguds wrote:
Well, I got it all on my hard disk now. Besides some cliffs that don't quite align to their passability grid, and some rivers that have the beach around them not lining up, all that's missing from it now are the bridges, really :-\

Well. And the SHP stuff that isn't on the adapted palette, like bibs and trees and tiberium and such. This was mostly just compiled as test for the map shroud filter, so I kinda already put more work in it than needed. But I just really like this terrain set... it'd be really neat to see it finished #Puppy dog

Send me what you have via PM, I'll try to get the bridges done and fix the alignment.

Back to top
View user's profile Send private message Send e-mail
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Wed Sep 17, 2014 12:09 pm    Post subject: Reply with quote  Mark this post and the followings unread

ApolloTD wrote:
Shame the system is discarded (seemingly?) from newer games, I assume this would allow the so called palette shifting method (which was famous in 80s to 90s) to animate even still image by just changing the colors on the fly instead of game having to draw countless frames.

Well, it's pretty impossible; take TS for example. If you have terrain in one palette, with buildings in another palette on it, and then need to generate the shadow of an airplane flying over that... you'd have to generate a table for each effect for every single palette in the game that could get affected by it. It'd turn into quite a mess. In high-colour environments it's much easier to just apply the effects directly, as my editor does.

If even RA can already generate the tables itself, then that means the game contains the brightness/contrast adjustment code anyway.

Reaperrr: I could just attach it in the old TDX forum...

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Reaperrr
Commander


Joined: 26 Apr 2003
Location: Somewhere in Germany

PostPosted: Wed Sep 17, 2014 4:44 pm    Post subject: Reply with quote  Mark this post and the followings unread

Nyerguds wrote:

Reaperrr: I could just attach it in the old TDX forum...

Good point ^^

Back to top
View user's profile Send private message Send e-mail
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Fri Oct 10, 2014 7:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

v1.10 released:

-Added new option under Options: "Selecting effect focuses adjuster". This functionality has always been there, but this allows disabling it.
-Optimized ini reading of effects.
-Fixed the "Contrast" effect's "Exponential above zero" option.

[edit]

v1.11: (17/10/2014)
-Fixed a bug where the checkbox statuses of the "remember images" and "synchronize" options in the menu were switched on startup.
-"Add Filter" list now contains filter names instead of internal class names.
-Internet links in "About" frame now only open on left mouse click.
-Icons added for all menu functions.

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [19 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
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 two of the following words separated by a sharp: 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

[ Time: 0.2149s ][ Queries: 19 (0.0155s) ][ Debug on ]