The PingPongPlane class is used to create a plane and two associated render targets that will be swapped at each draw call. This method is called FBO swapping or FBO ping pong and is often used to create fluids or flowmaps effects.
The PingPongPlane class extends the Plane class, inheriting from all its methods and properties.
To create a new PingPongPlane, just use its constructor.
Since they inherit from the Plane class, parameters are almost the same. There's an additional parameter that allows you to set the PingPongPlane's texture sampler name that you will read in your fragment shader to apply your effect. If ommited, it will use "uPingPongTexture" as sampler name.
Note that the ping pong planes are rendered onto render targets so you will have to create another plane to display the result of your effect.
Have a look at the Ping pong shading flowmap example to see it live.
PingPongPlanes use the same parameters as the usual Planes. Note however that it will set the depthTest and autoloadSources to false.
You can also pass a sampler name as an additional parameter:
- sampler string, optional the texture sampler name you'll use in your fragment shader to create your effect. Default to "uPingPongTexture".
PingPongPlanes also have the same properties as the usual Planes. Their two render targets are also availables as additional properties:
readPass (RenderTarget class object): v7.0
Render target read pass that will be swapped with the write pass at each draw call. Its depth and clear properties are set to false.
writePass (RenderTarget class object): v7.0
Render target write pass that will be swapped with the read pass at each draw call. Its depth and clear properties are set to false.
Returns the ping pong plane texture to be used later.
returns: the ping pong plane texture.