jit.gl.pass Reference

Render scene passes with shader processing

jit.gl.pass

Description

The jit.gl.pass object encapsulates processing of one or more sub-passes. A sub-pass consists of a single frame of gl, and post-processing shader, and is defined in a xml pass description file (JXP). Complex scene-processing hierarchies can be obtained by chaining multiple jit.gl.pass objects.

Examples

Render scene passes with shader processing

Discussion

Each JXP file contains one or more <pass> effects. Each pass-effect contains one or more <subpass> tags. The <subpass> specifies a shader file for processing its pass, using the "file" attribute, or a jit.gl.pix gen file using the "gen" attribute and contains one or more <input> tags. Certain attributes of jit.gl.slab or jit.gl.pix can also be set here (e.g. dimscale, rect). The subpass can also contain a "name" attribute, allowing it to be referred to as an input for other subpasses. The number of input and output textures processed by the subpass can be specified by "inputs" and "outputs" attributes.

The input specifies its texture source by setting either "name", "source", or "subpass". Name can be any named texture, subpass can be any named subpass, and source can be one of the following:
COLOR - the jit.gl.node color render target (or color output of previous jit.gl.pass)
NORMALS - the jit.gl.node normals render target + depth in alpha channel
VELOCITY - the jit.gl.node velocity render target
PREVIOUS - the preceding subpass output
HISTORY - the previous jit.gl.pass output
TEXTURE0..N - the jit.gl.pass texture attribute list of texture names
SUBPASS0..N - any subpass output of the current jit.gl.pass
Texture and subpass indexing starts at 0, so SUBPASS0 refers to the first subpass output, SUBPASS1 the second and so on.

The output index of a multi-output subpass input type is specified using an "output" attribute and 0-based indexing. The previous frame of supass input types can be requested using the history keyword and setting it to 1. For example to set second output of the previous frame as the input.

;<input subpass="mysubpass" output="1" history="1" />
Both "output" and "history" only work on "subpass" type inputs.

Pass effects that request NORMALS or VELOCITY as input sources require jit.gl.material or jit.gl.pbr objects bound to any geometry objects in the scene. These effects include depth , dof , motionblur , and ssao .

For an example of creating custom pass effects, see the pass.custom.effects example patch.

Read in JXP files by their pass name using @fxname. This is not the same as the filename, and is determined by the pass name in the JXP file. Below are included <pass> effects linking to corresponding examples :

atmospheric - Atmospheric scattering and ground fog
bloom - Produce atmospheric light extending along the borders of bright areas
depth - Depth Blending effect
fxaa - Fast approximate anti aliasing
gamma - Tone mapping, gamma correction and dithering noise pass
motionblur - Blur effect based on pixel velocity
motionglitch - Data mosh type glitch effects
smear example - Pixel smearing effect
ssao - Screen-space ambient occlusion
ssr - Screen-space reflection approximation
tonemap - Modify tonal value of pixels
tssao-gi - Temporal screen-space ambient occlusion with global illumination
tssao-gi-ssr - Temporal screen-space ambient occlusion with global illumination and screen-space reflections

Attributes

child [symbol]

The child jit.gl.pass name (default = none). Set automatically by patchcord connection, and manually by providing a valid jit.gl.pass object name.

depth_drawto [symbol]

g/s(get)

Depth drawto gl context name. Unless set by user, depth_drawto equals drawto

file [symbol]

JXP file name (default = none)

out_name [symbol]

g/s(get)

Output texture name (default = UID). If there is a name collison then the UID will be appended to the name that is in conflict.

quality [symbol]

Internal texture quality (deault = med). Changeing quality changes the type attribute of internal jit.gl.texture objects. Possible values:

'lo' ( type = char )
'med' ( type = float16 )
'hi' ( type = float32 )

Common Box Attributes

annotation [symbol]

Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.

background [int] (default: 0)

Adds or removes the object from the patcher's background layer. background 1 adds the object to the background layer, background 0 removes it. Objects in the background layer are shown behind all objects in the default foreground layer.

color [4 floats]

Sets the color for the object box outline.

fontface [int]

Sets the type style used by the object. The options are:

plain
bold
italic
bold italic Possible values:

0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'

fontname [symbol]

Sets the object's font.

fontsize [float]

Sets the object's font size (in points). Possible values:

'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'

hidden [int] (default: 0)

