Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: Improve AO shaders. #27320

Merged
merged 4 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/jsm/postprocessing/GTAOPass.js
Expand Up @@ -4,6 +4,7 @@ import {
CustomBlending,
DataTexture,
DepthTexture,
DepthStencilFormat,
DstAlphaFactor,
DstColorFactor,
HalfFloatType,
Expand All @@ -15,6 +16,7 @@ import {
ShaderMaterial,
UniformsUtils,
UnsignedByteType,
UnsignedInt248Type,
WebGLRenderTarget,
ZeroFactor
} from 'three';
Expand Down Expand Up @@ -171,6 +173,8 @@ class GTAOPass extends Pass {
} else {

this.depthTexture = new DepthTexture();
this.depthTexture.format = DepthStencilFormat;
this.depthTexture.type = UnsignedInt248Type;
this.normalRenderTarget = new WebGLRenderTarget( this.width, this.height, {
minFilter: NearestFilter,
magFilter: NearestFilter,
Expand Down
3 changes: 1 addition & 2 deletions examples/jsm/shaders/GTAOShader.js
Expand Up @@ -79,10 +79,9 @@ const GTAOShader = {
}`,

fragmentShader: /* glsl */`

varying vec2 vUv;
uniform sampler2D tNormal;
uniform sampler2D tDepth;
uniform highp sampler2D tDepth;
uniform sampler2D tNoise;
uniform vec2 resolution;
uniform float cameraNear;
Expand Down
3 changes: 1 addition & 2 deletions examples/jsm/shaders/SAOShader.js
Expand Up @@ -49,7 +49,6 @@ const SAOShader = {
}`,

fragmentShader: /* glsl */`

#include <common>

varying vec2 vUv;
Expand All @@ -58,7 +57,7 @@ const SAOShader = {
uniform sampler2D tDiffuse;
#endif

uniform sampler2D tDepth;
uniform highp sampler2D tDepth;
uniform sampler2D tNormal;

uniform float cameraNear;
Expand Down
3 changes: 1 addition & 2 deletions examples/jsm/shaders/SSAOShader.js
Expand Up @@ -49,9 +49,8 @@ const SSAOShader = {
}`,

fragmentShader: /* glsl */`

uniform sampler2D tNormal;
uniform sampler2D tDepth;
uniform highp sampler2D tDepth;
uniform sampler2D tNoise;

uniform vec3 kernel[ KERNEL_SIZE ];
Expand Down