Skip to content

Commit 64d2829

Browse files
authored
Merge pull request #418 from pmndrs/dev
Version 6.29.1
2 parents 75f7acb + 8945bc4 commit 64d2829

File tree

8 files changed

+213
-195
lines changed

8 files changed

+213
-195
lines changed

esbuild.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ const pkg = require("./package");
1010
const minify = process.argv.includes("-m");
1111
const watch = process.argv.includes("-w");
1212
const plugins = [glsl({ minify }), tsPaths()];
13-
const external = Object.keys(pkg.peerDependencies || {})
14-
.concat(["spatial-controls", "tweakpane"]);
13+
const external = ["three", "spatial-controls", "tweakpane"];
1514

1615
const date = new Date();
1716
const banner = `/**

manual/assets/js/src/demos/ssao.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ window.addEventListener("load", () => load().then((assets) => {
152152
folder.addInput(ssaoMaterial, "minRadiusScale", { min: 0, max: 1, step: 1e-2 });
153153
folder.addInput(ssaoMaterial, "bias", { min: 0, max: 0.5, step: 1e-3 });
154154
folder.addInput(ssaoMaterial, "fade", { min: 0, max: 1, step: 1e-3 });
155-
folder.addInput(effect.ssaoMaterial, "intensity", { min: 0, max: 4, step: 1e-2 });
155+
folder.addInput(effect, "intensity", { min: 0, max: 4, step: 1e-2 });
156156
folder.addInput(effect, "luminanceInfluence", { min: 0, max: 1, step: 1e-2 });
157157
folder.addInput(params, "color", { view: "color" })
158158
.on("change", (e) => effect.color = (e.value === 0) ? null : color.setHex(e.value).convertSRGBToLinear());

manual/content/custom-effects.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ attribute vec3 position;
130130

131131
Available macros:
132132

133-
- If the camera of the associated `EffectPass` is a `PerspectiveCamera`, the macro `PERSPECTIVE_CAMERA` will be defined.
134-
- If the composer uses `HalfFloatType` frame buffers, the macro `FRAMEBUFFER_PRECISION_HIGH` will be defined.
133+
- If the main camera is a `PerspectiveCamera`, the macro `PERSPECTIVE_CAMERA` will be defined.
134+
- If the geometry pass uses a float type color buffer, the macro `FRAMEBUFFER_PRECISION_HIGH` will be defined.
135135

136136
_Effects may define custom uniforms, varyings, functions and preprocessor macros as usual, but should not define global variables or constants._
137137

manual/content/getting-started.en.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ __package.json__
5151

5252
__src/app.js__
5353

54-
```js
54+
```ts
5555
import { RenderPipeline } from "postprocessing";
5656
console.log(RenderPipeline);
5757
```
@@ -62,7 +62,7 @@ Install [node.js](https://nodejs.org) and use the command `npm run build` to gen
6262

6363
Postprocessing extends the common rendering workflow with fullscreen image manipulation tools. The following WebGL attributes should be used for an optimal workflow:
6464

65-
```js
65+
```ts
6666
import { WebGLRenderer } from "three";
6767

6868
const renderer = new WebGLRenderer({
@@ -71,11 +71,12 @@ const renderer = new WebGLRenderer({
7171
stencil: false,
7272
depth: false
7373
});
74+
7475
```
7576

7677
[RenderPipelines]() are used to group passes. Common setups will only require one pipeline that contains a [ClearPass](), a [GeometryPass]() and one or more [EffectPass]() instances. The latter is used to render fullscreen [Effects](). Please refer to the [three.js manual](https://threejs.org/docs/#manual/en/introduction/Creating-a-scene) for more information on how to setup the renderer, scene and camera.
7778

78-
```js
79+
```ts
7980
import {
8081
BloomEffect,
8182
ClearPass,
@@ -84,19 +85,33 @@ import {
8485
RenderPipeline
8586
} from "postprocessing";
8687

87-
const renderer = ...;
88-
const scene = ...;
89-
const camera = ...;
88+
const container = document.querySelector(".viewport");
89+
container.prepend(renderer.domElement);
90+
91+
const scene = new Scene();
92+
const camera = new PerspectiveCamera();
9093

9194
const pipeline = new RenderPipeline(renderer);
9295
pipeline.addPass(new ClearPass());
9396
pipeline.addPass(new GeometryPass(scene, camera, { samples: 4 }));
9497
pipeline.addPass(new EffectPass(new BloomEffect()));
9598

96-
requestAnimationFrame(function render() {
99+
function onResize(): void {
100+
101+
const width = container.clientWidth, height = container.clientHeight;
102+
camera.aspect = width / height;
103+
camera.updateProjectionMatrix();
104+
pipeline.setSize(width, height);
105+
106+
}
107+
108+
window.addEventListener("resize", onResize);
109+
onResize();
110+
111+
requestAnimationFrame(function render(timestamp: number): void {
97112

98113
requestAnimationFrame(render);
99-
pipeline.render();
114+
pipeline.render(timestamp);
100115

101116
});
102117
```
@@ -107,11 +122,12 @@ New applications should follow a [linear workflow](https://docs.unity3d.com/Manu
107122

108123
Postprocessing uses `UnsignedByteType` sRGB frame buffers to store intermediate results due to good hardware support and resource efficiency. This is a compromise because linear results normally require at least 12 bits per color channel to prevent [color degradation and banding](https://blog.demofox.org/2018/03/10/dont-convert-srgb-u8-to-linear-u8/). With low precision sRGB buffers, colors will be clamped to [0.0, 1.0] and information loss will shift to the darker spectrum which leads to noticable banding in dark scenes. Linear, high precision `HalfFloatType` buffers don't have these issues and are the preferred option for HDR-like workflows on desktop devices. You can enable high precision frame buffers like so:
109124

110-
```js
125+
```ts
111126
import { HalfFloatType } from "three";
112127

113-
const pipeline = new RenderPipeline(renderer);
114-
pipeline.bufferManager.frameBufferType = HalfFloatType;
128+
const geoPass = new GeometryPass(scene, camera, {
129+
frameBufferType: HalfFloatType
130+
});
115131
```
116132

117133
See [three's color management manual](https://threejs.org/docs/#manual/en/introduction/Color-management) for more information on the topic.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postprocessing",
3-
"version": "6.29.0",
3+
"version": "6.29.1",
44
"description": "A post processing library that provides the means to implement image filter effects for three.js.",
55
"homepage": "https://github.com/pmndrs/postprocessing",
66
"main": "build/postprocessing.js",
@@ -82,7 +82,7 @@
8282
"extends": "aether"
8383
},
8484
"peerDependencies": {
85-
"three": ">= 0.125.0 < 0.146.0"
85+
"three": ">= 0.125.0 < 0.147.0"
8686
},
8787
"devDependencies": {
8888
"@tweakpane/core": "1.x.x",

0 commit comments

Comments
 (0)