Jump to content

CnCNet Forums

Search In
  • More options...
Find results that contain...
Find results in...
Nyerguds

MRF filter creation tool

Recommended Posts

First version of the tool. The only thing this can do is preview .mrf files by applying the remap filter to a given screenshot.

http://nyerguds.arsaneus-design.com/project_stuff/2014/FilterCreator/filterviewer.rar (needs .Net 3.5)
(Includes a screenshot + all .mrf files for the desert and temperate theaters)

This is the desert shadow ("shade") filter:

mrf-shadow.png

It seems a lot of the mrf files (like the one used for the shroud edges) have multiple tables inside them. I think this is the shroud edges table (for Temperate):

mrf-preview.png

The final tool will basically have 2 panes, one to view an existing MRF file on a pic like this already does, while the other will have a previewer for the new theater's screenshot, with a set of hue/brightness/saturation/etc tools to make the image on the other preview pane match the loaded mrf filter view. Then once it matches, it can generate a table out of that.

I'll probably allow saving these filter values as presets so stuff like for example the shadow under units can easily be generated once the filter values have been figured out.

Share this post


Link to post
Share on other sites

Progress...

I made the second (or rather, first) pane, which generates the actual remapping filter, using colour modifiers.

mrf-matcher.png

I will probably need Red/Green/Blue balance there too to get there.

I'm probably going to work with a system of a list of filters, so you can choose in which order the HSV / contrast / brightness / RGB balance etc filters are applied to the image.

The actual generation of the remap tables for the original palette already works, but there is no option to save them yet, and it also still needs options for excluding / forcing / exclusively using certain palette indices when generating the table (for example, it's known that the shadows in C&C palettes only use the first 15 of the last 16 colours on the palette)

Share this post


Link to post
Share on other sites

Now I need to make custom controls in C# for each of these filters... preferably with a common superclass to facilitate import/export of their data...

Share this post


Link to post
Share on other sites

Another small update: added a palette viewer to the right-side pane, which can show exactly which palette entries are used by the remap. It led me to discover that index #0 is practically always exempt from the remapping system and is always mapped to 0, and that the "light" filter (which I suspect is the flashing of units and buildings when targeting them) also uses only the shadow colours of the palette. It seems to basically be the same as the normal shadow, but with the brightness and contrast cranked up.

mrf-usedpal.png

Share this post


Link to post
Share on other sites

What will be the sense of this? Is that a kind of master ambience to make night missions like in TS?

Share this post


Link to post
Share on other sites

It's to allow things like shadows and those circular movement pings to be changed with new theatres.

Share this post


Link to post
Share on other sites

Yep. They're the missing link needed to create new theaters. At the moment, it is possible to make new theaters, but only if you use the palette of an existing theater, and the corresponding .mrf files. Once you change the palette, filters like map shroud edges, white movement circles, the flashing of units and buildings when targeting them, and the shadow effects will all start messing up (containing wrongly coloured pixels), because they are achieved by reordering colours on the palette, and the .mrf files tell it how to reorder it to get the effect. So if the palette changes, the reordering is no longer correct.

So I'm making a tool where you can define each filter as a set of effects (contrast/brightness/colorize/etc) so it becomes simple to apply it to a palette for a new theater :)

Share this post


Link to post
Share on other sites

Started building the actual class structure behind the projects.

Basic structure:

  • MorphProject : represents a .mrf file to generate. Contains a list of Filters.
  • Filter: represents one remap table in a .mrf file. Contains a list of Effects.
  • Effect: One single effect on the palette, like Darken, Colorize, Contrast, Gamma Correct, etc. Any number of these can be combined in any order to create the final Filter effect. The Remap info on the final tool will have a dropdown menu for adding these that will automatically be filled with all available effects in the program, without requiring any extra code adaptations from me when I add a new one 8)

I've decided to create one generic "slider bar" custom control. From every Effect class, the program can automatically produce a custom control, by fetching the name to display, and a list of slider bar "definitions" in ValueSliderInfo objects. These ValueSliderInfo objects contain slider definitions like the name, the minimum value, maximum value, default value, etc. They will not only be used to generate the control, but also to transfer data between the user interface and the internal objects.

Sliders have a bunch of options that make them customizable. You can set on a slider whether it shows a "reset" button to reset to the default value, and you can add a checkbox that allows disabling that specific option (which I'll probably use for the Hue in the Hue/Saturation/Luminance control). Theoretically, by having a control with only the checkbox to enable/disable the effect, you can add a simple on/off effect as well. This can serve as extra option for a filter. One of these I will use is making the contrast filter's >0 part exponential instead of linear, which allows much higher contrast values on the same slider.

The next step will not be to make that interface generating part, though... next part will be saving and loading entire projects using an ini file. Since the ValueSliderInfo objects serve as both definition files and objects to transfer values from the UI to the internals, I already made a function that allows me to read or write the contents of such a ValueSliderInfo object from/to ini automatically :)

