Skip to content

Commit

Permalink
WebGPURenderer: PostProcessing - Anamorphic example (#789)
Browse files Browse the repository at this point in the history
* WebGPURenderer: PostProcessing - Anamorphic example

* Update three.js

* Add examples

* Delete examples
  • Loading branch information
Methuselah96 authored Jan 26, 2024
1 parent 17cee27 commit fdb9373
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples-testing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ const files = {
// 'webgpu_tsl_transpiler',
'webgpu_video_panorama',
'webgpu_postprocessing_afterimage',
// 'webgpu_postprocessing_anamorphic',
// 'webgpu_mirror',
// 'webgpu_multisampled_renderbuffers',
'webgpu_materials_texture_anisotropy',
Expand Down
2 changes: 2 additions & 0 deletions types/three/examples/jsm/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ export {
hue,
lumaCoeffs,
luminance,
threshold,
ColorAdjustmentMethod,
} from './display/ColorAdjustmentNode.js';
export {
Expand Down Expand Up @@ -327,6 +328,7 @@ export {
} from './display/ViewportDepthNode.js';
export { default as GaussianBlurNode, gaussianBlur } from './display/GaussianBlurNode.js';
export { default as AfterImageNode, afterImage } from './display/AfterImageNode.js';
export { default as AnamorphicNode, anamorphic } from './display/AnamorphicNode.js';

export { default as PassNode, pass, depthPass, PassNodeScope } from './display/PassNode.js';

Expand Down
2 changes: 2 additions & 0 deletions types/three/examples/jsm/nodes/display/AfterImageNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export default class AfterImageNode extends TempNode {

constructor(textureNode: Node, damp?: number);

getTextureNode(): TextureNode;

setSize(width: number, height: number): void;
}

Expand Down
32 changes: 32 additions & 0 deletions types/three/examples/jsm/nodes/display/AnamorphicNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Vector2 } from '../../../../src/Three.js';
import Node from '../core/Node.js';
import TempNode from '../core/TempNode.js';
import TextureNode from '../accessors/TextureNode.js';
import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';

export default class AnamorphicNode extends TempNode {
textureNode: TextureNode;
thresholdNode: Node;
scaleNode: Node;
samples: number;
resolution: Vector2;

constructor(textureNode: TextureNode, thresholdNode: Node, scaleNode: Node, samples: number);

getTextureNode(): TextureNode;

setSize(width: number, height: number): void;
}

export const anamorphic: (
node: TextureNode,
threshold?: NodeRepresentation,
scale?: NodeRepresentation,
samples?: NodeRepresentation,
) => ShaderNodeObject<AnamorphicNode>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
anamorphic: typeof anamorphic;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ export const hue: (
export const lumaCoeffs: ShaderNodeObject<MathNode>;
export const luminance: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;

export const threshold: (color: NodeRepresentation, thershold: NodeRepresentation) => ShaderNodeObject<MathNode>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
saturation: typeof saturation;
vibrance: typeof vibrance;
hue: typeof hue;
threshold: typeof threshold;
}
}
2 changes: 2 additions & 0 deletions types/three/examples/jsm/nodes/display/GaussianBlurNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default class GaussianBlurNode extends TempNode {
constructor(textureNode: TextureNode, sigma?: number);

setSize(width: number, height: number): void;

getTextureNode(): TextureNode;
}

export const gaussianBlur: (node: NodeRepresentation, sigma?: number) => ShaderNodeObject<GaussianBlurNode>;
Expand Down
1 change: 1 addition & 0 deletions types/three/examples/jsm/nodes/display/PassNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ export default class PassNode extends TempNode {
export type PassNodeScope = typeof PassNode.COLOR | typeof PassNode.DEPTH;

export const pass: (scene: Scene, camera: Camera) => ShaderNodeObject<PassNode>;
export const texturePass: (pass: PassNode, texture: Texture) => ShaderNodeObject<PassTextureNode>;
export const depthPass: (scene: Scene, camera: Camera) => ShaderNodeObject<PassNode>;

0 comments on commit fdb9373

Please sign in to comment.