Welcome to mirror list, hosted at ThFree Co, Russian Federation.

node_brightness.osl « shaders « osl « kernel « cycles « intern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f99e849cb555b62b78f9b9d5d41e38ae5a7e56c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* SPDX-License-Identifier: Apache-2.0
 * Copyright 2011-2022 Blender Foundation */

#include "stdcycles.h"

shader node_brightness(color ColorIn = 0.8,
                       float Bright = 0.0,
                       float Contrast = 0.0,
                       output color ColorOut = 0.8)
{
  float a = 1.0 + Contrast;
  float b = Bright - Contrast * 0.5;

  ColorOut[0] = max(a * ColorIn[0] + b, 0.0);
  ColorOut[1] = max(a * ColorIn[1] + b, 0.0);
  ColorOut[2] = max(a * ColorIn[2] + b, 0.0);
}