From 2c091ce6e9e759fb063b84c46003703d2008df6e Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 30 Jun 2024 20:48:28 -0300 Subject: [PATCH 01/10] TextureNode: Fix analyze reference --- src/nodes/accessors/TextureNode.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nodes/accessors/TextureNode.js b/src/nodes/accessors/TextureNode.js index cea21bc9335402..d0e3ad2371ef79 100644 --- a/src/nodes/accessors/TextureNode.js +++ b/src/nodes/accessors/TextureNode.js @@ -132,6 +132,7 @@ class TextureNode extends UniformNode { setup( builder ) { const properties = builder.getNodeProperties( this ); + properties.referenceNode = this.referenceNode; // From 87c971ebf62a00a063ae50ec5eb46ca0ccaf9a04 Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 30 Jun 2024 20:48:46 -0300 Subject: [PATCH 02/10] Add RTTNode --- src/nodes/Nodes.js | 1 + src/nodes/utils/RTTNode.js | 106 +++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 src/nodes/utils/RTTNode.js diff --git a/src/nodes/Nodes.js b/src/nodes/Nodes.js index 013cf3c073afb5..1b1fdd2230c978 100644 --- a/src/nodes/Nodes.js +++ b/src/nodes/Nodes.js @@ -70,6 +70,7 @@ export { default as StorageArrayElementNode } from './utils/StorageArrayElementN export { default as TimerNode, timerLocal, timerGlobal, timerDelta, frameId } from './utils/TimerNode.js'; export { default as TriplanarTexturesNode, triplanarTextures, triplanarTexture } from './utils/TriplanarTexturesNode.js'; export { default as ReflectorNode, reflector } from './utils/ReflectorNode.js'; +export { default as RTTNode, rtt } from './utils/RTTNode.js'; // shadernode export * from './shadernode/ShaderNode.js'; diff --git a/src/nodes/utils/RTTNode.js b/src/nodes/utils/RTTNode.js new file mode 100644 index 00000000000000..d2e43fa49a7b0a --- /dev/null +++ b/src/nodes/utils/RTTNode.js @@ -0,0 +1,106 @@ +import { nodeObject, addNodeElement } from '../shadernode/ShaderNode.js'; +import TextureNode from '../accessors/TextureNode.js'; +import { NodeUpdateType } from '../core/constants.js'; +import { addNodeClass } from '../core/Node.js'; +import NodeMaterial from '../materials/NodeMaterial.js'; +import { uv } from '../accessors/UVNode.js'; +import QuadMesh from '../../renderers/common/QuadMesh.js'; + +import { RenderTarget } from '../../core/RenderTarget.js'; +import { Vector2 } from '../../math/Vector2.js'; +import { HalfFloatType } from '../../constants.js'; + +const _quadMesh = new QuadMesh( new NodeMaterial() ); +const _size = new Vector2(); + +class RTTNode extends TextureNode { + + constructor( node, width = null, height = null, options = { type: HalfFloatType } ) { + + const renderTarget = new RenderTarget( width, height, options ); + + super( renderTarget.texture, uv() ); + + this.node = node; + this.width = width; + this.height = height; + + this.renderTarget = renderTarget; + + this.textureNeedsUpdate = true; + this.autoUpdate = true; + + this.updateMap = new WeakMap(); + + this.updateBeforeType = NodeUpdateType.RENDER; + + } + + get autoSize() { + + return this.width === null; + + } + + setSize( width, height ) { + + this.width = width; + this.height = height; + + this.renderTarget.setSize( width, height ); + + this.textureNeedsUpdate = true; + + } + + updateBefore( { renderer } ) { + + if ( this.textureNeedsUpdate === false && this.autoUpdate === false ) return; + + this.textureNeedsUpdate = false; + + // + + if ( this.autoSize === true ) { + + const size = renderer.getSize( _size ); + + this.setSize( size.width, size.height ); + + } + + // + + _quadMesh.material.fragmentNode = this.node; + + // + + const currentRenderTarget = renderer.getRenderTarget(); + + renderer.setRenderTarget( this.renderTarget ); + + _quadMesh.render( renderer ); + + renderer.setRenderTarget( currentRenderTarget ); + + } + + clone() { + + const newNode = new TextureNode( this.value, this.uvNode, this.levelNode ); + newNode.sampler = this.sampler; + newNode.referenceNode = this; + + return newNode; + + } + +} + +export default RTTNode; + +export const rtt = ( node, ...params ) => nodeObject( new RTTNode( nodeObject( node ), ...params ) ); + +addNodeElement( 'toTexture', ( node, ...params ) => node.isTextureNode ? node : rtt( node, ...params ) ); + +addNodeClass( 'RTTNode', RTTNode ); From f2cef2cc3ddbe29a25d7c9ea4318a4f6822bc591 Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 30 Jun 2024 20:49:41 -0300 Subject: [PATCH 03/10] rgbShift: add `.toTexture()` and updated example --- examples/webgpu_postprocessing.html | 2 +- src/nodes/display/RGBShiftNode.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/webgpu_postprocessing.html b/examples/webgpu_postprocessing.html index 29d97a8c9534e3..54164946a16681 100644 --- a/examples/webgpu_postprocessing.html +++ b/examples/webgpu_postprocessing.html @@ -76,7 +76,7 @@ const dotScreenPass = scenePassColor.dotScreen(); dotScreenPass.scale.value = 0.3; - const rgbShiftPass = dotScreenPass.getTextureNode().rgbShift(); + const rgbShiftPass = dotScreenPass.rgbShift(); rgbShiftPass.amount.value = 0.001; postProcessing.outputNode = rgbShiftPass; diff --git a/src/nodes/display/RGBShiftNode.js b/src/nodes/display/RGBShiftNode.js index f8d33b79b0ec4e..e262a942567a92 100644 --- a/src/nodes/display/RGBShiftNode.js +++ b/src/nodes/display/RGBShiftNode.js @@ -41,7 +41,7 @@ class RGBShiftNode extends TempNode { } -export const rgbShift = ( node, amount, angle ) => nodeObject( new RGBShiftNode( nodeObject( node ), amount, angle ) ); +export const rgbShift = ( node, amount, angle ) => nodeObject( new RGBShiftNode( nodeObject( node ).toTexture(), amount, angle ) ); addNodeElement( 'rgbShift', rgbShift ); From 30c29c3c32e121bb01b57f040519fa9436fc8dbc Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 30 Jun 2024 20:50:02 -0300 Subject: [PATCH 04/10] Update GaussianBlurNode.js --- src/nodes/display/GaussianBlurNode.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nodes/display/GaussianBlurNode.js b/src/nodes/display/GaussianBlurNode.js index 9cef10e605746c..cd4f28e69c0016 100644 --- a/src/nodes/display/GaussianBlurNode.js +++ b/src/nodes/display/GaussianBlurNode.js @@ -18,15 +18,14 @@ const quadMesh2 = new QuadMesh(); class GaussianBlurNode extends TempNode { - constructor( textureNode, sigma = 2 ) { + constructor( textureNode, directionNode = null, sigma = 2 ) { super( 'vec4' ); this.textureNode = textureNode; + this.directionNode = directionNode; this.sigma = sigma; - this.directionNode = vec2( 1 ); - this._invSize = uniform( new Vector2() ); this._passDirection = uniform( new Vector2() ); @@ -119,8 +118,9 @@ class GaussianBlurNode extends TempNode { // const uvNode = textureNode.uvNode || uv(); + const directionNode = vec2( this.directionNode || 1 ); - const sampleTexture = ( uv ) => textureNode.cache().context( { getUV: () => uv, forceUVContext: true } ); + const sampleTexture = ( uv ) => textureNode.uv( uv ); const blur = tslFn( () => { @@ -128,7 +128,7 @@ class GaussianBlurNode extends TempNode { const gaussianCoefficients = this._getCoefficients( kernelSize ); const invSize = this._invSize; - const direction = vec2( this.directionNode ).mul( this._passDirection ); + const direction = directionNode.mul( this._passDirection ); const weightSum = float( gaussianCoefficients[ 0 ] ).toVar(); const diffuseSum = vec4( sampleTexture( uvNode ).mul( weightSum ) ).toVar(); @@ -184,7 +184,7 @@ class GaussianBlurNode extends TempNode { } -export const gaussianBlur = ( node, sigma ) => nodeObject( new GaussianBlurNode( nodeObject( node ), sigma ) ); +export const gaussianBlur = ( node, directionNode, sigma ) => nodeObject( new GaussianBlurNode( nodeObject( node ), directionNode, sigma ) ); addNodeElement( 'gaussianBlur', gaussianBlur ); From 19a372f0baf8fab22b92a1226c31ee3e343a0db7 Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 30 Jun 2024 20:51:42 -0300 Subject: [PATCH 05/10] add procedural texture --- examples/files.json | 1 + .../screenshots/webgpu_procedural_texture.jpg | Bin 0 -> 10518 bytes examples/webgpu_procedural_texture.html | 109 ++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 examples/screenshots/webgpu_procedural_texture.jpg create mode 100644 examples/webgpu_procedural_texture.html diff --git a/examples/files.json b/examples/files.json index 05e59b06a927a0..ada08df9ad6529 100644 --- a/examples/files.json +++ b/examples/files.json @@ -372,6 +372,7 @@ "webgpu_postprocessing_dof", "webgpu_postprocessing_sobel", "webgpu_postprocessing", + "webgpu_procedural_texture", "webgpu_reflection", "webgpu_refraction", "webgpu_rtt", diff --git a/examples/screenshots/webgpu_procedural_texture.jpg b/examples/screenshots/webgpu_procedural_texture.jpg new file mode 100644 index 0000000000000000000000000000000000000000..69bd3d57f1c09a21e82b78706b02aaf8df5357f7 GIT binary patch literal 10518 zcmeHtdpJ~W+xIobn2=rB#myutrBbOxvTQ=-5$)8?or%gOF_nrkS%V6Zp^fe~w;>4? z$|e<=>}g|D*_RncB@NBkjFp*L^Im$sRX++I0FI!00R62vR-fw$Ps3)nNe=$k|)lLBzbwFyaGu<;n#<(I7@-7NLEmo zr94YfY373e%~n>LJ@ez=kI9jUM3NF&f&ANn1yEp5DSmi%pj-U9)zb<$5b?$4ySoE}OS(-MMSG=bpX4 zdmT7<$Uh)3=y2GHlc&NXPM?WAcm6_Le8R=cSFT=5yZ+~mn|HGAX5Y)n&AVSzTvGa^ z?CG=T)it$s^$m?puim}?(B9G6)!oxSz#IJhL#H45n`#DVj#D9we$Nx(n zC^$iGM(5-ic?fdh@I%y)CmF3$m}9@4?0anPg4NNpG#yeiA6F?FTkH^M`5kXl(l%Ms zzfd?M(l3er-vo;JTN3@ZK>sa|tOv{{65xgrH2?x|bO>a~F_eJmf4=^sg8v;Wu)U2r z%7FYK8HmY}(6OK_`T@*JtQqmX)>cQT@@IM5$$Z-$W0j94DF%uuza2FEluOLKh0oHL z0a9|=`5YFmILVvbwBz?ncWnqV5MoOF%1lO!uQyP-v+9;`3z-y^ljh39MMftce`wqN zDmEr!@v{uou&VUgLibukvpd49%GzW)?LqF_&wIOifloly2Iokw9+*aJWI*7+!pztg zCvr>Ks(6**hVqgdVVXiOr_#8xAEt73Qxf$(xU$;4o-HT}MZkp<9<}9nQ}d0gnbgUv zgmG#eJC>?xOT?OKaV%XMt;mevQ^L4gZfp+|ClkhI`Kg^hJ>-$uQQCAz>@8297AFJB z^u^)%-}l@QulVa=M$;l|?i^F%w@ViIEK4YFY{wDf4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-fN5Onw2J3gIpk zp+#l28$-W0_{OV-Sas=b}xLk7$<(I@Fn=HWvo39WY@|M-cJq)#%VY z*pi2N^7PCx+Z~93Vc~0Jr&DQxHm&YJzQ4^SVlb`6w7}Cld-{QixL-}HHnd8C{n@C8 zERD&58TS!H^=5)jeA7lVyy88ix?H>)Qqbr?zjw1!Gt>rZa3y1SME6*zgV%h8r*_%k zYzV|O&G77y3SqgmnpF1#K^hbhiQ9RilYCaA2f2wQprSt=X(Ngq+uI#L|N@6O%qLs9|G>QXgItc(B~)NnuMQ0 z;)tl8N>gct?YbsmSzV>#qt?*7rRui~touJFsl4faJucZrXpDMGF_=WVvv@vn!Uqnm zA*CDg=bTD2GkZ4A`06#Ym_4Z-48%(UWhZCj@B2uC{G9Xoh+iS0#o(^5_U|_KXOz#{ zL2pV#xszy5Y+a?nbHPXh-<@l^V|c-(1rae5*IMp5fv9a!9qf|yXJRkO@pf2tC)Rl0 zbn1Ih{N{1dwe>x<;WA`-FB98+ag3XirbOqPa%EAvF5oDj2{P^w2ywswt zVG>F{hjxSFptw*tA-8~6yXO(&#=+?iF-XY@iongb63C9Y6)Eocxs!AGrJaP|j( zAJ=v7C~xU|r^3GC70&CSX$}T7powRgaG0K|8}Z&8Q~lMa($eDhUaN!gBgzc#%j + + three.js webgpu - procedural texture + + + + + + +
+ three.js webgpu - procedural texture +
+ + + + + + From 00ea1f726c2a29c965b2c5a5bee999743cd6eb37 Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 30 Jun 2024 20:51:49 -0300 Subject: [PATCH 06/10] Update AnamorphicNode.js --- src/nodes/display/AnamorphicNode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nodes/display/AnamorphicNode.js b/src/nodes/display/AnamorphicNode.js index 2a59a4672058ac..333a6ff254f8dc 100644 --- a/src/nodes/display/AnamorphicNode.js +++ b/src/nodes/display/AnamorphicNode.js @@ -99,7 +99,7 @@ class AnamorphicNode extends TempNode { const uvNode = textureNode.uvNode || uv(); - const sampleTexture = ( uv ) => textureNode.cache().context( { getUV: () => uv, forceUVContext: true } ); + const sampleTexture = ( uv ) => textureNode.uv( uv ); const anamorph = tslFn( () => { @@ -142,7 +142,7 @@ class AnamorphicNode extends TempNode { } -export const anamorphic = ( node, threshold = .9, scale = 3, samples = 32 ) => nodeObject( new AnamorphicNode( nodeObject( node ), nodeObject( threshold ), nodeObject( scale ), samples ) ); +export const anamorphic = ( node, threshold = .9, scale = 3, samples = 32 ) => nodeObject( new AnamorphicNode( nodeObject( node ).toTexture(), nodeObject( threshold ), nodeObject( scale ), samples ) ); addNodeElement( 'anamorphic', anamorphic ); From b4a07d3a731345278fe0ab9394a541570c0c42ce Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 30 Jun 2024 20:53:34 -0300 Subject: [PATCH 07/10] update imports --- examples/webgpu_procedural_texture.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/webgpu_procedural_texture.html b/examples/webgpu_procedural_texture.html index 6fc71772ce16c1..c91fed1dbc4a0b 100644 --- a/examples/webgpu_procedural_texture.html +++ b/examples/webgpu_procedural_texture.html @@ -14,8 +14,8 @@