Man, I love software design 8)

Share this post


Link to post
Share on other sites

First actual official release: MRF viewer

Yeah, sorry, this isn't the Creator tool, and I already released a beta viewer, but this is the final product for the viewer, made with the custom controls that are also in the main project.

(Also, the old viewer had a bug where it didn't close the reader for the image, making the image file unavailable for other programs until you closed the tool.)

Features:

  • View the effects of the filters inside an .mrf file on a screenshot of the game
  • View and save the screenshot's palette
  • View and save the remapped palette
  • See which colours on the palette are actually used on the remap filter
  • Palette viewer shows tooltips showing the index and colour values of all colours
  • Remapped palette viewer shows tooltips that indicates the original colour indices of the colours you see

Tool (+ test data):
http://nyerguds.arsaneus-design.com/project_stuff/2014/FilterCreator/filterviewer.rar

Source:
http://nyerguds.arsaneus-design.com/project_stuff/2014/FilterCreator/dev/filterviewer_src.rar

filterviewer.png

Share this post


Link to post
Share on other sites

The RA chrono vortex files revealed: SNOW_VTX.PAL opened in my tool

As I had predicted from the start, it's simply a 16-step fade to black. Nothing to do with the actual distortion animation.

This image shows the "view remap" function, btw, showing the actual effect on the palette. The previous pic showed the "View palette" function, with the checkbox to only show the actual colours used in the remap.

ra1_vortex.png

(I didn't put the .pal extension in the tool, though... hadn't tried anything from RA1 so far)

Share this post


Link to post
Share on other sites

Small update to the viewer: added an option on the remapped palette viewer to filter out only the indices that are untouched by the remap (meaning, where the value on a certain index equals the index itself).  This'll come in handy when recreating filters on the final mrf generator tool :)

Share this post


Link to post
Share on other sites

I just finished the UI for the final tool. I need some suggestions on this...

final_ui.png

Overview: (left part only; right part is just the viewer)

  • The top part, with the icon with the 3 coloured images, shows the name of the project. I might just move this to the title bar, not sure. Anyway, I will probably still need new/open/close/rename buttons for that somewhere. I might add a menu bar for that at the top.
  • The dropdown under it, with the icon with the yellow image, will contain the Filters. Each filter represents one remap table.
  • The white box under that, with the icon of the image with the coloured magnifying glass, are the different effects (hue/sat/lum/contrast/etc modifiers). Clicking on one of these will immediately show their adjustment bars and options below that, in the empty part with the adjustment slider icon.

Now, all this is pretty much final. The thing that kind of bothers me are these 3 colour palette icons:

  • "Manual remap" allows changing colours manually before the filters are applied. Many mrf filters set all water colours to white, so that needs to be reproducible.
  • "Sub-palette" allows setting a range of colours to use for the remapping. If used, only these colours will be used for the final filter (or, if the "Exclude" checkbox is enabled, al colours except the selected ones are used) This is needed for the shadow filters (see screenshots above) which only use the last 16 colours on the palette.
  • "Never remapped": Quite straightforward. These indices are never touched by the remapping project. They will always map back to their original index. The background black at index 0 is usually excluded that way.

But, yeah... the way these 3 buttons are there kind of bothers me. I'm just not sure if I'd need any kind of indicator to show which stuff is modified by them, or something. Any suggestions are welcome.

Share this post


Link to post
Share on other sites

First beta version. I've decided to use yellow asterisk icons to indicate that the palette stuff has been modified.

Note that the palette buttons don't work yet, but you can fill in most of their contents automatically by using the "Create project from .mrf" function.

filtercreator.png

Share this post


Link to post
Share on other sites

Well. That was easier than expected.

Seems my "hue" control wasn't even necessary for this; just specifying the palette's shadow colours as only colours to use effectively matched it to that colour. This filter gives exactly the same correct effect in both Desert and Temperate :)

(I'll give a download later, but for now I've done half of this stuff manually in the project ini file rather than making the palette selection dialogs for these palette buttons XD)

sweet_sweet_success.png

One minor annoyance, though: screenshots taken with cnc-ddraw actually capture the palette at that moment, meaning the fading white on the last palette colour is not the correct 252,252,252 value it should be, but some random shade of grey. Though this can be remedied by force-remapping index 255 to colour 15, the pure white Nevermind, force-remapping has no influence on colours set to never be remapped -_-

Share this post


Link to post
Share on other sites

The tool is finished.

The final version supports command line opening of projects, meaning, if you put the tool on a fixed place, you can assiociate the .mrp extension with it. It also supports drag & drop, of both .mrp and .mrf files.

If you open an .mrf file in the tool that way it will not be used as filter for the viewer, though; it will be opened to generate a project file, with the right set of filters, and some smart scanning options are available to automate detection of stuff like index tables and unchanged colours on the remap tables.

