LightRampAttrib

from acron.core import LightRampAttrib
class LightRampAttrib

Bases:

Bases: RenderAttrib

A Light Ramp is any unary operator that takes a rendered pixel as input, and adjusts the brightness of that pixel. For example, gamma correction is a kind of light ramp. So is HDR tone mapping. So is cartoon shading. See the constructors for an explanation of each kind of ramp.

Inheritance diagram

digraph inheritance707ec51359 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "LightRampAttrib" [URL="acron.core.LightRampAttrib.html#acron.core.LightRampAttrib",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "RenderAttrib" -> "LightRampAttrib" [arrowsize=0.75,style=""]; "ReferenceCount" [URL="acron.core.ReferenceCount.html#acron.core.ReferenceCount",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "ReferenceCount" [arrowsize=0.75,style=""]; "RenderAttrib" [URL="acron.core.RenderAttrib.html#acron.core.RenderAttrib",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedWritableReferenceCount" -> "RenderAttrib" [arrowsize=0.75,style=""]; "TypedObject" [URL="acron.core.TypedObject.html#acron.core.TypedObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "TypedObject" [arrowsize=0.75,style=""]; "TypedWritable" [URL="acron.core.TypedWritable.html#acron.core.TypedWritable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedObject" -> "TypedWritable" [arrowsize=0.75,style=""]; "TypedWritableReferenceCount" [URL="acron.core.TypedWritableReferenceCount.html#acron.core.TypedWritableReferenceCount",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedWritable" -> "TypedWritableReferenceCount" [arrowsize=0.75,style=""]; "ReferenceCount" -> "TypedWritableReferenceCount" [arrowsize=0.75,style=""]; }
enum LightRampMode
enumerator LRT_default = 0
enumerator LRT_identity = 1
enumerator LRT_single_threshold = 2
enumerator LRT_double_threshold = 3
enumerator LRT_hdr0 = 4
enumerator LRT_hdr1 = 5
enumerator LRT_hdr2 = 6
property class_slot → int
static get_class_slot()
static get_class_type()
get_level()

Returns the nth lighting level.

get_mode()

Returns the LightRampAttrib mode.

get_threshold()

Returns the nth threshold level.

static make_default()

Constructs a new LightRampAttrib object. This is the standard OpenGL lighting ramp, which clamps the final light total to the 0-1 range.

static make_double_threshold()

Constructs a new LightRampAttrib object. This causes the luminance of the diffuse lighting contribution to be quantized using two thresholds:

if (original_luminance > threshold1) {
  luminance = level1;
} else if (original_luminance > threshold0) {
  luminance = level0;
} else {
  luminance = 0.0;
}
static make_hdr0()

Constructs a new LightRampAttrib object. This causes an HDR tone mapping operation to be applied.

Normally, brightness values greater than 1 cannot be distinguished from each other, causing very brightly lit objects to wash out white and all detail to be erased. HDR tone mapping remaps brightness values in the range 0-infinity into the range (0,1), making it possible to distinguish detail in scenes whose brightness exceeds 1.

However, the monitor has finite contrast. Normally, all of that contrast is used to represent brightnesses in the range 0-1. The HDR0 tone mapping operator ‘steals’ one quarter of that contrast to represent brightnesses in the range 1-infinity.

FINAL_RGB = (RGB^3 + RGB^2 + RGB) / (RGB^3 + RGB^2 + RGB + 1)
static make_hdr1()

Constructs a new LightRampAttrib object. This causes an HDR tone mapping operation to be applied.

Normally, brightness values greater than 1 cannot be distinguished from each other, causing very brightly lit objects to wash out white and all detail to be erased. HDR tone mapping remaps brightness values in the range 0-infinity into the range (0,1), making it possible to distinguish detail in scenes whose brightness exceeds 1.

However, the monitor has finite contrast. Normally, all of that contrast is used to represent brightnesses in the range 0-1. The HDR1 tone mapping operator ‘steals’ one third of that contrast to represent brightnesses in the range 1-infinity.

FINAL_RGB = (RGB^2 + RGB) / (RGB^2 + RGB + 1)
static make_hdr2()

Constructs a new LightRampAttrib object. This causes an HDR tone mapping operation to be applied.

Normally, brightness values greater than 1 cannot be distinguished from each other, causing very brightly lit objects to wash out white and all detail to be erased. HDR tone mapping remaps brightness values in the range 0-infinity into the range (0,1), making it possible to distinguish detail in scenes whose brightness exceeds 1.

However, the monitor has finite contrast. Normally, all of that contrast is used to represent brightnesses in the range 0-1. The HDR2 tone mapping operator ‘steals’ one half of that contrast to represent brightnesses in the range 1-infinity.

FINAL_RGB = (RGB) / (RGB + 1)
static make_identity()

Constructs a new LightRampAttrib object. This differs from the usual OpenGL lighting model in that it does not clamp the final lighting total to (0,1).

static make_single_threshold()

Constructs a new LightRampAttrib object. This causes the luminance of the diffuse lighting contribution to be quantized using a single threshold:

if (original_luminance > threshold0) {
  luminance = level0;
} else {
  luminance = 0.0;
}
property mode → LightRampMode

Returns the LightRampAttrib mode.