Editing
Brighter Shores:Color masking
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Color masking is the process that the Brighter Shores game client uses to create multiple colour variations of items without needing to render and store each individual image. Images which are recovered from the Cache of the game client give us insight into the way these images are generated. Color masking has been seen for the following types of image: * Armor dyes * Potion [[Preparations]] * Carpenter Posts * [[Bitterfruit]] (only some variants) * [[Tangfruit]] * [[Limpet]] * [[Pond Weed]] * [[Kelp]] * [[Periwinkle]] * [[Shoot]] * [[Louse]] * [[Shimmerbean]] * [[Sea Slug]] (only some variants) * [[Scrap Metal]] * [[Bug]] (only some variants) * [[Worms]] * [[Lichen]] * [[Stalks]] ==Example== The process for color masking can be seen by its inputs and outputs, but the exact algorithm is not known. We can make approximations based on the resulting images that we see. Here is an example for [[Coarse Hickory Post]], [[Coarse Oak Post]], and [[Coarse Pine Post]]. Each type of item starts off with two images: a base image, also called a texture, and a colour mask: {| |[[File:Coarse Post Texture.png]] |[[File:Coarse Post Mask.png]] |[[File:Coarse Hickory Post.png]] |[[File:Coarse Oak Post.png]] |[[File:Coarse Pine Post.png]] |- |The texture |The mask |The Hickory result |The Oak result |The Pine result |} The texture image shows the detail of the item. Note that while the texture is not grayscale image ''everwhere'', it ''is'' grayscale in the areas that correspond to the mask. For these posts, that is the whole image, but for Armor dyes, there is color on the non-mask sections of the image. The mask image shows the areas where the color is to be applied. It is also monochrome, but usually not grayscale. In this example it is monochrome red, as there is only one mask to be applied. Some images, most noteable potion Preparations, have a two-color mask with a Red area and a Green area, to show two different areas which get different colors applied to them, for the two ingredients of the preparation. For each pixel in the two input images, there are only two values: the grayscale value of the texture image, <math>K</math>, and the red value of the mask image, <math>M</math>. The output image has a full colour for each of these pixels, so it has a red value, <math>R</math>, a green value, <math>G</math>, and a blue value, <math>B</math>. There exists some color transform functions: :<math>R = f_R (K,M)</math> :<math>G = f_G (K,M)</math> :<math>B = f_B (K,M)</math> To convert the input to the output. It is important to know that '''there is no cache data for what these functions are'''. ==Doing it in software== In image manipulation software such as GIMP these transforms can be applied by changing the color balance, lightness, and saturation of the texture image, on the area specified by the mask image. The above images of Coarse Posts were obtained by tweaking the values of the colour manipulation parameters until the colours of the resultant image matched a lower resolution screenshot of what the output should look like. However, once the color transform has been determined for one image, the same transform can be applied to other images. In this example, the Rugged, Average, Fine, Sturdy, and Perfect Posts for each of the 3 wood types also use the same colour transform as the Coarse Posts shown. The images created will not be perfect pixel matches to the game, but they can be close enough that people won't be able to tell the difference unless they really compare them side by side while zoomed in a lot. What this doesn't do is allow us to know what the transformations are for an entirely new color. ==Doing it in maths== A close approximation of what GIMP does with the color transformation is a moderately simple function that maps the original grayscale pixel <math>(K,K,K)</math> toward some keystone color <math>(R_0,G_0,B_0)</math>, and then applies this as a semi-transparent overlay over the original image, using <math>M</math> as the degree of opacity. In maths terms: :<math>R = R_0 \times K \times M + K \times (!M)</math> :<math>G = G_0 \times K \times M + K \times (!M)</math> :<math>B = B_0 \times K \times M + K \times (!M)</math> where <math>(!M)</math> is the complement to M, which would be <math>(256-M)</math> for 8 bit color, or <math>(1-M)</math> for decimal color. So long as the keystone color <math>(R_0,G_0,B_0)</math> has been correctly chosen, the color transformation of the image will give something close to what is desired. ==In CSS== A similar effect can be achieved in CSS by using the texture image as a background of the mask image. <syntaxhighlight lang="html" line> <div class="outer"> <img class="mask" src="/Coarse_Post_Mask.png" /> </div> </syntaxhighlight> <syntaxhighlight lang="css" line> .outer { /* Just to match the width of the image */ width: fit-content; /* Full url of the texture */ background: url('/Coarse_Post_Texture.png'); } .mask { /* Only overlay differing colors between the two images */ mix-blend-mode: color; /* Edit the hue-rotate and other values to achieve the desired final color */ filter: hue-rotate(0deg) brightness(1) contrast(100%) opacity(100%) saturate(100%); } </syntaxhighlight>
Summary:
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see
Brighter Shores:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Project page
Discussion
British English
Views
Read
Edit source
View history
More
Refresh
Search
Discord
Discord
Navigation
About us
User help
Random page
Recent changes
Warty Corrupted Miner
0m
ago
-
Alsang
Grimy Corrupted Miner
1m
ago
-
Alsang
Wretched Corrupted Miner
1m
ago
-
Alsang
Pine Tree
2m
ago
-
[anonymous]
Show more...
Brighter Shores
Professions
Factions
Episodes
Premium Pass
Monsters
Quests
Community
Policies
Tools
What links here
Related changes
Special pages
Page information