You can find the download here:
FilterCreator_v1.00.rar

This includes two fully finished example projects; the targeting flash when giving an attack / repair / enter command, and the unit shadow. Final goal is, of course, to have all of the .mrf files reproduced that way.

Source code pack
Test data pack

(note that there's no explicit support for the XXXX_VTX.PAL files - you'll have to change the file type to "All Files" to open them.)

Share this post


Link to post
Share on other sites
On 8/23/2014 at 3:38 AM, Allen262 said:

Looks good but something I don't think will be much use for RA1 saddly.

I just wish I'd get my hands on the values (and the exact colour manipulation methods) RA1 uses to generate its internal tables. It would make it peanuts to make all the other projects for this tool -_-

[edit]

The downloads in here are outdated; get the latest version here.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By AndrewFord
      on the CncNet5 (RA, TS, TD version) there is usually a flashing green button that says "streaming" whenever someone is live on twitch but it doesn't show anymore. When shall this be fixed.
    • By Doblofino667
      Hi guys, I have for the first time today joined Cncnet, as I really miss Tiberian Dawn and I had a huge itch to play it. The download went nice and quick and I was able to get it onto the pc. 
      When I run it though, I run into problems. It skips the opening animation and immediately goes to the starting menu. When I press "Start new game" the program hangs and then I need to use task manager to close it. I dinked around with the resolution and compatibility settings too but no joy. In the end I saw a user here report something similar and the admin said something to the effect of changing the rendering to GDI instead of Auto. I did that and still not working. (Obviously when you press start, you go to that snowflake screen where you select GDI or NOD - THAT is the screen that doesn't want to load)
      At this point, I have tried all sorts of screen resolutions, rendering options, windowed/fullscreen options and turned comparability settings on and off. Computer still hangs. 
      Interesting to note, that when I click other options like "Load", "Internet Game" or "Exit", those options work fine. BUT when I click on "Intro & Sneak Peek" all I see is a screen saying "Coming Attraction" and then goes back to the menu. I remember this was an advert for Tiberian Sun. It seems that I can't run the cutscenes or animations or movie sequences. 
      Oh, another thing that might be of assistance. When I run the program without comparability, it hangs after selecting "new game" but when I run it in comparability mode for Windows 95, the game does not load, it simply says "can't play movies" or somesuch. 
      I hope the info helps! Please advise. 
      Thanks a lot guys.
      J
    • By Noyjitat
      I played around a bit in tibed and was thinking. Wouldn't it be cool to have a mod that has the rules of c&c renegade but in an rts c&c game?
      Example:
      Guard towers fire quicker, have longer range and are more armored and nearly 1 shot most vehicles.
      Guard towers have line of sight rules meaning infantry and tanks that are really close to buildings and tall objects can avoid being fired upon. (not sure if this even possible)
      You only get 1 guard tower with the exception of 2 - 4 pillboxes or Gun turrets
      You get 1 refinery with a small amount of credits slowly accumulating overtime and then credit dumps as normal when a harvester returns
      Each team is limited to 6 tanks
      Engineer repairs infantry, tanks and structures over time
      I'm  not sure how c4 and stuff would work. Maybe something in the form of an ivan bomb and you need 4 of them placed on a structure to go off in order to destroy it? Engineers should also be able to remove this.
      Vehicle and infantry fire power, rate of fire should be increased to match the values in renegade.
      Beacon placement for super weapons. A soldier drops the beacon and then it has a count down. Can be removed by engineer.
      Beacon placements on barricks ends the match unless removed by engineer/advanced engineer
      Advanced engineers: Hotwire / Nod technicians repair faster, deploy mines, shorter fuse ivan bomb?
      engineers/ advanced engineers equipped with pistols
      The game should basically all the renegade troops you could purchase such as havoc, sakura, etc with the same role sniping, rail gun etc.
      All aircraft replaced by helicopters/orcas, all infantry/vehicles able to hit them with snipers and rocket soldiers doing the most infantry damage to them. 
       
      Basically an exact copy of the renegade game as close as you can get it but in the form of the many rts c&c games we have now. Though i think you'd want to put an limit on the amount infantry just like most renegade servers could only hand so many players. I think 70 was the biggest I remember back in the day on the renstation server.
       
    • By Techstorm
      Hey, so I want to recommend the classic C&Cs to some people I know, and they may be more likely to try it if it's free. However, while the first free C&C games were released as freeware, the primary sources of downloads are down, the only way is through 3rd party mirrors and the C&C Ultimate Collection includes them for a price. So are the first three games still considered freeware?
    • By Nyerguds
      I'll just repost this here, since PPMsite is a mess these days.
      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 © 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"
      ---
      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. 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 used palette. This is usually used to exclude index #0 black from the used colours. Note that this can also be 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.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...