PopcornFX v2.17

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.17
  4. Scripting reference
  5. Namespaces
  6. view

view

The view namespace gives access to camera-related functions such as projection or distance functions.

Function parameters enclosed in square brackets mean they are optional, and the function can be called without specifying that parameter.
For view functions, all camIndex parameters are optional.

 

Return typeDescription
floatview.distance(float3 position[, int camIndex])
Returns the distance to the camera at index camIndex.
If camIndex is not specified, returns the distance to the closest camera in the scene visible to the VFX system.
If no cameras are registered, returns infinity
intview.closest(float3 position[, int n])
Returns the index of the closest camera in the scene visible to the VFX system.
if n is specified, represents the N-th closest camera whose ID should be returned.
For example, passing 3 will return the index of the 3rd-closest camera.
If no cameras are registered, returns -1
intview.count()
Returns the number of cameras in the scene visible to the VFX system.
If no cameras are registered, returns 0

 

Transforms

Return typeDescription
float3view.position([int camIndex])
Returns the position of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns float3(infinity)
float3view.velocity([int camIndex])
Returns the velocity of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns float3(0,0,0)
orientationview.orientation([int camIndex])
Returns the orientation of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns the identity orientation
float3view.axisSide([int camIndex])
Returns the side axis (left / right) of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisSide()
float3view.axisVertical([int camIndex])
Returns the vertical axis (down / up) of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisVertical()
float3view.axisDepth([int camIndex])
Returns the depth axis (backward / forward) of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisDepth()
float3view.axisLeft([int camIndex])
Returns the left direction axis of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisLeft()
float3view.axisRight([int camIndex])
Returns the right direction axis of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisRight()
float3view.axisDown([int camIndex])
Returns the down direction axis of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisDown()
float3view.axisUp([int camIndex])
Returns the up direction axis of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisUp()
float3view.axisBackward([int camIndex])
Returns the backward direction axis of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisBackward()
float3view.axisForward([int camIndex])
Returns the forward direction axis of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns scene.axisForward()
float3view.direction([int camIndex])
Returns the view vector of camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
For example, will return view.axisForward() for Right-handed Y-Up and Left-handed Z-Up coordinate systems, and -view.axisForward() for Right-handed Z-Up and Left-handed Y-Up coordinate systems.

 

Viewport & Frustum

Return typeDescription
int2view.resolution([int camIndex])
Returns the viewport resolution in pixels of the camera at index camIndex.
A camera rendering into a 1920x1024 viewport will return int2(1920,1024)
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns int2(1,1)
floatview.aspect([int camIndex])
Returns the viewport aspect-ratio of the camera at index camIndex.
Equivalent to view.resolution(a).x / float(view.resolution(a).y);
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns 1.0
floatview.fov([int camIndex])
Returns the field-of-view angle of the camera at index camIndex.
Equivalent to max(view.fovHorizontal(a), view.fovVertical(a))
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns pi/2
floatview.fovHorizontal([int camIndex])
Returns the horizontal field-of-view angle **in radians** of the camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns pi/2
floatview.fovVertical([int camIndex])
Returns the vertical field-of-view angle **in radians** of the camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns pi/2
float3view.unproject(float3 clipSpacePos[, int camIndex])
Returns the world-space un-projection of clip-space vector clipSpacePos using camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns float3(0,0,0)
float3view.unprojectedAxis(float2 screenPos[, int camIndex])
Returns the normalized axis of the ray that goes from the camera origin through the camera plane at coordinates screen-space coordinates screenPos using camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns float3(infinity)
float3view.project(float3 worldPos[, int camIndex])
Returns the clip-space projection of world-space vector worldPos using camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns float3(0,0,0)

 

LOD

Return typeDescription
floatview.lodBias([int camIndex])
Returns the LOD bias of the camera at index camIndex.
If camIndex is not specified, uses the default camera (index 0).
If no cameras are registered, returns 0.0
This value is in the [-1, 1] range.
Was this article helpful to you? Yes No

How can we help?