Repository navigation
encode.webgpu.Class.GainMapEncoderNode
@monogrid/gainmap-js / encode/webgpu / GainMapEncoderNode
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:54
A TSL texture node holding the gain map (recovery map) of an HDR image: the second step of gain map encoding.
The gain map is computed from the HDR input of a SDRRenditionNode and its SDR rendition,
into an 8 bit linear render target. The result is identical to the one of the WebGL GainMapEncoderMaterial.
It renders only when something changed (the SDR rendition or any uniform value), the SDR rendition is rendered first when needed.
import { GainMapEncoderNode, SDRRenditionNode } from '@monogrid/gainmap-js/encode/webgpu'
const sdr = new SDRRenditionNode(hdrTexture)
const gainMap = new GainMapEncoderNode(sdr, { maxContentBoost: 8 })
material.colorNode = gainMap
gainMap.gamma.value.setScalar(1.2) // renders again once, on the next frame
const metadata = gainMap.metadatanew GainMapEncoderNode(
sdr,params?):GainMapEncoderNode
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:79
the SDR rendition, its HDR input is the HDR input of the gain map
Partial<GainmapEncodingParameters> = {}
encoding parameters, all of them can be changed later through the uniforms
GainMapEncoderNode
protected_material:NodeMaterial
Defined in: src/core/webgpu/RenderTargetNode.ts:42
protected_quadMesh:QuadMesh
Defined in: src/core/webgpu/RenderTargetNode.ts:41
readonlypixelGain:Node<"vec3">
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:71
The linear gain of each pixel, (hdr + offsetHdr) / (sdr + offsetSdr), before it's clamped
to the content boost range and encoded
readonlyrenderTarget:RenderTarget
Defined in: src/core/webgpu/RenderTargetNode.ts:33
The render target holding the result
revision:
number=0
Defined in: src/core/webgpu/RenderTargetNode.ts:39
Incremented every time the render target is rendered, nodes depending on this one use it to know when to render again
readonlysdr:SDRRenditionNode
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:60
The SDR rendition this gain map is computed from
readonlyuniforms:GainMapEncoderNodeUniforms
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:65
Shared uniforms
get gamma():
UniformNode<"vec3",Vector3>
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:116
GainmapEncodingParameters.gamma
UniformNode<"vec3", Vector3>
get height():
number
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:135
Same size as the SDR rendition
number
get maxContentBoost():
UniformNode<"float",number>
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:130
GainmapEncodingParameters.maxContentBoost
Non logarithmic space, values <= 1 are clamped to 1.0001 since a gain map can't encode an empty boost range
UniformNode<"float", number>
get metadata():
GainMapMetadata
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:145
The gain map metadata matching the current uniform values
get minContentBoost():
UniformNode<"float",number>
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:125
GainmapEncodingParameters.minContentBoost
Non logarithmic space
UniformNode<"float", number>
get offsetHdr():
UniformNode<"vec3",Vector3>
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:120
GainmapEncodingParameters.offsetHdr
UniformNode<"vec3", Vector3>
get offsetSdr():
UniformNode<"vec3",Vector3>
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:118
GainmapEncodingParameters.offsetSdr
UniformNode<"vec3", Vector3>
get value():
Texture
Defined in: src/core/webgpu/RenderTargetNode.ts:139
Texture
set value(
value):void
Defined in: src/core/webgpu/RenderTargetNode.ts:133
Texture
void
get width():
number
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:133
Same size as the SDR rendition
number
get
statictype():string
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:55
string
protected_getDependencies():SDRRenditionNode[]
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:168
Render target nodes read by this node, rendered (if needed) before this one
RenderTargetNode._getDependencies
protected_getState():number[]
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:160
Values the result depends on, compared with === to the ones of the last render
number[]
protected_onRender():void
Defined in: src/encode/webgpu/nodes/GainMapEncoderNode.ts:172
Called after the render target has been rendered
void
clone():
GainMapEncoderNode
Defined in: src/core/webgpu/RenderTargetNode.ts:147
Clones created by sample() & co. are plain TextureNodes reading this node's texture,
they keep it updated before rendering as well
GainMapEncoderNode
dispose():
void
Defined in: src/core/webgpu/RenderTargetNode.ts:158
Disposes the render target and the material
void
invalidate():
GainMapEncoderNode
Defined in: src/core/webgpu/RenderTargetNode.ts:87
Forces a render the next time RenderTargetNode.render is called, use it when something the node can't track changed (e.g. a custom input node)
GainMapEncoderNode
render(
renderer):boolean
Defined in: src/core/webgpu/RenderTargetNode.ts:100
Renders into RenderTargetNode.renderTarget, only if something changed since the last render.
Called automatically when the node is part of a rendered node graph.
WebGPURenderer
boolean
true if the render target was rendered