The compositing graph is a system for automating and simplifying multipass rendering. A compositing node is an object that sates which shader program should be used durring, what texture variables it may set, and defines a function which contains the drawing code.

The texture properties of a compositing node may be either a URI string denoting an image file, or it can be another compositing node instance. In the later case, a texture will be generated automatically by rendering the child node to a texture before rendering the parent.

The compositing graph is able to solve the correct order in which nodes should be drawn, and so drawing a scene is a singular function call:



please.RenderNode (shader_program)

This constructor function creates a compositing node. The ‘shader_program’ argument is either the name of a compiled shader program or a shader program object. RenderNodes have the following properties and methods:

  • shader the shader object contains animatable bindings for all uniform variables defined by the provided shader. Sampler variables may be set as a URI string or another RenderNode object.
  • graph if this property is set to a graph node, the default render method will automatically draw this graph node.
  • peek may be null or a function that returns a graph node. This may be used to say that another render node should be rendered instead of this one.
  • render by default is a function that will call please.gl.splat if the graph property is null or will otherwise call graph.draw(). This function may be overridden to support custom drawing logic.


please.set_viewport (render_node)

Designate a particular RenderNode to be the rendering output. You can pass null to disable this mechanism if you want to override m.grl’s rendering management system, which you probably don’t want to do.


please.render (node)

Renders the compositing tree.


please.indirect_render (node)

Renders the compositing tree, always into indirect buffers. Nothing is drawn on screen by this function.


please.TransitionEffect (shader_program)

TransitionEffect nodes are RenderNodes with some different defaults. They are used to blend between two different RenderNodes.

TransitionEffects differ from RenderNodes in the following ways:

  • assumes the shader defines a float uniform named “progress”
  • assumes the shader defines a sampler uniform named “texture_a”
  • assumes the shader defines a sampler uniform named “texture_b”
  • the render method always calls please.gl.splat()
  • the peek method is defined so as to return one of the textures if shader.progress is either 0.0 or 1.0.

TransitionEffect nodes also define the following:

  • reset_to(texture) sets shader.texture_a to texture and shader.progress to 0.0.
  • blend_to(texture, time) sets shader.texture_b to texture, and shader.progress to a driver that blends from 0.0 to 1.0 over the provide number of miliseconds.
  • blend_between(texture_a, texture_b, time) shorthand method for the above two functions.

Table Of Contents

Previous topic


Next topic


This Page