Skip to content

Commit

Permalink
support ortho camera + logdepth
Browse files Browse the repository at this point in the history
  • Loading branch information
N8 committed Sep 17, 2024
1 parent 0fd05e9 commit 8dbe33e
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 24 deletions.
31 changes: 26 additions & 5 deletions dist/N8AO.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/N8AO.js.map

Large diffs are not rendered by default.

31 changes: 26 additions & 5 deletions example/N8AO.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/N8AO.js.map

Large diffs are not rendered by default.

31 changes: 26 additions & 5 deletions example_postprocessing/N8AO.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example_postprocessing/N8AO.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8ao",
"version": "1.9.1",
"version": "1.9.2",
"description": "An efficient and visually pleasing implementation of SSAO with an emphasis on temporal stability and artist control.",
"main": "dist/N8AO.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/DepthDownSample.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const DepthDownSample = {
'viewMatrixInv': { value: new THREE.Matrix4() },
'projectionMatrixInv': { value: new THREE.Matrix4() },
'logDepth': { value: false },
'ortho': { value: false }
},
depthWrite: false,
depthTest: false,
Expand All @@ -25,6 +26,7 @@ const DepthDownSample = {
uniform float near;
uniform float far;
uniform bool logDepth;
uniform bool ortho;
uniform mat4 viewMatrixInv;
uniform mat4 projectionMatrixInv;
varying vec2 vUv;
Expand All @@ -43,7 +45,7 @@ const DepthDownSample = {
return wpos.xyz / wpos.w;
}
vec3 getWorldPos(float depth, vec2 coord) {
if (logDepth) {
if (logDepth && !ortho) {
return getWorldPosLog(vec3(coord, depth));
}
float z = depth * 2.0 - 1.0;
Expand Down
4 changes: 3 additions & 1 deletion src/EffectCompositer.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ const EffectCompositer = {
vec3 getWorldPos(float depth, vec2 coord) {
// if (logDepth) {
#ifdef LOGDEPTH
return getWorldPosLog(vec3(coord, depth));
#ifndef ORTHO
return getWorldPosLog(vec3(coord, depth));
#endif
#endif
// }
float z = depth * 2.0 - 1.0;
Expand Down
Loading

0 comments on commit 8dbe33e

Please sign in to comment.