jit.gl.pbr Reference

Generate physically based rendering materials for 3D objects

jit.gl.pbr

Description

Produces shaders for physically based rendering ( PBR ) that automatically adapt to texture inputs and the number of active lights. Image based lighting ( IBL ) effects are facilitated via the environment_texture input.

Discussion

This object requires one argument: the name of a drawing context. 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. Additionally it can reference the name of a jit.gl.node sub-context. This value may also be set via the OB3D drawto attribute. If no argument is present, the object is implicitly added to the first valid drawing context or sub-context found in the current patch or by searching up the patcher hierarchy.

Attributes

drawto [symbol]

Render context or sub-context name

gamma_correction [int]

Enable gamma corrections (default = 1). Enabling will convert the rendered output from linear color space to non-linear sRGB color space. Users should leave enabled unless applying gamma correction at a later stage in the pipeline, e.g. via jit.gl.pass.

height_scale [float]

Height scaling factor when parallax enabled (default = 1)

metalness [float]

Determines the metallic value in the material calculation (default = 0.). Fully metallic materials leave only reflected or specular light and show no diffuse (albedo) colors. If a metallic_texture map is sent then metalness should be set to 1 for expected output.

name [symbol]

The instance name (default = UID)

override [int]

Override jit.gl object color material attributes

parallax [int]

Enable parallax height mapping (default = 0). Requires a height map image sent to the heightmap_texture input. When enabled both normals and ambient occlusion maps are ignored and tex_gen mode is disabled.

parallax_shadowing [2 floats]

Parallax heightmap shadowing values (default = 0.3 0.1). The first value sets the amount of self-shadowing (when self_shadow is enabled) and the second value sets the amount of ambient occlusion shadowing.

reflection [int]

Enable reflections from the environment map (default = 1). When enabled a specular reflections map is generated from the environment map input and the shader will use specular reflection calculations when rendering.

roughness [float]

Determines the microsurface's roughness in the bidirectional reflective distribution function ( BRDF ) (default = 0.3). Perfectly smooth surfaces have a roughness of 0. If a roughness_texture map is sent then roughness should be set to 1 for expected output.

self_shadow [int]

Enables self shadowing when parallax enabled (default = 0).

shadow_eps [float]7.0.0

Shadow epsilon (eps) modifies the shape of shadows, and corrects self-shadowing error (default = 0.2). This value is used when the bound object is a shadow-receiver.

shadow_hard [float]7.0.0

Adjust shadow hardness (default = 0.7). This value is used when the bound object is a shadow-receiver.

shadow_radius [float]7.0.0

Adjust shadow blur radius (default = 0.3). This value is used when the bound object is a shadow-receiver.

shadow_soft [float]7.0.0

Adjust shadow softness (default = 0.3). Overwrites shadow_radius and shadow_hard attributes. This value is used when the bound object is a shadow-receiver.

tex_gen [symbol]

Texture coordinate generation mode (default = "none"). When enabled texture coordinates are generated from world space projections of two planes (biplanar) or three planes (triplanar).

Possible values:

'none' ( No generation )
'biplanar' ( Generate from two planes of projection )
'triplanar' ( Generate from three planes of projection )

tex_repeat [2 floats]

Horizontal and vertical multipliers of texture coordinates (default = 1 1). Values greater than 1 cause repetitions when texture mapping. The attribute effects both tex_gen mode none and triplanar .

triplanar_blend [float]

The triplanar blending amount adjusts the fade between planar projections when tex_gen mode is triplanar (default = 0.7).

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

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.

mat_ambient [4 floats]

The ambient light material property in the form red green blue alpha (default = 0. 0. 0. 0.) The list elements should be in the range 0.-1.

mat_diffuse [4 floats]

The diffuse light material property in the form red green blue alpha (default = 0. 0. 0. 0.) The list elements should be in the range 0.-1.

mat_emission [4 floats]

The material emission property in the form red green blue alpha (default = 0. 0. 0. 0.) The list elements should be in the range 0.-1.

mat_specular [4 floats]

The specular light material property in the form red green blue alpha (default = 0. 0. 0. 0.) The list elements should be in the range 0.-1.

shininess [float]

The material shininess value (default = 16.0) The value should be a float in the range 0.-255.

Messages

albedo_texture

Sets the texture to use for the albedo map. The albedo texture, like a standard diffuse texture, sets the base color for rendering (or the base reflectivity if the textured object is metallic). Unlike a standard diffuse texture, albedo textures in PBR rendering typically have no directional lighting or ambient occlusion.

ambient_texture

Sets the texture to use for the ambient occlusion map. Ambient occlusion textures are used to add additional detail to shadowy parts of a surface and are optional.

clear

Sending the clear message to jit.gl.pbr will clear the image map at the corresponding input.

emission_texture

Sets the texture to use for the emission map. The emission map determines the color of light that is emitted by the object surface. In the final rendered image, the emissive lighting (emission_texture * mat_emission) color is added to the calculated lighting color.

environment_texture

Sets the texture to use for the environment map. The environment map is used for calculating reflections using Image based lighting ( IBL ) effects. These are usually .env files and the same texture is read into a jit.gl.cubemap rendered via jit.gl.skybox, however, any texture can be used.

get_gl3_shader

Unsupported

getparamdefault

Arguments

name [symbol]
Get parameter default value

getparamlist

Get list of parameter names

getparamtype

Arguments

name [symbol]
Get parameter type

getparamval

Arguments

name [symbol]
Get the parameter value

heightmap_texture

Set the texture to use for the heightmap. The heightmap stores the height data for an object. Each pixel stores a height value that represents the height distance perpendicular to the face of the object surface.

metallic_texture

Sets the texture to use for the metallic map. Metallic textures determine the reflectivity of the textured object and support grayscale maps, where 0 represents no metalness (no reflective light color is added to the albedo) and 1 full metalness (only reflective light is displayed). The metallic_texture is multiplied by the metalness attribute to calculate final reflectivity.

normals_texture

Sets the texture to use for the normals map. The normals map determines the angles of reflection for the mapped object's surface to be used when calculating lighting.

param

Arguments

name [symbol]
values [list]
Set pbr material parameter value

roughness_texture

Sets the texture to use for the roughness map. The roughness affects the quality of reflections on a surface. Low roughness results in crisp and clear reflections, while higher roughness diffuses them, resulting in wider and blurrier reflections. Overall roughness is determined by multiplying the roughness roughness attribute by the roughness texture.

OB3D Messages

bang

Equivalent to the draw message.

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 .

See Also

Name Description
jit.gl.material Generate materials for 3D objects
jit.gl.shader Manage a GL shader
jit.gl.texture Create OpenGL textures
jit.gl.cubemap Manage a cubemap texture target
jit.gl.mesh Generate GL geometry from matrices