Class: ShaderHDR

ShaderHDR

ShaderHDR provides enhanced HDR tone mapping capabilities. It extends the base Shader class to include tone mapping operations and additional uniforms for HDR rendering.

Features:

  • Multiple tone mapping operators: Reinhard, ACES, and Exposure
  • Configurable parameters for each operator
  • Linear space processing

new ShaderHDR(options)

Creates a new enhanced ShaderHDR instance.

Parameters:
Name Type Description
options Object

Shader configuration options

Properties
Name Type Argument Default Description
isLinear boolean <optional>
true

Whether the shader operates in linear space

modes Array.<string> <optional>
['reinhard', 'aces', 'exposure']

Available tone mapping modes

mode string <optional>
'reinhard'

Default tone mapping mode

samplers Array.<Object> <optional>

Texture samplers for the shader

Source:

Extends

Members


toneMapOperations :Object.<string, string>

Tone mapping operations available in the shader.

Type:
  • Object.<string, string>
Source:

Methods


addFilter(filter)

Adds a filter to the shader pipeline.

Parameters:
Name Type Description
filter Object

Filter to add

Inherited From:
Overrides:
Source:
Fires:

allUniforms()

Returns all uniform variables associated with the shader and its filters. Combines uniforms from both the base shader and all active filters into a single object.

Inherited From:
Overrides:
Source:
Returns:

Combined uniform variables

Type
Object.<string, Object>

clearFilters()

Clears all filters from the shader pipeline.

Inherited From:
Overrides:
Source:
Fires:

fragShaderSrc()

Generates the fragment shader source code with enhanced HDR tone mapping.

Inherited From:
Overrides:
Source:
Returns:

GLSL source code for the fragment shader

Type
string

getUniform(name)

Gets a uniform variable by name. Searches both shader uniforms and filter uniforms.

Parameters:
Name Type Description
name string

Uniform variable name

Inherited From:
Overrides:
Source:
Returns:

Uniform object if found

Type
Object | undefined

removeFilter(name)

Removes a filter from the pipeline by name.

Parameters:
Name Type Description
name string

Name of filter to remove

Inherited From:
Overrides:
Source:
Fires:

setAcesContrast(acesContrast)

Sets the ACES contrast parameter for the shader.

Parameters:
Name Type Description
acesContrast number

The new value for ACES contrast

Source:

setExposure(exposure)

Sets the exposure parameter for the shader.

Parameters:
Name Type Description
exposure number

The new value for the exposure

Source:

setHighlightCompression(highlightCompression)

Sets the highlight compression parameter for the shader.

Parameters:
Name Type Description
highlightCompression number

The new value for highlight compression

Source:

setMode(mode)

Sets the current shader mode.

Parameters:
Name Type Description
mode string

Mode identifier (must be in options.modes)

Inherited From:
Overrides:
Source:
Throws:

If mode is not recognized

Type
Error

setShadowLift(shadowLift)

Sets the shadow lift parameter for the shader.

Parameters:
Name Type Description
shadowLift number

The new value for shadow lift

Source:

setTileSize(size)

Sets tile dimensions for shader calculations.

Parameters:
Name Type Description
size Array.<number>

[width, height] of tile in pixels

Inherited From:
Overrides:
Source:
Fires:

setUniform(name, value)

Sets a uniform variable value.

Parameters:
Name Type Description
name string

Uniform variable name

value number | boolean | Array

Value to set

Inherited From:
Overrides:
Source:
Fires:
Throws:

If uniform doesn't exist

Type
Error

setWhitePoint(whitePoint)

Sets the white point uniform for the shader.

Parameters:
Name Type Description
whitePoint number

The new value for the white point

Source:

vertShaderSrc(gl)

Gets vertex shader source code. Default implementation provides basic vertex transformation and texture coordinate passing.

Parameters:
Name Type Description
gl WebGL2RenderingContext

WebGL2 context

Inherited From:
Overrides:
Source:
Returns:

Vertex shader source code

Type
string

Events


update

Fired when shader state changes (uniforms, filters, etc).

Inherited From:
Overrides:
Source: