Class SSRRenderingPipeline
Hierarchy (View Summary)
- PostProcessRenderPipeline
- SSRRenderingPipeline
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new SSRRenderingPipeline(
name: string,
scene: Scene,
cameras?: Camera[],
forceGeometryBuffer?: boolean,
textureType?: number,
useScreenspaceDepth?: boolean,
): SSRRenderingPipelineConstructor of the SSR rendering pipeline
Parameters
- name: string
The rendering pipeline name
- scene: Scene
The scene linked to this pipeline
Optionalcameras: Camera[]The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)
- forceGeometryBuffer: boolean = false
Set to true if you want to use the legacy geometry buffer renderer (default: false)
- textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE
The texture type used by the different post processes created by SSR (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)
- useScreenspaceDepth: boolean = false
Indicates if the depth buffer should be linear or screenspace (default: false). This allows sharing the buffer with other effect pipelines that may require the depth to be in screenspace.
Returns SSRRenderingPipeline
- name: string
Properties
inspectable Custom Properties
List of inspectable custom properties (used by the Inspector)
SSR Blur Render Effect
The blur PostProcess effect id in the pipeline
SSR Combine Render Effect
The PostProcess effect id in the pipeline that combines the SSR-Blur output with the original scene color
SSR Render Effect
The SSR PostProcess effect id in the pipeline
Readonlyunique Id
Gets the unique id of the post process rendering pipeline
Accessors
attenuate Backface Reflection
-
get attenuateBackfaceReflection(): boolean
Gets or sets a boolean indicating if the backface reflections should be attenuated (default: false).
Returns boolean
-
set attenuateBackfaceReflection(attenuate: boolean): void
Parameters
- attenuate: boolean
Returns void
attenuate Facing Camera
-
get attenuateFacingCamera(): boolean
Gets or sets a boolean indicating if the reflections should be attenuated when the reflection ray is facing the camera (the view direction) (default: false).
Returns boolean
-
set attenuateFacingCamera(attenuate: boolean): void
Parameters
- attenuate: boolean
Returns void
attenuate Intersection Distance
-
get attenuateIntersectionDistance(): boolean
Gets or sets a boolean indicating if the reflections should be attenuated according to the distance of the intersection (default: true).
Returns boolean
-
set attenuateIntersectionDistance(attenuate: boolean): void
Parameters
- attenuate: boolean
Returns void
attenuate Intersection Iterations
-
get attenuateIntersectionIterations(): boolean
Gets or sets a boolean indicating if the reflections should be attenuated according to the number of iterations performed to find the intersection (default: true).
Returns boolean
-
set attenuateIntersectionIterations(attenuate: boolean): void
Parameters
- attenuate: boolean
Returns void
attenuate Screen Borders
-
get attenuateScreenBorders(): boolean
Gets or sets a boolean indicating if the reflections should be attenuated at the screen borders (default: true).
Returns boolean
-
set attenuateScreenBorders(attenuate: boolean): void
Parameters
- attenuate: boolean
Returns void
backface Depth Renderer
-
Gets the depth renderer used to render the back faces of the scene to a depth texture.
Returns Nullable<DepthRenderer>
backface Depth Texture Downsample
-
get backfaceDepthTextureDownsample(): number
Gets or sets the downsample factor (default: 0) used to create the backface depth texture - used only if enableAutomaticThicknessComputation = true. Use 0 to render the depth at full resolution, 1 to render at half resolution, 2 to render at 1/4 resolution, etc. Note that you will get rendering artefacts when using a value different from 0: it's a tradeoff between image quality and performances.
Returns number
-
set backfaceDepthTextureDownsample(factor: number): void
Parameters
- factor: number
Returns void
backface Force Depth Write Transparent Meshes
-
get backfaceForceDepthWriteTransparentMeshes(): boolean
Gets or sets a boolean (default: true) indicating if the depth of transparent meshes should be written to the backface depth texture (when automatic thickness computation is enabled).
Returns boolean
-
set backfaceForceDepthWriteTransparentMeshes(force: boolean): void
Parameters
- force: boolean
Returns void
blur Dispersion Strength
-
get blurDispersionStrength(): number
Gets or sets the blur dispersion strength. Set this value to 0 to disable blurring (default: 0.03) The reflections are blurred based on the roughness of the surface and the distance between the pixel shaded and the reflected pixel: the higher the distance the more blurry the reflection is. blurDispersionStrength allows to increase or decrease this effect.
Returns number
-
set blurDispersionStrength(strength: number): void
Parameters
- strength: number
Returns void
blur Downsample
-
get blurDownsample(): number
Gets or sets the downsample factor used to reduce the size of the textures used to blur the reflection effect (default: 0). Use 0 to blur at full resolution, 1 to render at half resolution, 2 to render at 1/3 resolution, etc.
Returns number
-
set blurDownsample(downsample: number): void
Parameters
- downsample: number
Returns void
cameras
-
Gets the list of attached cameras
Returns Camera[]
clip To Frustum
-
get clipToFrustum(): boolean
Gets or sets a boolean indicating if the ray should be clipped to the frustum (default: true). You can try to set this parameter to false to save some performances: it may produce some artefacts in some cases, but generally they won't really be visible
Returns boolean
-
set clipToFrustum(clip: boolean): void
Parameters
- clip: boolean
Returns void
debug
-
get debug(): boolean
Gets or sets a boolean indicating if the effect should be rendered in debug mode (default: false). In this mode, colors have this meaning:
- blue: the ray hit the max distance (we reached maxDistance)
- red: the ray ran out of steps (we reached maxSteps)
- yellow: the ray went off screen
- green: the ray hit a surface. The brightness of the green color is proportional to the distance between the ray origin and the intersection point: A brighter green means more computation than a darker green. In the first 3 cases, the final color is calculated by mixing the skybox color with the pixel color (if environmentTexture is defined), otherwise the pixel color is not modified You should try to get as few blue/red/yellow pixels as possible, as this means that the ray has gone further than if it had hit a surface.
Returns boolean
-
set debug(value: boolean): void
Parameters
- value: boolean
Returns void
enable Automatic Thickness Computation
-
get enableAutomaticThicknessComputation(): boolean
Gets or sets a boolean defining if geometry thickness should be computed automatically (default: false). When enabled, a depth renderer is created which will render the back faces of the scene to a depth texture (meaning additional work for the GPU). In that mode, the "thickness" property is still used as an offset to compute the ray intersection, but you can typically use a much lower value than when enableAutomaticThicknessComputation is false (it's even possible to use a value of 0 when using low values for "step") Note that for performance reasons, this option will only apply to the first camera to which the rendering pipeline is attached!
Returns boolean
-
set enableAutomaticThicknessComputation(automatic: boolean): void
Parameters
- automatic: boolean
Returns void
enable Smooth Reflections
-
get enableSmoothReflections(): boolean
Gets or sets whether or not smoothing reflections is enabled (default: false) Enabling smoothing will require more GPU power. Note that this setting has no effect if step = 1: it's only used if step > 1.
Returns boolean
-
set enableSmoothReflections(enabled: boolean): void
Parameters
- enabled: boolean
Returns void
engine
-
Gets the active engine
Returns AbstractEngine
environment Texture
-
Gets or sets the environment cube texture used to define the reflection when the reflected rays of SSR leave the view space or when the maxDistance/maxSteps is reached.
Returns Nullable<CubeTexture>
-
Parameters
- texture: Nullable<CubeTexture>
Returns void
environment Texture Is Probe
-
get environmentTextureIsProbe(): boolean
Gets or sets the boolean defining if the environment texture is a standard cubemap (false) or a probe (true). Default value is false. Note: a probe cube texture is treated differently than an ordinary cube texture because the Y axis is reversed.
Returns boolean
-
set environmentTextureIsProbe(isProbe: boolean): void
Parameters
- isProbe: boolean
Returns void
generate Output In Gamma Space
-
get generateOutputInGammaSpace(): boolean
Gets or sets a boolean defining if the output color texture generated by the SSR pipeline should be in gamma space (default: true) If you have a post-process that comes after the SSR and that post-process needs the input to be in a linear space, you must disable generateOutputInGammaSpace
Returns boolean
-
set generateOutputInGammaSpace(gammaSpace: boolean): void
Parameters
- gammaSpace: boolean
Returns void
input Texture Color Is In Gamma Space
-
get inputTextureColorIsInGammaSpace(): boolean
Gets or sets a boolean defining if the input color texture is in gamma space (default: true) The SSR effect works in linear space, so if the input texture is in gamma space, we must convert the texture to linear space before applying the effect
Returns boolean
-
set inputTextureColorIsInGammaSpace(gammaSpace: boolean): void
Parameters
- gammaSpace: boolean
Returns void
is Enabled
-
get isEnabled(): boolean
Gets or sets a boolean indicating if the effect is enabled (default: true).
Returns boolean
-
set isEnabled(value: boolean): void
Parameters
- value: boolean
Returns void
is Supported
-
get isSupported(): boolean
Returns true if SSR is supported by the running hardware
Returns boolean
max Distance
-
get maxDistance(): number
Gets or sets the maxDistance used to define how far we look for reflection during the ray-marching on the reflected ray (default: 1000). Note that this value is a view (camera) space distance (not pixels!).
Returns number
-
set maxDistance(distance: number): void
Parameters
- distance: number
Returns void
max Steps
-
get maxSteps(): number
Maximum number of steps during the ray marching process after which we consider an intersection could not be found (default: 1000). Should be an integer value.
Returns number
-
set maxSteps(steps: number): void
Parameters
- steps: number
Returns void
name
-
get name(): string
Gets pipeline name
Returns string
reflection Specular Falloff Exponent
-
get reflectionSpecularFalloffExponent(): number
Gets or sets the falloff exponent used to compute the reflection strength. Higher values lead to fainter reflections (default: 1).
Returns number
-
set reflectionSpecularFalloffExponent(exponent: number): void
Parameters
- exponent: number
Returns void
reflectivity Threshold
-
get reflectivityThreshold(): number
Gets or sets the minimum value for one of the reflectivity component of the material to consider it for SSR (default: 0.04). If all r/g/b components of the reflectivity is below or equal this value, the pixel will not be considered reflective and SSR won't be applied.
Returns number
-
set reflectivityThreshold(threshold: number): void
Parameters
- threshold: number
Returns void
roughness Factor
-
get roughnessFactor(): number
Gets or sets the factor applied when computing roughness. Default value is 0.2. When blurring based on roughness is enabled (meaning blurDispersionStrength > 0), roughnessFactor is used as a global roughness factor applied on all objects. If you want to disable this global roughness set it to 0.
Returns number
-
set roughnessFactor(factor: number): void
Parameters
- factor: number
Returns void
samples
-
get samples(): number
Returns number
-
set samples(sampleCount: number): void
MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)
Parameters
- sampleCount: number
Returns void
scene
-
Gets active scene
Returns Scene
self Collision Num Skip
-
get selfCollisionNumSkip(): number
Number of steps to skip at start when marching the ray to avoid self collisions (default: 1) 1 should normally be a good value, depending on the scene you may need to use a higher value (2 or 3)
Returns number
-
set selfCollisionNumSkip(skip: number): void
Parameters
- skip: number
Returns void
ssr Downsample
-
get ssrDownsample(): number
Gets or sets the downsample factor used to reduce the size of the texture used to compute the SSR contribution (default: 0). Use 0 to render the SSR contribution at full resolution, 1 to render at half resolution, 2 to render at 1/3 resolution, etc. Note that it is used only when blurring is enabled (blurDispersionStrength > 0), because in that mode the SSR contribution is generated in a separate texture.
Returns number
-
set ssrDownsample(downsample: number): void
Parameters
- downsample: number
Returns void
step
-
get step(): number
Gets or sets the step size used to iterate until the effect finds the color of the reflection's pixel. Should be an integer >= 1 as it is the number of pixels we advance at each step (default: 1). Use higher values to improve performances (but at the expense of quality).
Returns number
-
set step(step: number): void
Parameters
- step: number
Returns void
strength
-
get strength(): number
Gets or sets the current reflection strength. 1.0 is an ideal value but can be increased/decreased for particular results (default: 1).
Returns number
-
set strength(strength: number): void
Parameters
- strength: number
Returns void
thickness
-
get thickness(): number
Gets or sets the thickness value used as tolerance when computing the intersection between the reflected ray and the scene (default: 0.5). If setting "enableAutomaticThicknessComputation" to true, you can use lower values for "thickness" (even 0), as the geometry thickness is automatically computed thank to the regular depth buffer + the backface depth buffer
Returns number
-
set thickness(thickness: number): void
Parameters
- thickness: number
Returns void
use Fresnel
-
get useFresnel(): boolean
Gets or sets a boolean indicating whether the blending between the current color pixel and the reflection color should be done with a Fresnel coefficient (default: false). It is more physically accurate to use the Fresnel coefficient (otherwise it uses the reflectivity of the material for blending), but it is also more expensive when you use blur (when blurDispersionStrength > 0).
Returns boolean
-
set useFresnel(fresnel: boolean): void
Parameters
- fresnel: boolean
Returns void
Methods
add Camera
add Effect
-
Adds an effect to the pipeline
Parameters
- renderEffect: PostProcessRenderEffect
the effect to add
Returns void
- renderEffect: PostProcessRenderEffect
dispose
-
Removes the internal pipeline assets and detaches the pipeline from the scene cameras
Parameters
- disableGeometryBufferRenderer: boolean = false
if the geometry buffer renderer should be disabled
Returns void
- disableGeometryBufferRenderer: boolean = false
get Class Name
-
Get the class name
Returns string
"SSRRenderingPipeline"
get Scene
is Ready
-
Checks if all the post processes in the pipeline are ready.
Returns boolean
True if all the post processes in the pipeline are ready
remove Camera
serialize
-
Serializes the rendering pipeline (Used when exporting)
Returns any
the serialized object
set Pre Pass Renderer
-
Sets the required values to the prepass renderer.
Parameters
- prePassRenderer: PrePassRenderer
defines the prepass renderer to setup.
Returns boolean
true if the pre pass is needed.
- prePassRenderer: PrePassRenderer
Render pipeline to produce Screen Space Reflections (SSR) effect
References: Screen Space Ray Tracing: - http://casual-effects.blogspot.com/2014/08/screen-space-ray-tracing.html - https://sourceforge.net/p/g3d/code/HEAD/tree/G3D10/data-files/shader/screenSpaceRayTrace.glsl - https://github.com/kode80/kode80SSR SSR: - general tips: https://sakibsaikia.github.io/graphics/2016/12/26/Screen-Space-Reflection-in-Killing-Floor-2.html - computation of blur radius from roughness and distance: https://github.com/godotengine/godot/blob/master/servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl - blur and usage of back depth buffer: https://github.com/kode80/kode80SSR