Welcome to the Creatures Wiki! Log in and join the community.

Difference between revisions of "TINT"

From Creatures Wiki
Jump to navigation Jump to search
m
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[File:AdditiveColor.svg|right|thumb|Color in the ''Creatures'' series works on a [[wikipedia:RGB color model|RGB color model]].]]
 
[[File:AdditiveColor.svg|right|thumb|Color in the ''Creatures'' series works on a [[wikipedia:RGB color model|RGB color model]].]]
TINT is a CAOS command used in Creatures 3, Docking Station, and Creatures Village to change the colour of agents.  Understanding this command can help in understanding [[pigment bleed]] genes for those games.  Rotation and swap alter the color of each pixel.  Rotation and swap affect the pixel colors of the sprite after pigments have been applied, and do not affect gray pixels on sprites.
+
TINT is a CAOS command used in Creatures 3, Docking Station, and Creatures Village to change the [[colour]] of agents.  Understanding this command can help in understanding [[pigment bleed]] genes for those games.  Rotation and swap alter the color of each pixel.  Rotation and swap affect the pixel colors of the sprite after pigments have been applied, and do not affect gray pixels on sprites.
 
==TINT for Input==
 
==TINT for Input==
 
Syntax:
 
Syntax:
Line 11: Line 11:
 
''TINT (integer) ATTRIBUTE (integer)''
 
''TINT (integer) ATTRIBUTE (integer)''
  
Returns a tint value for an agent - currently it works only on [[Skeletal Creatures]]. Attribute can be:
+
Returns a tint value for an agent - currently it works only on [[Skeletal Creatures]]. The value for "attribute" can be:
 
*1 - Red
 
*1 - Red
 
*2 - Green
 
*2 - Green
Line 21: Line 21:
 
[[File:RGB color circle.png|right]]
 
[[File:RGB color circle.png|right]]
  
Rotation is similar to rotating the pixel's color clockwise around the color wheel for values below 128.  For each of the pixel's three color channels, the value is replaced by a [[wikipedia:weighted average|weighted average]] between that channel and the one that comes ''before'' it in the sequence ''blue, red, green, blue''.  The effect ranges from doing nothing at a value of 128 to completely turning all greens to blues, blues to reds and reds to greens, and as a consequence also turning all magentas to yellows, yellows to cyans, and cyans to magentas.   
+
Rotation can be thought of as rotating each pixel's color around the color wheel.   
  
For values of 129 and above, the pixel's color is rotated anti-clockwise around the color wheel.  For each of the pixel's three color channels, the value is replaced by a [[wikipedia:weighted average|weighted average]] between that channel and the one that comes ''after'' it in the sequence ''blue, red, green, blue''.  The effect ranges from doing nothing at a value of 128 to completely turning all reds to blue, all blues to green, and all greens to red. <!--and as a consequence also turning all magentas to yellows, yellows to cyans, and cyans to magentas. - needs changing to counter-clockwise notation -->
+
For rotation values of 127 and below, the rotation is clockwise, with lower rotation values corresponding to larger rotations.  For each of the pixel's three color channels, the original numerical value is replaced by a [[wikipedia:weighted average|weighted average]] between that channel and the one that comes after it in the sequence ''blue, green, red, blue''.  For example, with a rotation value of 0, the number in the blue channel is completely replaced by the number in the green channel, resulting in all green pixels turning blue.  Furthermore, blue pixels become red, red pixels become green, magenta pixels become yellow, yellow pixels become cyan, and cyan pixels become magenta.
 +
 
 +
Similarly, for rotation values of 129 and above, the pixel's color is rotated anti-clockwise around the color wheel.  For each of the pixel's three color channels, the original numerical value is replaced by a weighted average between that channel and the one that comes ''before'' it in the sequence ''blue, green, red, blue''.  For example, with a rotation value of 255, the blue channel's value is completely replaced by the red channel's value, resulting in all red pixels turning blue.  Furthermore, blue pixels become green, green pixels become red, cyan pixels become yellow, yellow pixels become magenta, and magenta pixels become cyan.
 +
 
 +
A rotation value of 128 means that no rotation is taking place.
 +
 
 +
