Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Types | Public Member Functions | Static Public Member Functions
LightRampAttrib Class Reference

A Light Ramp is any unary operator that takes a rendered pixel as input, and adjusts the brightness of that pixel. More...

Inheritance diagram for LightRampAttrib:
RenderAttrib TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject

List of all members.

Public Types

enum  LightRampMode {
  LRTDefault = 0, LRTIdentity = 1, LRTSingleThreshold = 2, LRTDoubleThreshold = 3,
  LRTHdr0 = 4, LRTHdr1 = 5, LRTHdr2 = 6
}

Public Member Functions

float getLevel (int n)
 Returns the nth lighting level.
LightRampMode getMode ()
 Returns the LightRampAttrib mode.
float getThreshold (int n)
 Returns the nth threshold level.

Static Public Member Functions

static int getClassSlot ()
static TypeHandle getClassType ()
static RenderAttrib const makeDefault ()
 Constructs a new LightRampAttrib object.
static RenderAttrib const makeDoubleThreshold (float thresh0, float lev0, float thresh1, float lev1)
 Constructs a new LightRampAttrib object.
static RenderAttrib const makeHdr0 ()
 Constructs a new LightRampAttrib object.
static RenderAttrib const makeHdr1 ()
 Constructs a new LightRampAttrib object.
static RenderAttrib const makeHdr2 ()
 Constructs a new LightRampAttrib object.
static RenderAttrib const makeIdentity ()
 Constructs a new LightRampAttrib object.
static RenderAttrib const makeSingleThreshold (float thresh0, float lev0)
 Constructs a new LightRampAttrib object.

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
LRTDefault 
LRTIdentity 
LRTSingleThreshold 
LRTDoubleThreshold 
LRTHdr0 
LRTHdr1 
LRTHdr2 

Member Function Documentation

static int getClassSlot ( ) [static]
static TypeHandle getClassType ( ) [static]

Reimplemented from RenderAttrib.

float getLevel ( int  n)

Returns the nth lighting level.

Returns the LightRampAttrib mode.

float getThreshold ( int  n)

Returns the nth threshold level.

static RenderAttrib const makeDefault ( ) [static]

Constructs a new LightRampAttrib object.

This is the standard OpenGL lighting ramp, which clamps the final light total to the 0-1 range.

static RenderAttrib const makeDoubleThreshold ( float  thresh0,
float  lev0,
float  thresh1,
float  lev1 
) [static]

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 RenderAttrib const makeHdr0 ( ) [static]

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 RenderAttrib const makeHdr1 ( ) [static]

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 RenderAttrib const makeHdr2 ( ) [static]

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 RenderAttrib const makeIdentity ( ) [static]

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 RenderAttrib const makeSingleThreshold ( float  thresh0,
float  lev0 
) [static]

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;
}
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties