public void WriteOutputColorAt(int x, int y, color pixelColor, Bitmap bmp) { var r = pixelColor.R(); var g = pixelColor.G(); var b = pixelColor.B(); // Divide the color total by the number of samples and gamma-correct for gamma=2.0. var scale = 1.0 / SamplePerPixel; r = Math.Sqrt(scale * r); g = Math.Sqrt(scale * g); b = Math.Sqrt(scale * b); color newColor = new color(r, g, b); bmp.SetPixel(x, Camera.OutputImageHeight - y - 1, newColor.ToCLRColor()); }