Although this process is described in [https://web.archive.org/web/20170814231504/http://www.gamewareeurope.com/GWDev/cdn/CDN_more.php?CDN_article_id=11 How Pigmentation works] at the [[CDN]], it contradicts the pseudocode, which is likely incorrect because it leaves some parts of the output undefined for values greater than 128. The missing part of the pseudocode would be:
 +
 
 +
<pre>
 +
if (rotation < 128)
 +
rotRed = ((absRot * tempBlue) + (invRot * tempRed)) / 256
 +
rotGreen = ((absRot * tempRed) + (invRot * tempGreen)) / 256
 +
rotBlue = ((absRot * tempGreen) + (invRot * tempBlue)) / 256
 +
*From here
 +
else
 +
rotRed = ((absRot * tempGreen) + (invRot * tempRed)) / 256
 +
rotGreen = ((absRot * tempBlue) + (invRot * tempGreen)) / 256
 +
rotBlue = ((absRot * tempRed) + (invRot * tempBlue)) / 256
 +
*To here
 +
endif
 +
</pre>
  
 
==Swap==
 
==Swap==
Swap refers to a technique used in [[wikipedia:infrared photography|infrared photography]] post-processing to make colors seem more normal.[https://pario.no/2008/06/09/color-channel-swapping-in-photoshop/]  In the ''Creatures'' series, it swaps the values of the blue and red channel by the amount specified - 128 will leave it as is, and the more it deviates from 128 in either direction, the more the red value becomes what the blue value used to be and vice versa.  Swapping is like partially replacing the pixel's color with the color on the wheel at the location mirrored across the green-magenta axis. In other words, the farther the swap value is from 128, the more the bluer pixels will become redder and the redder pixels will become bluer.[http://www.gamewareeurope.com/GWDev/cdn/CDN_more.php?CDN_article_id=11]
+
Swap refers to a technique used in [[wikipedia:infrared photography|infrared photography]] post-processing to make colors seem more normal.[https://pario.no/2008/06/09/color-channel-swapping-in-photoshop/]  In the ''Creatures'' series, it swaps the values of the blue and red channel by the amount specified - 128 will leave it as is, and the more it deviates from 128 in either direction, the more the red value becomes what the blue value used to be and vice versa.  Swapping is like partially replacing the pixel's color with the color on the wheel at the location mirrored across the green-magenta axis. In other words, the farther the swap value is from 128, the more the bluer pixels will become redder and the redder pixels will become bluer.[https://web.archive.org/web/20170814231504/http://www.gamewareeurope.com/GWDev/cdn/CDN_more.php?CDN_article_id=11]
  
 
Since the engine only looks at the distance from 128, at the two extremes, a maximum value of 255 in swap is visually the same as a minimum value of 0, and a value of 64 (halfway between 128 and 0) is the same as a value of 192 (halfway between 255 and 128).
 
Since the engine only looks at the distance from 128, at the two extremes, a maximum value of 255 in swap is visually the same as a minimum value of 0, and a value of 64 (halfway between 128 and 0) is the same as a value of 192 (halfway between 255 and 128).
Line 44: Line 64:
 
*[[WTNT]]
 
*[[WTNT]]
 
*[[TNTC]]
 
*[[TNTC]]
 +
*[[Bramboo]]
 
*[[ColorTest]]
 
*[[ColorTest]]
 +
*[[Rainbow Sharkling]]
  
 
==External links==
 
==External links==
*[http://creaturescaves.com/community.php?section=Resources&view=108 Saving Random Tints] by [[ylukyun]]
+
*[https://creaturescaves.com/community.php?section=Resources&view=108 Saving Random Tints] by [[ylukyun]]
 
*[http://creaturesfrance.free.fr/1024/3creatures/creer/tutorpigmentation/index.htm Comment changer l'apparence d'un norn ?] by [[CyberWolf]] (in French) - covers the TINT command, gives a good explanation of pigment bleed and rotation and gene editing creatures for appearance.
 
*[http://creaturesfrance.free.fr/1024/3creatures/creer/tutorpigmentation/index.htm Comment changer l'apparence d'un norn ?] by [[CyberWolf]] (in French) - covers the TINT command, gives a good explanation of pigment bleed and rotation and gene editing creatures for appearance.
*[http://www.gamewareeurope.com/GWDev/cdn/CDN_more.php?CDN_article_id=11 How Pigmentation works] at the [[CDN]]
+
*[https://web.archive.org/web/20170814231504/http://www.gamewareeurope.com/GWDev/cdn/CDN_more.php?CDN_article_id=11 How Pigmentation works] at the [[CDN]]
  
 
[[Category:C3 CAOS Commands]]
 
[[Category:C3 CAOS Commands]]

Latest revision as of 15:50, 3 October 2022

Color in the Creatures series works on a RGB color model.

TINT is a CAOS command used in Creatures 3, Docking Station, and Creatures Village to change the colour of agents. Understanding this command can help in understanding pigment bleed genes for those games. Rotation and swap alter the color of each pixel. Rotation and swap affect the pixel colors of the sprite after pigments have been applied, and do not affect gray pixels on sprites.

TINT for Input[edit]

Syntax: TINT (command) RED_TINT (integer) GREEN_TINT (integer) BLUE_TINT (integer) ROTATION (integer) SWAP (integer)

This tints the TARG agent with the red, green, blue tint and applies the colour rotation and swap as per pigment bleed genes. Specify the PART first for compound agents. The tinted agent or part now uses a cloned gallery, which means it takes up more memory, and the save world files are larger. However it also no longer needs the sprite file. Also, tinting resets camera shy and other properties of the gallery. See TINO for a quicker version that tints only one frame.

TINT for Output[edit]

Syntax: TINT (integer) ATTRIBUTE (integer)

Returns a tint value for an agent - currently it works only on Skeletal Creatures. The value for "attribute" can be:

  • 1 - Red
  • 2 - Green
  • 3 - Blue
  • 4 - Rotation
  • 5 - Swap

Rotation[edit]

RGB color circle.png

Rotation can be thought of as rotating each pixel's color around the color wheel.

For rotation values of 127 and below, the rotation is clockwise, with lower rotation values corresponding to larger rotations. For each of the pixel's three color channels, the original numerical value is replaced by a weighted average between that channel and the one that comes after it in the sequence blue, green, red, blue. For example, with a rotation value of 0, the number in the blue channel is completely replaced by the number in the green channel, resulting in all green pixels turning blue. Furthermore, blue pixels become red, red pixels become green, magenta pixels become yellow, yellow pixels become cyan, and cyan pixels become magenta.

Similarly, for rotation values of 129 and above, the pixel's color is rotated anti-clockwise around the color wheel. For each of the pixel's three color channels, the original numerical value is replaced by a weighted average between that channel and the one that comes before it in the sequence blue, green, red, blue. For example, with a rotation value of 255, the blue channel's value is completely replaced by the red channel's value, resulting in all red pixels turning blue. Furthermore, blue pixels become green, green pixels become red, cyan pixels become yellow, yellow pixels become magenta, and magenta pixels become cyan.

A rotation value of 128 means that no rotation is taking place.

Although this process is described in How Pigmentation works at the CDN, it contradicts the pseudocode, which is likely incorrect because it leaves some parts of the output undefined for values greater than 128. The missing part of the pseudocode would be:

if (rotation < 128)
rotRed = ((absRot * tempBlue) + (invRot * tempRed)) / 256
rotGreen = ((absRot * tempRed) + (invRot * tempGreen)) / 256
rotBlue = ((absRot * tempGreen) + (invRot * tempBlue)) / 256
*From here
else
rotRed = ((absRot * tempGreen) + (invRot * tempRed)) / 256
rotGreen = ((absRot * tempBlue) + (invRot * tempGreen)) / 256
rotBlue = ((absRot * tempRed) + (invRot * tempBlue)) / 256
*To here
endif

Swap[edit]

Swap refers to a technique used in infrared photography post-processing to make colors seem more normal.[1] In the Creatures series, it swaps the values of the blue and red channel by the amount specified - 128 will leave it as is, and the more it deviates from 128 in either direction, the more the red value becomes what the blue value used to be and vice versa. Swapping is like partially replacing the pixel's color with the color on the wheel at the location mirrored across the green-magenta axis. In other words, the farther the swap value is from 128, the more the bluer pixels will become redder and the redder pixels will become bluer.[2]

Since the engine only looks at the distance from 128, at the two extremes, a maximum value of 255 in swap is visually the same as a minimum value of 0, and a value of 64 (halfway between 128 and 0) is the same as a value of 192 (halfway between 255 and 128).

Examples[edit]

To set the colour of an agent, where RRR is the amount of red, GGG is the amount of green, BBB the amount of blue, and SSS/RRR are the swap/rotation of the colour (all are numbers from 0 to 256)

targ hots tint RRR GGG BBB RRR SSS

See also[edit]

External links[edit]