Toggles whether an object is hidden when the patcher is locked.

hint [symbol]

Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.

ignoreclick [int] (default: 0)

Toggles whether an object ignores mouse clicks in a locked patcher.

jspainterfile [symbol]

JS Painter File

patching_rect [4 floats] (default: 0. 0. 100. 0.)

Sets the position and size of the object in the patcher window.

position [2 floats]

g/s(set)

Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.

presentation [int] (default: 0)

Sets whether an object belongs to the patcher's presentation.

presentation_rect [4 floats] (default: 0. 0. 0. 0.)

Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.

rect [4 floats]

g/s(set)

Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).

size [2 floats]

g/s(set)

Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.

textcolor [4 floats]

Sets the color for the object's text in RGBA format.

textjustification [int]

Sets the justification for the object's text. Possible values:

0 = 'left'
1 = 'center'
2 = 'right'

varname [symbol]

Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.

OB3D Attributes

automatic [int]

Automatic rendering flag (default = 1) When the flag is set, rendering occurs when the associated jit.gl.render object receives a bang message

capture [symbol]

The name of a texture to be rendered to - e.g. jit.gl.nurbs @capture mytex will capture to jit.gl.texture @name mytex.

drawto [symbol]

The named drawing context in which to draw (default = none) A named drawing context is a named instance of a jit.window, jit.pwindow, or jit.matrix object that has an instance of the jit.gl.render object associated with it.

enable [int]

Enable flag (default = 1) When the flag is set, drawing is enabled.

layer [int]

Object layer number (default = 0) When in automatic mode, the layer number determines the rendering order (low to high). Objects in the same layer have no guarantee which will be rendered first.

name [symbol]

The instance name (default = UID)

tex_map [int]

Mode for automatic generation of texture coordinate controls (default = 0)
0 = no coordinates are generated.
1 = OpenGL's texture generation is used with mode GL_OBJECT_LINEAR. This applies the texture in a fixed orientation relative to the object.
2 = OpenGL's texture generation is used with mode GL_SPHERE_MAP. This can be used to create a reflection effect.
3 = OpenGL's texture generation is used with mode GL_EYE_LINEAR. This applies the texture in a fixed orientation relative to OpenGL's eye coordinates.
Modes 1 and 3 are affected by the value of the tex_plane_s and tex_plane_t attributes listed below.

tex_plane_s [4 floats]

The texture generation coefficients a b c d that apply to tex_map modes 1 and 3. (default = 1. 0. 0. 0.)
The four coefficients define a plane used to generate the s texture coordinate, which corresponds to the x axis of the texture image. If the tex_map mode is 1, s = ax + by + cz + dw, where x, y, z, and w are the homogeneous coordinates of the vertex.

tex_plane_t [4 floats]

The texture generation coefficients a b c d, which apply to tex_map modes 1 and 3. (default = 0. 1. 0. 0)
The four coefficients define a plane which is used to generate the t texture coordinate, which corresponds to the y axis of the texture image.

shader [symbol]

The name of the shader to be applied (default = none)

texture [8 symbols]

The name of the texture to be applied (default = none). If multiple textures are specified, uses multi-texturing.

Messages

anything

Get and set dynamic attributes generated from sub-pass shader parameters.

(drag)

Drag and drop a .jxp file

(mouse)

Open the JXP file

open

Open the JXP file

param

Sets the given shader parameter with the given atom values as defined in a JXS (Jitter shader) file.

read

Load a JXP file from disk

OB3D Messages

bang

Equivalent to the draw message.

draw

Draws the object in the named drawing destination. If the matrixoutput attribute is supported and set to 1, the geometry matrices are sent out the object's left outlet.

drawraw

Equivalent to draw with the inherit_all attribute set to 1.

drawimmediate

Equivalent to draw but ignoring any potential renderer setup

jit_gl_texture

Arguments

texture-name [symbol]
Binds the texture specified by texture-name to this object. Equivalent to setting the texture attribute to texture-name .

get_shader

Open an editor window containing the object's current JXS shader.

See Also

Name Description
Working with OpenGL Working with OpenGL
jit.gl.node Create hierarchical rendering groups
jit.gl.slab Process texture data
jit.gl.pix Generates pixel processing shaders from a gen patcher
jit.gl.shader Manage a GL shader
jit.gl.camera Set a rendering view
jit.gl.light Place a light source in a 3D scene
External Text Editor External Text Editor