Jump to content
Sign in to follow this  
[aps]gnat

Correct layer colour and type definition

Recommended Posts

Hidey Ho Terrain makers

Looking for a little advice, thanks!

Current LAYERS.PNG

Confirmed; Only 4 colours.

Sand - RGB 255-0-0

Pebbles - 0-255-0

Rock - 0-0-255

Grass - 0-0-0

Layers.cfg

class Layers
{
 class bw_grass
 {
   texture = "GNT_xx\data\bw_grass_mco.paa";
   material="GNT_xx\data\bw_grass.rvmat";
 };
 class bw_peddle
 {
   texture = "GNT_xx\data\bw_peddle_mco.paa";
   material="GNT_xx\data\bw_peddle.rvmat";
 };
 class bw_rock
 {
   texture = "GNT_xx\data\bw_rock_mco.paa";
   material="GNT_xx\data\bw_rock.rvmat";
 };
 class bw_sand
 {
   texture = "GNT_xx\data\bw_sand_mco.paa";
   material="GNT_xx\data\bw_sand.rvmat";
 };
};

class Legend
{
 picture="GNT_xx\Source\mapLegend.png";
 class Colors
 {
/// Greenish Grass
bw_grass[]={{0,0,0}};

/// Pebbles
  	bw_pebble[]={{0,255,0}};

/// Rock
   	bw_rock[]={{0,0,255}};

/// Sand in waves
   	bw_sand[]={{255,0,0}};
 }
};

I'm using the standard mapLegend.png

Problem: Only seeing 2 textures in Buldozer; Some Grass and a lot of Rock

Questions:

- ArmA2CO - Still only max 4 colours per sector?

- Will what I'm doing above work in the end?

- My concern is the custom layer colours ..... not following a typical mapLegend.png "colour=type", do they have to?

Share this post


Link to post
Share on other sites
class bw_peddle

but...

bw_pebble[]={{0,255,0}};

.probably isn't helping... ;)

It's still 4 colours per segment I'm afraid - yeah...

The maplegend.png is a tricky thing designed to automatically assign surfaces to masks which contain colours that aren't already defined in layers.cfg - and we don't really use it for that... maybe BIS do with that "other" Visitor version...

For us it simply has to be present - you can use absolutely any colour you like for any surface...

That was the short version - the long version is...

When you "import sat & mask" Visitor looks at each pixel of your mask in turn and analyses the rgb values, then it looks in Layers.cfg for a definition matching those values - if it finds one - it assigns that surface to that pixel and moves on...

If it doesn't find that colour defined in layers.cfg - it goes to the maplegend graphic - reading just the top line of pixels (which is why you can have writing underneath) - it locates this colour it's found - then it tracks left and right along that spectrum - looking for the nearest colour to the "odd" one it's found which does have a definition in layers.cfg - and it assigns that surface to that pixel...

So - really - you don't have to be as tidy with mask colours as you'd think... Visitor doesn't care how many colours are on there - if it doesn't find a colour defined, it'll use the next nearest defined colour, as dictated by maplegend - it only has problems if it finds more than four colours per segment which are defined - then you get clashes.

EG: - you have a mask with 4 colours - red, blue, green and black - and you paint a big yellow stripe across it.

Then - in your layers.cfg you define a surface each for red, blue, green, black and yellow.

When you import the mask there may be some areas with 5 colours in the one segment - Visitor can't handle that and freaks out - you get clashes...

EG2: - you have a mask with 4 colours - red, blue, green and black - and you paint a big yellow stripe across it.

Then - in your layers.cfg you define a surface each for red, blue, green and black. You don't have yellow defined.

When you import the mask Visitor will assign surfaces as normal until it hits yellow - there's no definition in Layers.cfg for yellow so it looks to maplegend - finds yellow, then looks left and right until it finds a colour that is defined - and uses that>

You don't get clashes and, in game, you'll get whatever surface Visitor decided was the "nearest to yellow"...

So what the hell use to us is that?

Well - not much... to us...

But - imagine you're BIS... you just paid big bucks for a Sat image and a matching "land use layer" - I used to make these for archaeology purposes - it's basically - a mask - there's often 30 or 40 colours on there, and they come with a "legend" telling you which colour is which.... starting to sound familiar?

If you fed a layer like that into Visitor, using a layers.cfg with only 4 actual colours defined, everytime it hit a colour it didn't recognise it would go look at maplegend and find the nearest defined colour, and if you had a maplegend with the colours you're actually using strategically placed along the spectrum - you could control how undefined colours get translated... Better still - if you could define TWO colours for something common like grass, then any undefined colours falling between those two grass "bracket colours" would be assigned to "grass" (remember it tracks both left and right when looking for "nearest colour)...

Let's look at one of BIS's maplegends now and see if it makes more sense...

mapLegend.png

Notice the "catchalls" at the extreme top and bottom - white and black...

Also notice both "rock" and "grass" defined twice - "bracketing" less important land-use categories that may have been defined on our hypothetical "ready made mask layer"..

Any areas on that original "ready made mask layer" shaded for "Mountain Pine", "Mountain grass" "Basalt" or "Sandstone" may be "undefined colours" so they'll all end up "rock", since either way that Visitor tracks along maplegend - they're all between "rock" brackets...

So it's a readymade 30 colour mask in, and a automatic 4 colour result out basically...

If you read the Wiki carefully on this topic it also mumbles something about "blending" and that it "wasn't used much" so I'm not sure if there might have been some other original intention behind this whole palaver as well...

Still.... there you go... the Big Explanation... kinda disappointing, huh?

I spent ages figuring it all out only to realise the information wasn't really of much use to us... You are still best being neat with your masks, counting colours per segment by eye, and it pretty much doesn't matter which colour you use for which surface as far as our purposes are concerned...

Still - now you know...

...and probably wish you didn't...

;)

...but I think that peddle thing is the main problem....

B

Edited by Bushlurker

Share this post


Link to post
Share on other sites

6 colors per segment in OA AFAIK

Share this post


Link to post
Share on other sites
6 colors per segment in OA AFAIK

Yes Bis can use 6 colours but (community)visitor can only handle 4 colours per segment. Would be nice if Bis would update the tools to give the communtity more possibilities... but well this will stay a wish i assume :(

Share this post


Link to post
Share on other sites

...and probably wish you didn't...

...but I think that peddle thing is the main problem....

Wow, great explanation Bush, appreciate the time you took on explaining, made it much simpler to understand.

..... as you say but, shame its only half usable.

...but I think that peddle thing is the main problem....

Whoah, stupid mistake. Great find, thanks. Might have taken me days to spot it lol

And yes, that plus one other small typo I found as I posted seems to have fixed the problem completely.

Awesome.

@Beton & PvPscene

Thanks guys, appreciate the clarification.

Share this post


Link to post
Share on other sites

Regarding that problem related to 4 colors max, I think you could use some random noclutter object to get some kind of 4 slightly different surfaces, but I haven`t tested performance with these kind of objects...

Saludos y Feliz Año Nuevo!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×