Physically Based Renderer (PBR) and scene graph designed as ECS for PEX: define entities to be rendered as collections of components with their update orchestrated by systems.
npm install pex-rendererimport {
renderEngine as createRenderEngine,
world as createWorld,
entity as createEntity,
components,
} from "pex-renderer";
import createContext from "pex-context";
import { sphere } from "primitive-geometry";
const ctx = createContext({ pixelRatio: devicePixelRatio });
const renderEngine = createRenderEngine({ ctx });
const world = createWorld();
const cameraEntity = createEntity({
transform: components.transform({ position: [0, 0, 3] }),
camera: components.camera(),
orbiter: components.orbiter(),
});
world.add(cameraEntity);
const skyEntity = createEntity({
skybox: components.skybox({ sunPosition: [1, 0.5, 1] }),
reflectionProbe: components.reflectionProbe(),
});
world.add(skyEntity);
const geometryEntity = createEntity({
transform: components.transform({ position: [0, 0, 0] }),
geometry: components.geometry(sphere()),
material: components.material({
baseColor: [1, 0, 0, 1],
metallic: 0,
roughness: 0.5,
}),
});
world.add(geometryEntity);
ctx.frame(() => {
renderEngine.update(world.entities);
renderEngine.render(world.entities, cameraEntity);
});- components are plain old data objects
- data lives in components or system caches
- systems are functions
- systems communicate through components
- system order is maintained by the user
- Entity :
object - AmbientLightComponentOptions :
object - AnimationComponentOptions :
object - AreaLightComponentOptions :
object - AxesHelperComponentOptions :
object - BoundingBoxHelperComponentOptions :
object - CameraHelperComponentOptions :
object - CameraView :
object - CameraComponentOptions :
object - DirectionalLightComponentOptions :
object - GeometryComponentOptions :
object - GridHelperComponentOptions :
object - LightHelperComponentOptions :
object - TextureTransform :
object - MaterialComponentOptions :
object - LineMaterialComponentOptions :
object - MorphComponentOptions :
object - OrbiterComponentOptions :
object - PointLightComponentOptions :
object - SSAOComponentOptions :
object - DoFComponentOptions :
object - MSAAComponentOptions :
object - AAComponentOptions :
object - FogComponentOptions :
object - BloomComponentOptions :
object - LutComponentOptions :
object - ColorCorrectionComponentOptions :
object - VignetteComponentOptions :
object - FilmGrainComponentOptions :
object - PostProcessingComponentOptions :
object - ReflectionProbeComponentOptions :
object - SkinComponentOptions :
object - SkyboxComponentOptions :
object - SpotLightComponentOptions :
object - TransformComponentOptions :
object - VertexHelperComponentOptions :
object - SystemOptions :
object - SystemUpdate :
function - SystemDispose :
function - System :
object - RenderEngineOptions
- RenderEngineRender :
function - RenderEngineDebug :
function - RenderEngine :
System - RendererSystemRender :
function - RendererSystemStageOptions :
object - RendererSystemStage :
function - RendererSystem :
object - WorldAdd :
function - WorldAddSystem :
function - WorldUpdate :
function - World :
object - RenderGraph :
object - ResourceCacheUsage :
"Transient"|"Retained" - ResourceCache :
object - RenderView :
object
pex-renderer.components : components
All components as a function returning a component with default values.
Kind: static property of pex-renderer
pex-renderer.systems : systems
All systems as a function returning a system with a type property and an update function.
Kind: static property of pex-renderer
pex-renderer.world() ⇒ World
Create a world object to store entities and systems
Kind: static method of pex-renderer
pex-renderer.entity([components]) ⇒ Entity
Create an entity from an object of plain data components
Kind: static method of pex-renderer
| Param | Type | Default |
|---|---|---|
| [components] | object |
{} |
pex-renderer.renderEngine() ⇒ RenderEngine
Create a render engine eg. a collection of systems for default rendering
Kind: static method of pex-renderer
pex-renderer.renderGraph(ctx) ⇒ RenderGraph
Create a render graph for rendering passes
Kind: static method of pex-renderer
| Param | Type |
|---|---|
| ctx | module:pex-context/types/index.js |
pex-renderer.resourceCache(ctx) ⇒ ResourceCache
Create a resource cache for pex-context caching.
Kind: static method of pex-renderer
| Param | Type |
|---|---|
| ctx | module:pex-context/types/index.js |
- components
- .ambientLight([options]) ⇒
object - .animation([options]) ⇒
object - .areaLight([options]) ⇒
object - .axesHelper([options]) ⇒
object - .boundingBoxHelper([options]) ⇒
object - .cameraHelper([options]) ⇒
object - .camera([options]) ⇒
object - .directionalLight([options]) ⇒
object - .geometry([options]) ⇒
object - .gridHelper([options]) ⇒
object - .lightHelper([options]) ⇒
object - .material([options]) ⇒
object - .morph(options) ⇒
object - .orbiter(options) ⇒
object - .pointLight([options]) ⇒
object - .postProcessing([options]) ⇒
object- .ssao([options]) ⇒
object - .dof([options]) ⇒
object - .msaa([options]) ⇒
object - .aa([options]) ⇒
object - .fog([options]) ⇒
object - .bloom([options]) ⇒
object - .lut([options]) ⇒
object - .colorCorrection([options]) ⇒
object - .vignette([options]) ⇒
object - .filmGrain([options]) ⇒
object
- .ssao([options]) ⇒
- .reflectionProbe([options]) ⇒
object - .skin([options]) ⇒
object - .skybox([options]) ⇒
object - .spotLight([options]) ⇒
object - .transform([options]) ⇒
object - .vertexHelper([options]) ⇒
object
- .ambientLight([options]) ⇒
Ambient light component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | AmbientLightComponentOptions |
Animation component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | AnimationComponentOptions |
Area light component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | AreaLightComponentOptions |
Axes helper component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | AxesHelperComponentOptions |
Bounding box helper component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | BoundingBoxHelperComponentOptions |
Camera helper component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | CameraHelperComponentOptions |
Camera component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | CameraComponentOptions |
Directional light component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | DirectionalLightComponentOptions |
Geometry component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | GeometryComponentOptions |
Grid helper component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | GridHelperComponentOptions |
Light helper component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | LightHelperComponentOptions |
Material component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | MaterialComponentOptions | LineMaterialComponentOptions |
Morph component
Kind: static method of components
| Param | Type |
|---|---|
| options | MorphComponentOptions |
Orbiter component
Kind: static method of components
| Param | Type |
|---|---|
| options | OrbiterComponentOptions |
Point light component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | PointLightComponentOptions |
Post Processing component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | PostProcessingComponentOptions |
- .postProcessing([options]) ⇒
object- .ssao([options]) ⇒
object - .dof([options]) ⇒
object - .msaa([options]) ⇒
object - .aa([options]) ⇒
object - .fog([options]) ⇒
object - .bloom([options]) ⇒
object - .lut([options]) ⇒
object - .colorCorrection([options]) ⇒
object - .vignette([options]) ⇒
object - .filmGrain([options]) ⇒
object
- .ssao([options]) ⇒
Post Processing SSAO subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | SSAOComponentOptions |
Post Processing DoF subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | DoFComponentOptions |
Post Processing MSAA subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | MSAAComponentOptions |
Post Processing AA subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | AAComponentOptions |
Post Processing Fog subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | FogComponentOptions |
Post Processing Bloom subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | BloomComponentOptions |
Post Processing LUT subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | LutComponentOptions |
Post Processing Color Correction subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | ColorCorrectionComponentOptions |
Post Processing Vignette subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | VignetteComponentOptions |
Post Processing Film Grain subcomponent
Kind: static method of postProcessing
| Param | Type |
|---|---|
| [options] | FilmGrainComponentOptions |
Reflection probe component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | ReflectionProbeComponentOptions |
Skin component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | SkinComponentOptions |
Skybox component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | SkyboxComponentOptions |
Spot light component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | SpotLightComponentOptions |
Transform component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | TransformComponentOptions |
Vertex helper component
Kind: static method of components
| Param | Type |
|---|---|
| [options] | VertexHelperComponentOptions |
- systems
- .renderer :
renderer - .animation() ⇒
System - .camera() ⇒
System - .geometry(options) ⇒
System - .layer() ⇒
System - .light() ⇒
System - .morph() ⇒
System - .reflectionProbe(options) ⇒
System - .skin() ⇒
System - .skybox(options) ⇒
System - .transform() ⇒
System - .renderPipeline(options) ⇒
System
- .renderer :
systems.renderer : renderer
All renderer systems
Kind: static property of systems
systems.animation() ⇒ System
Animation system
Kind: static method of systems
systems.camera() ⇒ System
Camera system
Adds:
- "_orbiter" to orbiter components
Kind: static method of systems
systems.geometry(options) ⇒ System
Geometry system
Adds:
- "bounds" to geometry components
- "dirty" to geometry components properties
- "_geometry" to entities as reference to internal cache
Kind: static method of systems
| Param | Type |
|---|---|
| options | SystemOptions |
systems.layer() ⇒ System
Layer system
Kind: static method of systems
systems.light() ⇒ System
Light system
Adds:
- "_projectionMatrix" and "_viewMatrix" to light components
- "_direction" to directional and spot light components
Kind: static method of systems
systems.morph() ⇒ System
Morph system
Kind: static method of systems
systems.reflectionProbe(options) ⇒ System
Reflection Probe system
Adds:
- "_reflectionProbe" to reflectionProbe components
Kind: static method of systems
| Param | Type |
|---|---|
| options | SystemOptions |
systems.skin() ⇒ System
Skin system
Kind: static method of systems
systems.skybox(options) ⇒ System
Skybox system
Adds:
- "_skyTexture" to skybox components with no envMap for skybox-renderer to render
- "_skyTextureChanged" to skybox components for reflection-probe system
Kind: static method of systems
| Param | Type |
|---|---|
| options | SystemOptions |
systems.transform() ⇒ System
Transform system
Adds:
- "worldBounds", "dirty" and "aabbDirty" to transform components
- "_transform" to entities as reference to internal cache
Kind: static method of systems
systems.renderPipeline(options) ⇒ System
Render pipeline system
Adds:
- "_near", "_far", "_radiusUV" and "_sceneBboxInLightSpace" to light components that cast shadows
- "_shadowCubemap" to pointLight components and "_shadowMap" to other light components
- "_targets" to postProcessing components
Kind: static method of systems
| Param | Type |
|---|---|
| options | SystemOptions |
renderer.base() ⇒ RendererSystem
Base renderer
All renderers are composed with it.
Kind: static method of renderer
renderer.basic(options) ⇒ RendererSystem
Basic renderer
Kind: static method of renderer
| Param | Type |
|---|---|
| options | SystemOptions |
renderer.helper(options) ⇒ RendererSystem
Helper renderer
Kind: static method of renderer
| Param | Type |
|---|---|
| options | SystemOptions |
renderer.line(options) ⇒ RendererSystem
Line renderer
Kind: static method of renderer
| Param | Type |
|---|---|
| options | SystemOptions |
renderer.skybox(options) ⇒ RendererSystem
Skybox renderer
Renders a skybox (envMap or _skyTexture) to screen or to reflection probes.
Kind: static method of renderer
| Param | Type |
|---|---|
| options | SystemOptions |
renderer.standard(options) ⇒ RendererSystem
Standard renderer
Kind: static method of renderer
| Param | Type |
|---|---|
| options | SystemOptions |
Kind: global typedef Properties
| Name | Type |
|---|---|
| id | number |
| [ambientLight] | AmbientLightComponentOptions |
| [animation] | AnimationComponentOptions | Array.<AnimationComponentOptions> |
| [areaLight] | AreaLightComponentOptions |
| [axesHelper] | AxesHelperComponentOptions |
| [boundingBoxHelper] | BoundingBoxHelperComponentOptions |
| [cameraHelper] | CameraHelperComponentOptions |
| [camera] | CameraComponentOptions |
| [directionalLight] | DirectionalLightComponentOptions |
| [geometry] | GeometryComponentOptions |
| [gridHelper] | GridHelperComponentOptions |
| [lightHelper] | LightHelperComponentOptions |
| [material] | MaterialComponentOptions |
| [morph] | MorphComponentOptions |
| [orbiter] | OrbiterComponentOptions |
| [pointLight] | PointLightComponentOptions |
| [postProcessing] | PostProcessingComponentOptions |
| [reflectionProbe] | ReflectionProbeComponentOptions |
| [skin] | SkinComponentOptions |
| [skybox] | SkyboxComponentOptions |
| [spotLight] | SpotLightComponentOptions |
| [transform] | TransformComponentOptions |
| [vertexHelper] | VertexHelperComponentOptions |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[1, 1, 1, 1] |
| [intensity] | number |
1 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [playing] | boolean |
false |
| [loop] | boolean |
false |
| [time] | number |
0 |
| [channels] | Array |
[] |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[1, 1, 1, 1] |
| [intensity] | number |
1 |
| [disk] | boolean |
false |
| [doubleSided] | boolean |
false |
| [bias] | number |
0.1 |
| [bulbRadius] | number |
1 |
| [castShadows] | boolean |
true |
| [shadowMapSize] | number |
2048 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[1, 0, 0, 1] |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[1, 1, 1, 1] |
Kind: global typedef Properties
| Name | Type |
|---|---|
| [totalSize] | Array.<number> |
| [size] | Array.<number> |
| [offset] | Array.<number> |
Kind: global typedef Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [projection] | "perspective" | "orthographic" |
"perspective" |
|
| [near] | number |
0.5 |
|
| [far] | number |
1000 |
|
| [aspect] | number |
1 |
|
| [clearColor] | module:pex-color~color |
||
| [viewMatrix] | mat4 |
||
| [invViewMatrix] | mat4 |
||
| [culling] | boolean |
false |
|
| [exposure] | number |
1 |
|
| [toneMap] | "aces" | "agx" | "filmic" | "lottes" | "neutral" | "reinhard" | "reinhard2" | "uchimura" | "uncharted2" | "unreal" |
"aces" |
|
| [outputEncoding] | number |
ctx.Encoding.Gamma |
|
| [focalLength] | number |
50 |
Focal length of the camera lens [10mm - 200mm] in mm |
| [fStop] | number |
2.8 |
Ratio of camera lens opening, f-number, f/N, aperture [1.2 - 32] in mm |
| [sensorSize] | number |
[36, 24] |
Physical camera sensor or film size [sensorWidth, sensorHeight] in mm |
| sensorFit | "vertical" | "horizontal" | "fit" | "overscan" | "vertical" |
Matching of camera frame to sensor frame | |
| [view] | CameraView |
||
| [fov] | number |
Math.PI / 4 |
|
| [left] | number |
-1 |
|
| [right] | number |
1 |
|
| [bottom] | number |
-1 |
|
| [top] | number |
1 |
|
| [zoom] | number |
1 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[1, 1, 1, 1] |
| [intensity] | number |
1 |
| [bias] | number |
0.1 |
| [bulbRadius] | number |
1 |
| [castShadows] | boolean |
true |
| [shadowMapSize] | number |
2048 |
Kind: global typedef Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [positions] | Float32Array |
||
| [normals] | Float32Array |
||
| [uvs] | Float32Array |
Alias: texCoords/texCoords0 | |
| [uvs1] | Float32Array |
Alias: texCoords1 | |
| [vertexColors] | Float32Array |
||
| [cells] | Uint16Array | Uint32Array |
||
| [weights] | Float32Array |
||
| [joints] | Float32Array |
||
| [offsets] | Float32Array |
Instanced | |
| [rotations] | Float32Array |
Instanced | |
| [scales] | Float32Array |
Instanced | |
| [colors] | Float32Array |
Instanced | |
| [count] | number |
||
| [multiDraw] | object |
||
| [culled] | boolean |
||
| [primitive] | ctx.Primitive |
ctx.Primitive.Triangles |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[1, 1, 1, 1] |
| [size] | Array.<number> |
10 |
Kind: global typedef Properties
| Name | Type | Description |
|---|---|---|
| [offset] | Array.<number> |
[x, y] |
| [rotation] | number |
angle in radians |
| [scales] | Array.<number> |
[x, y] |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [unlit] | boolean |
|
| [type] | undefined | "line" |
"undefined" |
| [baseColor] | Array.<number> |
[1, 1, 1, 1] |
| [emissiveColor] | Array.<number> |
"undefined" |
| [emissiveIntensity] | number |
1 |
| [metallic] | number |
1 |
| [roughness] | number |
1 |
| [ior] | number |
|
| [specular] | number |
|
| [specularTexture] | ctx.texture2D | TextureTransform |
|
| [specularColor] | Array.<number> |
[1, 1, 1] |
| [specularColorTexture] | ctx.texture2D | TextureTransform |
|
| [baseColorTexture] | ctx.texture2D | TextureTransform |
|
| [emissiveColorTexture] | ctx.texture2D | TextureTransform |
|
| [normalTexture] | ctx.texture2D | TextureTransform |
|
| [normalTextureScale] | number |
1 |
| [roughnessTexture] | ctx.texture2D | TextureTransform |
|
| [metallicTexture] | ctx.texture2D | TextureTransform |
|
| [metallicRoughnessTexture] | ctx.texture2D | TextureTransform |
|
| [occlusionTexture] | ctx.texture2D | TextureTransform |
|
| [clearCoat] | number |
|
| [clearCoatRoughness] | number |
|
| [clearCoatTexture] | ctx.texture2D | TextureTransform |
|
| [clearCoatRoughnessTexture] | ctx.texture2D | TextureTransform |
|
| [clearCoatNormalTexture] | ctx.texture2D | TextureTransform |
|
| [clearCoatNormalTextureScale] | number |
|
| [sheenColor] | Array.<number> |
|
| [sheenRoughness] | number |
|
| [transmission] | number |
|
| [transmissionTexture] | ctx.texture2D | TextureTransform |
|
| [dispersion] | number |
|
| [diffuseTransmission] | number |
|
| [diffuseTransmissionTexture] | ctx.texture2D | TextureTransform |
|
| [diffuseTransmissionColor] | number |
[1, 1, 1] |
| [diffuseTransmissionColorTexture] | ctx.texture2D | TextureTransform |
|
| [thickness] | number |
|
| [thicknessTexture] | ctx.texture2D | TextureTransform |
|
| [attenuationDistance] | number |
|
| [attenuationColor] | Array.<number> |
|
| [alphaTest] | number |
"undefined" |
| [alphaTexture] | ctx.texture2D | TextureTransform |
|
| [depthTest] | boolean |
true |
| [depthWrite] | boolean |
true |
| [depthFunc] | ctx.DepthFunc |
ctx.DepthFunc.Less |
| [blend] | boolean |
false |
| [blendSrcRGBFactor] | ctx.BlendFactor |
"undefined" |
| [blendSrcAlphaFactor] | ctx.BlendFactor |
"undefined" |
| [blendDstRGBFactor] | ctx.BlendFactor |
"undefined" |
| [blendDstAlphaFactor] | ctx.BlendFactor |
"undefined" |
| [cullFace] | boolean |
true |
| [cullFaceMode] | ctx.Face |
ctx.Face.Back |
| [pointSize] | number |
1 |
| [castShadows] | boolean |
false |
| [receiveShadows] | boolean |
false |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [type] | "line" |
"line" |
| [baseColor] | Array.<number> |
[1, 1, 1, 1] |
| [lineWidth] | number |
1 |
| [lineResolution] | number |
16 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| sources | object |
|
| targets | object |
|
| [current] | object |
|
| [weights] | Array |
[] |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [element] | HTMLElement |
document.body |
| [target] | Array.<number> |
[0, 0, 0] |
| [lat] | number |
0 |
| [lon] | number |
0 |
| [distance] | number |
0 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[1, 1, 1, 1] |
| [intensity] | number |
1 |
| [range] | number |
10 |
| [bulbRadius] | number |
1 |
| [castShadows] | boolean |
true |
| [shadowMapSize] | number |
2048 |
Kind: global typedef Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [type] | "sao" | "gtao" |
"sao" |
|
| [noiseTexture] | boolean |
true |
|
| [mix] | number |
1 |
|
| [samples] | number |
"gtao" ? 6 : 11 |
|
| [intensity] | number |
2.2 |
|
| [radius] | number |
0.5 |
meters |
| [blurRadius] | number |
0.5 |
|
| [blurSharpness] | number |
10 |
|
| [brightness] | number |
0 |
|
| [contrast] | number |
1 |
// SSAO |
| [bias] | number |
0.001 |
centimeters |
| [spiralTurns] | number |
7 |
// GTAO |
| [slices] | number |
3 |
|
| [colorBounce] | number |
true |
|
| [colorBounceIntensity] | number |
1.0 |
Kind: global typedef Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [type] | "gustafsson" | "upitis" |
"gustafsson" |
Gustafsson uses a spiral pattern while Upitis uses a circular one. |
| [physical] | boolean |
true |
Use camera f-stop and focal length |
| [focusDistance] | number |
7 |
The point to focus on in meters. |
| [focusScale] | number |
1 |
Non physically based value for artistic control when physical is false, otherwise act as an fStop divider. Larger aperture (ie, smaller f-stop) or larger focal length (smaller fov) = smaller depth of field = more blur. |
| [focusOnScreenPoint] | boolean |
false |
Read the depth buffer to find the first intersecting object to focus on instead of a fixed focus distance. |
| [screenPoint] | Array.<number> |
[0.5, 0.5] |
The normalized screen point to focus on when "focusOnScreenPoint" is true. |
| [chromaticAberration] | number |
0.7 |
Amount of RGB separation |
| [luminanceThreshold] | number |
0.7 |
Threshold for out of focus hightlights |
| [luminanceGain] | number |
1 |
Gain for out of focus hightlights |
| [samples] | number |
6 |
Iteration steps. More steps means better blur but also degraded performances. |
| [shape] | "disk" | "pentagon" |
"disk" |
The bokeh shape for type "upitis". |
| [debug] | boolean |
false |
Kind: global typedef Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [sampleCount] | number |
4 |
Multisample anti-aliasing samples: 1 or 4. |
Kind: global typedef Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [subPixelQuality] | number |
0.75 |
Higher = softer. Helps mitigate fireflies but will blur small details. |
| [quality] | number |
2 |
For edge luma threshold: 0 to 4. |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[0.5, 0.5, 0.5] |
| [start] | number |
5 |
| [density] | number |
0.15 |
| [sunPosition] | Array.<number> |
[1, 1, 1] |
| [sunDispertion] | number |
0.2 |
| [sunIntensity] | number |
0.1 |
| [sunColor] | Array.<number> |
[0.98, 0.98, 0.7] |
| [inscatteringCoeffs] | Array.<number> |
[0.3, 0.3, 0.3] |
Kind: global typedef Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [quality] | number |
1 |
The bloom quality: 0 or 1 (0 is faster but flickers) |
| [colorFunction] | "luma" | "luminance" | "average" |
"luma" |
The function used to determine the brightness of a pixel for the threshold. |
| [threshold] | number |
1 |
The brightness value at which pixels are filtered out for the threshold. |
| [source] | "color" | "emissive" |
"color" |
The source texture for the threshold. |
| [intensity] | number |
0.1 |
The strength of the bloom effect. |
| [radius] | number |
1 |
The downsampling radius which controls how much glare gets blended in. |
Kind: global typedef Properties
| Name | Type |
|---|---|
| texture | ctx.texture2D |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [brightness] | number |
0 |
| [contrast] | number |
1 |
| [saturation] | number |
1 |
| [hue] | number |
0 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [radius] | number |
0.8 |
| [intensity] | number |
0.2 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [quality] | number |
2 |
| [size] | number |
1.6 |
| [intensity] | number |
0.05 |
| [colorIntensity] | number |
0.6 |
| [luminanceIntensity] | number |
1 |
| [speed] | number |
0.5 |
Kind: global typedef Properties
| Name | Type |
|---|---|
| [ssao] | SSAOComponentOptions |
| [dof] | DoFComponentOptions |
| [aa] | AAComponentOptions |
| [fog] | FogComponentOptions |
| [bloom] | BloomComponentOptions |
| [lut] | LutComponentOptions |
| [colorCorrection] | ColorCorrectionComponentOptions |
| [vignette] | VignetteComponentOptions |
| [filmGrain] | FilmGrainComponentOptions |
| opacity | number |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [size] | number |
1024 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [sunPosition] | Array.<number> |
|
| [envMap] | ctx.texture2D |
|
| [backgroundBlur] | boolean |
false |
| [exposure] | number |
1 |
| [turbidity] | number |
10 |
| [rayleigh] | number |
2 |
| [mieCoefficient] | number |
0.005 |
| [mieDirectionalG] | number |
0.8 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[1, 1, 1, 1] |
| [intensity] | number |
1 |
| [angle] | number |
Math.PI / 4 |
| [innerAngle] | number |
0 |
| [range] | number |
10 |
| [bias] | number |
0.1 |
| [bulbRadius] | number |
1 |
| [castShadows] | boolean |
true |
| [shadowMapSize] | number |
2048 |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [position] | Array.<number> |
[0, 0, 0] |
| [rotation] | Array.<number> |
[0, 0, 0, 1] |
| [scale] | Array.<number> |
[1, 1, 1] |
Kind: global typedef Properties
| Name | Type | Default |
|---|---|---|
| [color] | Array.<number> |
[0, 1, 0, 1] |
| [size] | Array.<number> |
1 |
| [attribute] | string |
""normals"" |
Kind: global typedef Properties
| Name | Type |
|---|---|
| ctx | module:pex-context/types/index.js |
| [resourceCache] | ResourceCache |
| [renderGraph] | RenderGraph |
Kind: global typedef
| Param | Type |
|---|---|
| entities | Array.<Entity> |
| [deltaTime] | number |
Kind: global typedef
| Param | Type |
|---|---|
| entities | Array.<Entity> |
Kind: global typedef Properties
| Name | Type |
|---|---|
| type | string |
| cache | object |
| debug | boolean |
| update | SystemUpdate |
| dispose | SystemDispose |
Kind: global typedef Properties
| Name | Type |
|---|---|
| width | number |
| height | number |
| renderers | Array.<System> |
| drawToScreen | boolean |
Kind: global typedef
| Param | Type | Default |
|---|---|---|
| entities | Array.<Entity> |
|
| cameraEntities | Array.<Entity> |
|
| [options] | RenderEngineOptions |
{} |
Kind: global typedef
| Param | Type |
|---|---|
| enable | boolean |
RenderEngine : System
Kind: global typedef Properties
| Name | Type |
|---|---|
| render | RenderEngineRender |
| debug | RenderEngineDebug |
| systems | Array.<System> |
| renderers | Array.<System> |
Kind: global typedef
| Param | Type | Default |
|---|---|---|
| renderView | RenderView |
|
| entities | Entity | Array.<Entity> |
|
| [options] | object |
{} |
Kind: global typedef Properties
| Name | Type |
|---|---|
| [attachmentsLocations] | object |
| [shadowMappingLight] | object |
| [backgroundColorTexture] | ctx.texture2D |
| [renderingToReflectionProbe] | boolean |
Kind: global typedef
| Param | Type |
|---|---|
| renderView | Array.<RenderView> |
| entities | Array.<Entity> |
| options | RendererSystemStageOptions |
Kind: global typedef Properties
| Name | Type |
|---|---|
| type | string |
| cache | object |
| debug | boolean |
| flagDefinitions | Array.<Array> |
| update | SystemUpdate |
| dispose | SystemDispose |
| render | RendererSystemRender |
| [renderBackground] | RendererSystemStage |
| [renderShadow] | RendererSystemStage |
| [renderOpaque] | RendererSystemStage |
| [renderTransparent] | RendererSystemStage |
| [renderPost] | RendererSystemStage |
Kind: global typedef
| Param | Type |
|---|---|
| entity | Entity |
Kind: global typedef
| Param | Type |
|---|---|
| system | System |
Kind: global typedef
| Param | Type |
|---|---|
| [deltaTime] | number |
Kind: global typedef Properties
| Name | Type |
|---|---|
| entities | Array.<object> |
| systems | Array.<object> |
| add | WorldAdd |
| addSystem | WorldAddSystem |
| update | WorldUpdate |
Kind: global typedef Properties
| Name | Type |
|---|---|
| renderPasses | Array.<object> |
| beginFrame | function |
| renderPass | function |
| endFrame | function |
Kind: global typedef Properties
| Name | Type |
|---|---|
| beginFrame | function |
| endFrame | function |
| dispose | function |
| Usage | ResourceCacheUsage |
Kind: global typedef Properties
| Name | Type |
|---|---|
| camera | object |
| cameraEntity | Entity |
| viewport | module:pex-context/types/types~Viewport |
| [exposure] | object |
| [outputEncoding] | object |
MIT. See license file.
