How to modify rendertarget?

Copying from this code sample for some edge foam in water - https://codesandbox.io/s/gojcn?file=/src/index.js:2053-2065

I am wanting to modify the depthtexture of the renderTarget via

? renderTarget.depthTexture
        : renderTarget.texture;

Should I modify the main rendertarget of the this.context… or make my own rendertarget like in the script?

Original Post on Discord

by user 103054507105067008

And how do I modify the current renderTarget used by Needle?

by user 103054507105067008

You do it exactly the same as they do it in the animate method in the sample there :wink:

you too have access to this.context.renderer

Ah okay, just wanted to check as I haven’t messed with the renderTarget before

by user 103054507105067008

Thanks

by user 103054507105067008

You can do it in onBeforeRender for example

Yup it just works the same :slightly_smiling_face:

Ah I see now! Wasn’t sure if I was modifying it there in start but I see the animate part now where they set it so I’ll construct a new WebGLRenderTarget like they do first to set

by user 103054507105067008

Btw you could also try using a RenderTexture in Unity if that helps

Maybe not necessary for this example :slightly_smiling_face:

That’s a good fallback option too

by user 103054507105067008

Wish me luck getting edge foam working, going to try making a realistic looking one

by user 103054507105067008