Mogwai Scripting Reference

October 20, 2023 ยท View on GitHub

Index | Usage | Scripting


Note: This document is not updated and does not reflect the current state of the Python API anymore.

Mogwai Scripting Reference

Sample API

Global functions

FunctionDescription
loadRenderPassLibrary(name)Load a render pass library.
createPass(name, dict)Create a new render pass with configuration options in dict.
renderFrame()Render a frame. If the clock is not paused, it will advance by one tick.
setWindowPos(x, y)Set the window's position in pixels.
resizeFrameBuffer(width, height)Resize the main frame buffer.
resizeSwapChain(width, height)Resize the window/swapchain. DEPRECATED: Use resizeFrameBuffer instead.
exit(errorCode=0)Terminate the application with the given error code.

Mogwai API

Global functions

FunctionDescription
help()Print global help.
help(object)Print help of a specific object.

Global variables

VariableDescription
mInstance of Renderer.
tInstance of Clock. DEPRECATED: Use m.clock instead.
fcInstance of FrameCapture. DEPRECATED: Use m.frameCapture instead.
vcInstance of VideoCapture. DEPRECATED: Use m.videoCapture instead.
tcInstance of TimingCapture. DEPRECATED: Use m.timingCapture instead.

Renderer

class falcor.Renderer

PropertyTypeDescription
sceneSceneActive scene (readonly).
activeGraphRenderGraphActive render graph (readonly).
uiboolShow/hide the UI.
clockClockClock.
profilerProfilerProfiler.
frameCaptureFrameCaptureFrame capture.
videoCaptureVideoCaptureVideo capture.
timingCaptureTimingCaptureTiming capture.
MethodDescription
script(path)Run a script.
loadScene(path, buildFlags=SceneBuilderFlags.Default)Load a scene. See available build flags below.
unloadScene()Explicitly unload the scene to free memory.
saveConfig(path)Save the current state to a config file.
addGraph(graph)Add a render graph.
removeGraph(graph)Remove a render graph. graph can be a render graph or a name.
getGraph(name)Get a render graph by name.
resizeFrameBuffer(width, height)Resize the main frame buffer.
resizeSwapChain(width, height)Resize the window/swapchain. DEPRECATED: Use resizeFrameBuffer instead.

Clock

class falcor.Clock

PropertyTypeDescription
timefloatCurrent time in seconds.
frameintCurrent frame number.
framerateintFrame rate in frames per second.
timeScalefloatTime scale factor.
exitTimefloatTime in seconds at which to terminate the application. Set to 0 to disable.
exitFrameintFrame at which to terminate the application. Set to 0 to disable.
MethodDescription
pause()Pause the clock.
play()Resume the clock.
stop()Stop the clock (pause and reset).
step(frames=1)Step forward or backward in time.

Profiler

class falcor.Profiler

PropertyTypeDescription
enabledboolEnable/disable profiler.
pausedboolPause/resume profiler.
isCapturingboolTrue if profiler is capturing (readonly).
eventsdictProfiler events (readonly).
MethodDescription
startCapture()Start capturing.
endCapture()End capturing. Returns the capture data.
Profiler event names

Profiler event names are expressed as paths due to their hierarchical nature. For example, /present is a top level event corresponding to the time it takes to present the final image, whereas /onFrameRender/RenderGraphExe::execute() is a nested event corresponding to the time it takes to execute the render graph. Because profiler events measure both CPU and GPU time, the paths are extended with either /gpuTime or /cpuTime to uniquely identify the actual measured quantity. As an example, /present/gpuTime refers to the GPU time it takes to present the final image.

Accessing profiler data

Profiler event data can be accessed through m.profiler.events. This returns a dictionary containing all event data of the last frame using the event name as a key. Each item itself is a dictionary containing the following keys/values:

KeyValue
nameThe name of the event (same as the key to access this item).
valueLast measured value in ms.
averageExponential moving average in ms.
statsDictionary containing stats from up to the last 512 frames.

