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
marcel
(marwi)
December 21, 2022, 12:00am
3
You do it exactly the same as they do it in the animate method in the sample there
marcel
(marwi)
December 21, 2022, 12:00am
4
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
marcel
(marwi)
December 21, 2022, 12:00am
7
You can do it in onBeforeRender for example
marcel
(marwi)
December 21, 2022, 12:00am
8
Yup it just works the same
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
marcel
(marwi)
December 21, 2022, 12:00am
10
Btw you could also try using a RenderTexture in Unity if that helps
marcel
(marwi)
December 21, 2022, 12:00am
11
Maybe not necessary for this example
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