Difference between revisions of "Carmack's typo"

From DoomWiki.org

[checked revision][checked revision]
(Rejected the last text change (by 24.6.17.207) and restored revision 166558 by Linguica: Next sentence explains why it makes it too dark and not too light)
m (Added line number to the ref link)
 
Line 1: Line 1:
'''Carmack's typo''' was a minor bug in {{c|dcolors.c}}, a program written by [[John Carmack]] in {{timeline|1992}} during early development of [[Doom]]. To generate the invulnerability [[colormap]], Carmack converted each color in the [[palette]] to a gray scale value using a standard formula, where the gray scale value equals {{c|red*0.299 + green*0.587 + blue*0.114}}. In the utility, Carmack accidentally wrote {{c|0.144}} instead of {{c|0.114}}, meaning that the invulnerability colormap converts all blues to be slightly too dark.{{cite web|author=[[Andrew Stine (Linguica)|Stine, Andrew]]|title=dmutils GitHub repository|url=https://github.com/linguica/dmutils/blob/master/dcolors.c|publication=GitHub|publishdate=|accessdate=}} Since the invulnerability colormap inverts the gray scale palette, this means the gray scale colors converted from blue are calculated as brighter than they should be, and so become darker than they should be when the palette is inverted.
+
'''Carmack's typo''' was a minor bug in {{c|dcolors.c}}, a program written by [[John Carmack]] in {{timeline|1992}} during early development of [[Doom]]. To generate the invulnerability [[colormap]], Carmack converted each color in the [[palette]] to a gray scale value using a standard formula, where the gray scale value equals {{c|red*0.299 + green*0.587 + blue*0.114}}. In the utility, Carmack accidentally wrote {{c|0.144}} instead of {{c|0.114}}, meaning that the invulnerability colormap converts all blues to be slightly too dark.{{cite web|author=[[Andrew Stine (Linguica)|Stine, Andrew]]|title=dmutils GitHub repository|url=https://github.com/linguica/dmutils/blob/master/dcolors.c#L194|publication=GitHub|publishdate=|accessdate=}} Since the invulnerability colormap inverts the gray scale palette, this means the gray scale colors converted from blue are calculated as brighter than they should be, and so become darker than they should be when the palette is inverted.
  
 
==References==
 
==References==

Latest revision as of 13:13, 14 June 2019

Carmack's typo was a minor bug in dcolors.c, a program written by John Carmack in 1992 during early development of Doom. To generate the invulnerability colormap, Carmack converted each color in the palette to a gray scale value using a standard formula, where the gray scale value equals red*0.299 + green*0.587 + blue*0.114. In the utility, Carmack accidentally wrote 0.144 instead of 0.114, meaning that the invulnerability colormap converts all blues to be slightly too dark.[1] Since the invulnerability colormap inverts the gray scale palette, this means the gray scale colors converted from blue are calculated as brighter than they should be, and so become darker than they should be when the palette is inverted.

References[edit]

  1. Stine, Andrew. "dmutils GitHub repository." GitHub.