The stats dictionary contains the following keys/values:

KeyValue
meanThe mean value in ms.
stdDevThe standard deviation in ms.
minThe minimum value in ms.
maxThe maximum value in ms.

To get the current present GPU time you can use m.profiler.events["/present/gpuTime"]["value"]. To get the mean from the last 512 frames you can use m.profiler.events["/present/"gpuTime"]["stats"]["mean"].

Capturing profiler data

To capture profiler data from multiple frames, a separate capturing API can be used. A profile capture is started using m.profiler.startCapture(). Profile data is internally captured until a call to m.profiler.endCapture(), which will return a dictionary with all the captured data.

The capture dictionary contains the following keys/values:

KeyValue
frameCountTotal number of frames captured.
eventsDictionary containing the captured event data.

The events dictionary uses event names as keys. Each item itself is a dictionary containing the following keys/values:

KeyValue
nameThe name of the event (same as the key to access this item).
recordsArray containing the raw per frame data in ms.
statsDictionary containing stats from the raw frame data.

The stats dictionary has the same structure as explained above but is computed over the captured data instead of the last 512 frames.

The following snippet shows how to capture profiling data over 256 frames and print the mean GPU frame render time:

m.profiler.enabled = True
m.profiler.startCapture()
for frame in range(256):
    m.renderFrame()
capture = m.profiler.endCapture()
m.profiler.enabled = False

meanFrameTime = capture["events"]["/onFrameRender/gpuTime"]["stats"]["mean"]
print(f"Mean frame time: {}", meanFrameTime)

FrameCapture

The frame capture will always dump the marked graph output. You can use graph.markOutput() and graph.unmarkOutput() to control which outputs to dump.

The frame counter starts at zero in Falcor (it starts by default at one in Maya, so the frame numbers may be offset by one frame).

By default, the captures frames are stored to the executable directory. This can be changed by setting outputDir.

Note: The frame counter is not advanced when time is paused. If you capture with time paused, the captured frame will be overwritten for every rendered frame. The workaround is to change the base filename between captures with fc.capture(), see example below.

class falcor.FrameCapture

PropertyTypeDescription
outputDirstrCapture output directory.
baseFilenamestrCapture base filename. The frameID and output name will be appended to this.
uiboolShow/hide the UI.
MethodDescription
reset(graph)Reset frame capturing for the given graph (or all graphs if set to None).
capture()Capture the current frame.
addFrames(graph, frames)Add a list of frames to capture for the given graph.
print()Print the requested frames to capture for all available graphs.
print(graph)Print the requested frames to capture for the specified graph.

Example: Capture list of frames with clock running and then exit

m.clock.exitFrame = 101
m.frameCapture.outputDir = "../../../Output"
m.frameCapture.baseFilename = "Mogwai"
m.frameCapture.addFrames(m.activeGraph, [20, 50, 100])

Example: Capture frames with clock paused and then exit

m.clock.pause()
m.frameCapture.outputDir = "../../../Output"

frames = [20, 50, 100]
for i in range(101):
    renderFrame()
    if i in frames:
        m.frameCapture.baseFilename = f"Mogwai-{i:04d}"
        m.frameCapture.capture()
exit()

VideoCapture

The video capture will always capture the marked graph output. You can use graph.markOutput() and graph.unmarkOutput() to control which outputs to dump.

enum falcor.Codec

Raw, H264, HVEC, MPEG2, MPEG4

class falcor.VideoCapture

PropertyTypeDescription
outputDirstrCapture output directory.
baseFilenamestrCapture base filename. The output name will be appended to this.
uiboolShow/hide the UI.
codecCodecVideo codec (Raw, H264, HVEC, MPEG2, MPEG4).
fpsintVideo frame rate.
bitratefloatVideo bitrate in Mpbs.
gopSizeintVideo GOP size.
MethodDescription
reset(graph)Reset video capturing for the given graph (or all graphs if set to None).
addRanges(graph, ranges)Add a list of frame ranges to capture for a given graph. ranges is a list of (start, end) tuples.
print()Print the requested ranges to capture for all available graphs.
print(graph)Print the requested ranges to capture for the specified graph.

Example:

# Video Capture
m.videoCapture.outputDir = "."
m.videoCapture.baseFilename = "Mogwai"
m.videoCapture.codec = Codec.H264
m.videoCapture.fps = 60
m.videoCapture.bitrate = 4.0
m.videoCapture.gopSize = 10
m.videoCapture.addRanges(m.activeGraph, [[30, 300]])

TimingCapture

class falcor.TimingCapture

MethodDescription
captureFrameTime(path)Start writing frame times to the given file path.

Example:

# Timing Capture
m.timingCapture.captureFrameTime("timecapture.csv")

Core API

module falcor

Global Functions

FunctionDescription
loadRenderPassLibrary(name)Load a render pass library.
clsClear the console.

ResourceFormat

enum falcor.ResourceFormat

Unknown, R8Unorm, R8Snorm, R16Unorm, R16Snorm, RG8Unorm, RG8Snorm, RG16Unorm, RG16Snorm, RGB16Unorm, RGB16Snorm, R24UnormX8, RGB5A1Unorm, RGBA8Unorm, RGBA8Snorm, RGB10A2Unorm, RGB10A2Uint, RGBA16Unorm, RGBA8UnormSrgb, R16Float, RG16Float, RGB16Float, RGBA16Float, R32Float, R32FloatX32, RG32Float, RGB32Float, RGBA32Float, R11G11B10Float, RGB9E5Float, R8Int, R8Uint, R16Int, R16Uint, R32Int, R32Uint, RG8Int, RG8Uint, RG16Int, RG16Uint, RG32Int, RG32Uint, RGB16Int, RGB16Uint, RGB32Int, RGB32Uint, RGBA8Int, RGBA8Uint, RGBA16Int, RGBA16Uint, RGBA32Int, RGBA32Uint, BGRA8Unorm, BGRA8UnormSrgb, BGRX8Unorm, BGRX8UnormSrgb, Alpha8Unorm, Alpha32Float, R5G6B5Unorm, D32Float, D16Unorm, D32FloatS8X24, D24UnormS8, BC1Unorm, BC1UnormSrgb, BC2Unorm, BC2UnormSrgb, BC3Unorm, BC3UnormSrgb, BC4Unorm, BC4Snorm, BC5Unorm, BC5Snorm, BC6HS16, BC6HU16, BC7Unorm, BC7UnormSrgb

RenderGraph

class falcor.RenderGraph

PropertyTypeDescription
namestrName of the render graph.
MethodDescription
RenderGraph(name)Create a new render graph.
addPass(pass, name)Add a render pass to the graph.
removePass(name)Remove a render pass from the graph.
updatePass(name, dict)Update a render pass with new configuration options in dict.
getPass(name)Get a pass by name.
addEdge(src, dst)Add an edge to the render graph.
removeEdge(src, dst)Remove an edge from the render graph.
markOutput(name, mask)Mark a render pass output as graph output. mask is an optional TextureChannelFlags enum.
unmarkOutput(name)Unmark an output.
getOutput(index)Get an output by index.
getOutput(name)Get an output by name.

Note:

  • markOutput marks an output to be selectable in Mogwai and for frame capture. The first marked output will be the default output in Mogwai.
  • The output is identified by name on the form renderPass.outputName.
  • The function takes an optional mask parameter to specify which color channels to capture for frame capture. If no mask is given, the default is RGB and ignore alpha.
  • An output can be marked multiple times with different masks. Each version will be written to a separate file by frame capture.

RenderPass

class falcor.RenderPass

PropertyTypeDescription
namestrName of the render pass (readonly).
typestrType name of the render pass (readonly).
descstrDescription of the render pass (readonly).
MethodDescription
getDictionary()Returns the configuration dictionary with the current settings.

Texture

class falcor.Texture

PropertyTypeDescription
widthintWidth in pixels (readonly).
heightintHeight in pixels (readonly).
depthintDepth in pixels/layers (readonly).
mipCountintNumber of mip levels (readonly).
arraySizeintSize of array (readonly).
samplesintNumber of samples (readonly).
formatResourceFormatTexture format (readonly).
MethodDescription
data(index)Returns raw data of given sub resource index.

AABB

class falcor.AABB

PropertyTypeDescription
minPointfloat3Minimum point.
maxPointfloat3Maximum point.
validboolTrue if AABB is valid (readonly).
centerfloat3Center point (readonly).
extentfloat3Extents (readonly).
areafloatTotal area (readonly).
volumefloatTotal volume (readonly).
radiusfloatRadius of an enclosing sphere (readonly).
MethodDescription
invalidate()Invalidate the AABB.
include(p)Include a point in the AABB.
include(b)Include another AABB in the AABB.
intersection(b)Intersect with another AABB.

Scene API

SceneRenderSettings

class falcor.SceneRenderSettings

PropertyTypeDescription
useEnvLightboolEnable/disable lighting from environment map.
useAnalyticLightsboolEnable/disable lighting from analytic lights.
useEmissiveLightsboolEnable/disable lighting from emissive lights.
useGridVolumesboolEnable/disable rendering of grid volumes.

Scene

class falcor.Scene

PropertyTypeDescription
statsdictDictionary containing scene stats.
boundsAABBWorld space scene bounds (readonly).
animatedboolEnable/disable scene animations.
loopAnimationsboolEnable/disable globally looping scene animations.
renderSettingsSceneRenderSettingsSettings to determine how the scene is rendered.
updateCallbackfunction(scene, time)Called at the beginning of each frame to update the scene procedurally.
cameraCameraCamera.
cameraSpeedfloatSpeed of the interactive camera.
envMapEnvMapEnvironment map.
animationslist(Animation)List of animations.
cameraslist(Camera)List of cameras.
lightslist(Light)List of lights.
materialslist(Material)List of materials.
volumeslist(Volume)DEPRECATED: Use gridVolumes instead.
gridVolumeslist(GridVolume)List of grid volumes.
MethodDescription
setEnvMap(path)Load an environment map from an image.
getLight(index)Return a light by index.
getLight(name)Return a light by name.
getMaterial(index)Return a material by index.
getMaterial(name)Return a material by name.
getVolume(index)DEPRECATED: Use getGridVolume instead.
getGridVolume(index)Return a grid volume by index.
getVolume(name)DEPRECATED: Use getGridVolume instead.
getGridVolume(name)Return a grid volume by name.
addViewpoint()Add current camera's viewpoint to the viewpoint list.
addViewpoint(position, target, up)Add a viewpoint to the viewpoint list.
removeViewpoint()Remove selected viewpoint.
selectViewpoint(index)Select a specific viewpoint and move the camera to it.

Camera

class falcor.Camera

PropertyTypeDescription
namestrName of the camera.
animatedboolEnable/disable camera animation.
aspectRatiofloatImage aspect ratio.
focalLengthfloatFocal length in millimeters.
frameHeightfloatFrame height in millimeters.
focalDistancefloatFocal distance in scene units.
apertureRadiusfloatApeture radius in scene units.
shutterSpeedfloatShutter speed in seconds (not implemented).
ISOSpeedfloatFilm speed (not implemented).
nearPlanefloatNear plane distance in scene units.
farPlanefloatFar plane distance in scene units.
positionfloat3Camera position in world space.
targetfloat3Camera target in world space.
upfloat3Camera up vector in world space.

EnvMap

class falcor.EnvMap

PropertyTypeDescription
pathstrFile path of loaded environment map (readonly).
rotationfloat3Rotation angles in degrees (XYZ).
intensityfloatIntensity (scalar multiplier).
Static methodDescription
createFromFile(path)Create a environment map from a file.

Material

DEPRECATED: Use StandardMaterial instead.

StandardMaterial

enum falcor.MaterialTextureSlot

BaseColor, Specular, Emissive, Normal, Transmission, Displacement

enum falcor.AlphaMode

Opaque, Mask

enum falcor.ShadingModel

MetalRough, SpecGloss

class falcor.StandardMaterial

PropertyTypeDescription
namestrName of the material.
shadingModelShadingModelShading model (readonly).
baseColorfloat4Base color (linear RGB) and opacity (alpha).
specularParamsfloat4Specular parameters.
roughnessfloatRoughness (0 = smooth, 1 = rough).
metallicfloatMetallic (0 = dielectric, 1 = conductive).
transmissionColorfloat3Transmission color.
diffuseTransmissionfloatDiffuse transmission (0 = opaque, 1 = transparent).
specularTransmissionfloatSpecular transmission (0 = opaque, 1 = transparent).
indexOfRefractionfloatIndex of refraction.
emissiveColorfloat3Emissive color (linear RGB).
emissiveFactorfloatMultiplier for emissive color.
alphaModeAlphaModeAlpha mode (opaque or mask)
alphaThresholdfloatAlpha masking threshold (0-1).
doubleSidedboolEnable double sided rendering.
thinSurfaceboolEnable thin surface rendering.
nestedPriorityintNested priority for nested dielectrics.
volumeAbsorptionfloat3Volume absorption coefficient.
volumeScatteringfloat3Volume scattering coefficient.
volumeAnisotropyfloatVolume phase function anisotropy (g).
displacementScalefloatDisplacement mapping scale value.
displacementOffsetfloatDisplacement mapping offset value.
MethodDescription
clearTexture(slot)Clears one of the texture slots.
loadTexture(slot, path, useSrgb=True)Load one of the texture slots from a file.

HairMaterial

class falcor.HairMaterial

Interface identical to StandardMaterial

ClothMaterial

class falcor.ClothMaterial

Interface identical to StandardMaterial

Grid

class falcor.Grid

PropertyTypeDescription
voxelCountintTotal number of active voxels in the grid (readonly).
minIndexint3Minimum index stored in the grid (readonly).
maxIndexint3Maximum index stored in the grid (readonly).
minValuefloatMinimum value stored in the grid (readonly).
maxValuefloatMaximum value stored in the grid (readonly).
MethodDescription
getValue(ijk)Access the value of a voxel in the grid (index space).
Static methodDescription
createSphere(radius, voxelSize, blendRange=2.0)Create a sphere grid.
createBox(width, height, depth, voxelSize, blendRange=2.0)Create a box grid.
createFromFile(path, gridname)Create a grid from an OpenVDB/NanoVDB file.

Volume

DEPRECATED: Use GridVolume instead.

GridVolume

enum falcor.GridVolume.GridSlot

Density, Emission

enum falcor.GridVolume.EmissionMode

Direct, Blackbody

class falcor.GridVolume

PropertyTypeDescription
namestrName of the volume.
gridFrameintCurrent frame in the grid sequence.
gridFrameCountintTotal number of frames in the grid sequence (readonly).
frameRatefloatFrame rate for grid animation.
playbackEnabledboolEnable/disable grid animation playback.
densityGridGridDensity grid.
densityScalefloatDensity scale factor.
emissionGridGridEmission grid.
emissionScalefloatEmission scale factor.
albedofloat3Scattering albedo.
anisotropyfloatPhase function anisotropy (g).
emissionModeEmissionModeEmission mode (Direct, Blackbody).
emissionTemperaturefloatEmission base temperature (K).
MethodDescription
loadGrid(slot, path, gridname)Load a grid slot from an OpenVDB/NanoVDB file.
loadGridSequence(slot, paths, gridname)Load a grid slot from a sequence of OpenVDB/NanoVDB files.
loadGridSequence(slot, path, gridname)Load a grid slot from a sequence of OpenVDB/NanoVDB files contained in a directory.

Light

class falcor.Light

PropertyTypeDescription
namestrName of the light.
activeboolEnable/disable light.
animatedboolEnable/disable light animation.
intensityfloat3Intensity of the light.

class falcor.PointLight : falcor.Light

PropertyTypeDescription
positionfloat3Position of the light in world space.
directionfloat3Direction of the light in world space.
openingAnglefloatOpening half-angle in radians.
penumbraAnglefloatPenumbra half-angle in radians.

class falcor.DirectionalLight : falcor.Light

PropertyTypeDescription
directionfloat3Direction of the light in world space.

class falcor.DistantLight : falcor.Light

PropertyTypeDescription
directionfloat3Direction of the light in world space.
anglefloatHalf-angle subtended by the light in radians.

class falcor.AnalyticAreaLight : falcor.Light

class falcor.RectLight : falcor.AnalyticAreaLight

class falcor.DiscLight : falcor.AnalyticAreaLight

class falcor.SphereLight : falcor.AnalyticAreaLight

Transform

class falcor.Transform

PropertyTypeDescription
translationfloat3Translation.
rotationEulerfloat3Euler rotation angles around XYZ (radians).
rotationEulerDegfloat3Euler rotation angles around XYZ (degrees).
scalingfloat3Scaling.
matrixfloat4x4Transformation matrix (readonly).
MethodDescription
lookAt(position, target, up)Set up a look-at transformation.

Animation

enum falcor.Animation.InterpolationMode

Linear, Hermite

enum falcor.Animation.Behavior

Constant, Linear, Cycle, Oscillate

class falcor.Animation

PropertyTypeDescription
namestrName of the animation (readonly).
nodeIDintAnimated scene graph node (readonly).
durationfloatDuration in seconds (readonly).
interpolationModeInterpolationModeInterpolation mode (linear, hermite).
preInfinityBehaviorBehaviorBehavior before the first keyframe (constant, linear, cycle, oscillate).
postInfinityBehaviorBehaviorBehavior after the last keyframe (constant, linear, cycle, oscillate).
enableWarpingboolEnable/disable warping, i.e. interpolating from last to first keyframe.
MethodDescription
addKeyframe(time, transform)Add a transformation keyframe at given time.

TriangleMesh

class falcor.TriangleMesh.Vertex

FieldTypeDescription
positionfloat3Vertex position.
normalfloat3Vertex normal.
texCoordfloat2Vertex texture coordinate.

class falcor.TriangleMesh

PropertyTypeDescription
namestrName of the triangle mesh.
verticeslist(Vertex)List of vertices (readonly).
indiceslist(int)List of indices (readonly).
MethodDescription
addVertex(position, normal, texCoord)Add a vertex to the mesh. Returns the vertex index.
addTriangle(i0, i1, i2)Add a triangle to the mesh.
Class MethodDescription
createQuad(size=float2(1))Creates a quad mesh, centered at the origin with normal pointing in positive Y direction.
createCube(size=float3(1))Creates a cube mesh, centered at the origin.
createSphere(radius=1, segmentsU=32, segmentsV=16)Creates a UV sphere mesh, centered at the origin with poles in positive/negative Y direction.
createFromFile(path, smoothNormals=False)Creates a triangle mesh from a file. If no normals are defined in the file, smoothNormals can be used generate smooth instead of facet normals.

SceneBuiler

enum falcor.SceneBuilderFlags

EnumDescription
DefaultUse the default flags (0).
DontMergeMaterialsDon't merge materials that have the same properties. Use this option to preserve the original material names.
UseOriginalTangentSpaceUse the original bitangents that were loaded with the mesh. By default, we will ignore them and use MikkTSpace to generate the tangent space. We will always generate bitangents if they are missing.
AssumeLinearSpaceTexturesBy default, textures representing colors (diffuse/specular) are interpreted as sRGB data. Use this flag to force linear space for color textures.
DontMergeMeshesPreserve the original list of meshes in the scene, don't merge meshes with the same material.
UseSpecGlossMaterialsSet materials to use Spec-Gloss shading model. Otherwise default is Spec-Gloss for OBJ, Metal-Rough for everything else.
UseMetalRoughMaterialsSet materials to use Metal-Rough shading model. Otherwise default is Spec-Gloss for OBJ, Metal-Rough for everything else.
NonIndexedVerticesConvert meshes to use non-indexed vertices. This requires more memory but may increase performance.
Force32BitIndicesForce 32-bit indices for all meshes. By default, 16-bit indices are used for small meshes.
RTDontMergeStaticFor raytracing, don't merge all static non-instanced meshes into single pre-transformed BLAS.
RTDontMergeDynamicFor raytracing, don't merge dynamic non-instanced meshes with identical transforms into single BLAS.
RTDontMergeInstancedFor raytracing, don't merge instanced meshes with identical instances into single BLAS.
FlattenStaticMeshInstancesFlatten static mesh instances by duplicating mesh data and composing transformations. Animated instances are not affected. Can lead to a large increase in memory use.
DontOptimizeGraphDon't optimize the scene graph to remove unnecessary nodes.
DontOptimizeMaterialsDon't optimize materials by removing constant textures. The optimizations are lossless so should generally be enabled.
DontUseDisplacementDon't use displacement mapping.
UseCacheEnable scene caching. This caches the runtime scene representation on disk to reduce load time.
RebuildCacheRebuild scene cache.

class falcor.SceneBuilder

PropertyTypeDescription
flagsSceneBuilderFlagsScene builder flags (readonly).
renderSettingsSceneRenderSettingsSettings to determine how the scene is rendered.
materialslist(Material)List of materials (readonly).
volumeslist(Volume)DEPRECATED: Use gridVolumes instead.
gridVolumeslist(GridVolume)List of grid volumes (readonly).
lightslist(Light)List of lights (readonly).
cameraslist(Camera)List of cameras (readonly).
animationslist(Animation)List of animations (readonly).
envMapEnvMapEnvironment map.
selectedCameraCameraDefault selected camera.
cameraSpeedfloatSpeed of the interactive camera.
MethodDescription
importScene(path, dict, instances)Load a scene from an asset file. dict contains optional data. instances is an optional list of Transform.
addTriangleMesh(triangleMesh, material)Add a triangle mesh to the scene and return its ID.
addMaterial(material)Add a material and return its ID.
getMaterial(name)Return a material by name. The first material with matching name is returned or None if none was found.
loadMaterialTexture(material, slot, path)Request loading a material texture asynchronously. Use Material.loadTexture for synchronous loading.
waitForMaterialTextureLoading()Wait until all material textures are loaded.
addVolume(volume)DEPRECATED: Use addGridVolume instead.
addGridVolume(gridVolume)Add a grid volume and return its ID.
getVolume(name)DEPRECATED: Use getGridVolume instead.
getGridVolume(name)Return a grid volume by name. The first volume with matching name is returned or None if none was found.
addLight(light)Add a light and return its ID.
getLight(name)Return a light by name. The first light with matching name is returned or None if none was found.
addCamera(camera)Add a camera and return its ID.
addAnimation(animation)Add an animation.
createAnimation(animatable, name, duration)Create an animation for an animatable object. Returns the new animation or None if one already exists.
addNode(name, transform, parent)Add a node and return its ID.
addMeshInstance(nodeID, meshID)Add a mesh instance.
addCustomPrimitive(userID, aabb)Add a custom primitive. 'aabb' is an AABB specifying its bounds.
addSDFGridInstance(userID, sdfGridID)Add a SDF grid instance.
addSDFGrid(sdfGrid, maternal)Add a SDF grid and returns its ID.

Render Pass Helpers

IOSize

enum falcor.RenderPassHelpers.IOSize

EnumDescription
DefaultUse the default size. The size is determined based on whatever is bound (the system will use the window size by default).
FixedUse fixed size in pixels.
FullUse full window size.
HalfUse half window size.
QuarterUse quarter window size.
DoubleUse double window size.

Some render passes have options to set output resolution using the IOSize enum. Usage examples (add these options to the scripting dictionary when creating the render pass):

'outputSize': IOSize.Half
'outputSize': IOSize.Fixed, 'fixedOutputSize': uint2(128,64)

Render Passes

Note: These docs are not complete. See the source code for the full set of exported methods and properties.

AccumulatePass

enum falcor.AccumulatePrecision

Double, Single, SingleCompensated

class falcor.AccumulatePass

MethodDescription
reset()Reset accumulation. This is useful when the pass has been created with 'autoReset': False
PropertyTypeDescription
outputSizeIOSizeSet output resolution.
fixedOutputSizeuint2Fixed output resolution in (width, height) pixels when using IOSize.Fixed.

ToneMapper

enum falcor.ToneMapOp

Linear, Reinhard, ReinhardModified, HejiHableAlu, HableUc2, Aces

class falcor.ToneMapper

PropertyTypeDescription
exposureCompensationfloatExposure compensation (applies in manual and auto exposure).
autoExposureboolEnable/disable auto exposure.
exposureValuefloatExposure value in manual mode.
filmSpeedfloatISO film speed in manual mode.
whiteBalanceboolEnable/disable white balancing.
whitePointfloatWhite point in Kelvin.
operatorToneMapOpTone mapping operator.
clampboolEnable/disable clamping to [0..1] range.
outputSizeIOSizeSet output resolution.
fixedOutputSizeuint2Fixed output resolution in (width, height) pixels when using IOSize.Fixed.

SimplePostFX

class falcor.SimplePostFX

PropertyTypeDescription
outputSizeIOSizeSet output resolution.
fixedOutputSizeuint2Fixed output resolution in (width, height) pixels when using IOSize.Fixed.

GBuffer passes

class falcor.GBufferRaster class falcor.VBufferRaster class falcor.GBufferRT class falcor.VBufferRT

PropertyTypeDescription
outputSizeIOSizeSet output resolution.
fixedOutputSizeuint2Fixed output resolution in (width, height) pixels when using IOSize.Fixed.

ImageLoader

class falcor.ImageLoader

PropertyTypeDescription
outputSizeIOSizeSet output resolution.

When IOSize.Fixed is used, the render pass output is at the native resolution of the loaded image. In all other modes the image is bilinearly rescaled to the desired output resolution.

GaussianBlur

class falcor.GaussianBlur

PropertyTypeDescription
kernelWidthintKernel width in pixels.
sigmafloatSigma of gaussian.

SSAO

class falcor.SSAO

PropertyTypeDescription
kernelRadiusintKernel radius in pixels.
sampleRadiusfloatSampling radius.
distributionintSampling distribution.

Skybox

class falcor.SkyBox

PropertyTypeDescription
scalefloatColor multiplier.
filterintFiltering mode.

CSM

class falcor.CSM

PropertyTypeDescription
cascadeCountint
mapSizeuint2
visibilityBitCountint
filterint
sdsmLatencyint
partitionint
lambdafloat
minDistancefloat
maxDistancefloat
cascadeThresholdfloat
depthBiasfloat
kernelWidthint
maxAnisoint
bleedReductionfloat
positiveExpfloat
negativeExpfloat

FXAA

class falcor.FXAA

PropertyTypeDescription
qualitySubPixfloat
edgeThresholdfloat
edgeThresholdMinfloat
earlyOutbool

TAA

class falcor.TAA

PropertyTypeDescription
alphafloat
sigmafloat