Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,8 @@
"webgl_postprocessing_outline",
"webgl_postprocessing_pixel",
"webgl_postprocessing_procedural",
"webgl_postprocessing_sao",
"webgl_postprocessing_smaa",
"webgl_postprocessing_sobel",
"webgl_postprocessing_ssao",
"webgl_postprocessing_ssr",
"webgl_postprocessing_taa",
"webgl_postprocessing_unreal_bloom",
Expand Down
41 changes: 33 additions & 8 deletions examples/jsm/postprocessing/GTAOPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ import { CopyShader } from '../shaders/CopyShader.js';
import { SimplexNoise } from '../math/SimplexNoise.js';

/**
* A pass for an GTAO effect.
*
* `GTAOPass` provides better quality than {@link SSAOPass} but is also more expensive.
* A pass for Ground-Truth Ambient Occlusion (GTAO).
*
* ```js
* const gtaoPass = new GTAOPass( scene, camera, width, height );
Expand Down Expand Up @@ -220,6 +218,7 @@ class GTAOPass extends Pass {

this._fsQuad = new FullScreenQuad( null );

this._resolutionScale = 1;
this._originalClearColor = new Color();

this.setGBuffer( parameters ? parameters.depthTexture : undefined, parameters ? parameters.normalTexture : undefined );
Expand All @@ -238,6 +237,28 @@ class GTAOPass extends Pass {

}

/**
* The resolution scale. Valid values are in the range
* `[0,1]`. `1` means best quality but also results in
* more computational overhead. Setting to `0.5` means
* the effect is computed in half-resolution.
*
* @type {number}
* @default 1
*/
get resolutionScale() {

return this._resolutionScale;

}

set resolutionScale( value ) {

this._resolutionScale = value;
this.setSize( this.width, this.height ); // force a resize when resolution scaling changes

}

/**
* Sets the size of the pass.
*
Expand All @@ -249,15 +270,19 @@ class GTAOPass extends Pass {
this.width = width;
this.height = height;

this.gtaoRenderTarget.setSize( width, height );
this.normalRenderTarget.setSize( width, height );
this.pdRenderTarget.setSize( width, height );
const effectiveWidth = Math.round( this.resolutionScale * width );
const effectiveHeight = Math.round( this.resolutionScale * height );


this.gtaoRenderTarget.setSize( effectiveWidth, effectiveHeight );
this.normalRenderTarget.setSize( effectiveWidth, effectiveHeight );
this.pdRenderTarget.setSize( effectiveWidth, effectiveHeight );

this.gtaoMaterial.uniforms.resolution.value.set( width, height );
this.gtaoMaterial.uniforms.resolution.value.set( effectiveWidth, effectiveHeight );
this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy( this.camera.projectionMatrix );
this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy( this.camera.projectionMatrixInverse );

this.pdMaterial.uniforms.resolution.value.set( width, height );
this.pdMaterial.uniforms.resolution.value.set( effectiveWidth, effectiveHeight );
this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy( this.camera.projectionMatrixInverse );

}
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/postprocessing/SAOPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SAOPass extends Pass {
/**
* Constructs a new SAO pass.
*
* @deprecated SAO has been deprecated and will be removed with r193. Use GTAOPass instead.
* @param {Scene} scene - The scene to compute the AO for.
* @param {Camera} camera - The camera.
* @param {Vector2} [resolution] - The effect's resolution.
Expand Down Expand Up @@ -184,6 +185,8 @@ class SAOPass extends Pass {

this.fsQuad = new FullScreenQuad( null );

console.warn( 'THREE.SAOPass: SAO has been deprecated and will be removed with r193. Use GTAOPass instead.' ); // @deprecated, r183

}

/**
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/postprocessing/SSAOPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SSAOPass extends Pass {
/**
* Constructs a new SSAO pass.
*
* @deprecated SSAO has been deprecated and will be removed with r193. Use GTAOPass instead.
* @param {Scene} scene - The scene to compute the AO for.
* @param {Camera} camera - The camera.
* @param {number} [width=512] - The width of the effect.
Expand Down Expand Up @@ -241,6 +242,8 @@ class SSAOPass extends Pass {

this._originalClearColor = new Color();

console.warn( 'THREE.SSAOPass: SSAO has been deprecated and will be removed with r193. Use GTAOPass instead.' ); // @deprecated, r183

}

/**
Expand Down
Binary file removed examples/screenshots/webgl_postprocessing_sao.jpg
Binary file not shown.
Binary file removed examples/screenshots/webgl_postprocessing_ssao.jpg
Binary file not shown.
2 changes: 0 additions & 2 deletions examples/tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,8 @@
"webgl_shadowmap_progressive": [ "shadow", "soft", "lightmap", "onBeforeCompile" ],
"webgl_postprocessing_ssaa": [ "msaa", "multisampled" ],
"webgl_postprocessing_ssaa_unbiased": [ "msaa", "multisampled" ],
"webgl_postprocessing_sao": [ "ambient occlusion" ],
"webgl_postprocessing_smaa": [ "msaa", "multisampled" ],
"webgl_postprocessing_sobel": [ "filter", "edge detection" ],
"webgl_postprocessing_ssao": [ "ambient occlusion" ],
"webgl_postprocessing_unreal_bloom": [ "glow" ],
"webgl_postprocessing_unreal_bloom_selective": [ "glow" ],
"webgl_postprocessing_3dlut": [ "color grading" ],
Expand Down
188 changes: 0 additions & 188 deletions examples/webgl_postprocessing_sao.html

This file was deleted.

Loading