PopcornFX v2.15

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

scene

The scene namespace gives access to scene-related functions such as intersection queries or axis-system helpers.

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

 

Time

Return typeDescription
floatscene.time
Time elapsed since the start of the simulation. This is usually since the start of the whole scene / level.
See also: effect.age()
floatscene.dt
Simulation timestep in seconds. This is the time elapsed since the last simulation frame.
Prefer using the default dt template, or dxdF(scene.time). Both will return the time elapsed since the last update at the specific update rate this simulation is running.
With dxdF(scene.time), sims running at a lower update rate will get the correct time since the last update frame.
See also: effect.dt()

 

Intersection queries

Return typeDescription
intscene.surfaceType.*
All surface types configured in the project-settings ‘Scene’ panel.
intscene.collisionFilter.*
All collision filters configured in the project-settings ‘Scene’ panel.
float4scene.intersect(float3 origin, float3 rayDir, float rayLength[, bool mask, int collisionFilterID])
Issues a scene raycast query at location origin, towards direction rayDir, as far as distance rayLength.
Optional parameter mask is a trace mask, which defaults to true. Passing false will not perform the raycast for this particle, and the return value will be undefined.
Optional parameter collisionFilterID is a collision filter (see scene.collisionFilter), to tell the game-engine which parts of the scene should be tested.
Returns a float4 result containing the intersection normal in its xyz components, and the intersection distance in its w component.
If the ray did not intersect anything, infinity is returned in w.
int4scene.intersectExt(float3 origin, float3 rayDir, float rayLength[, bool mask, int collisionFilterID])
Issues a scene raycast query at location origin, towards direction rayDir, as far as distance rayLength.
Optional parameter mask is a trace mask, which defaults to true. Passing false will not perform the raycast for this particle, and the return value will be undefined.
Optional parameter collisionFilterID is a collision filter (see scene.collisionFilter), to tell the game-engine which parts of the scene should be tested.
Returns an int4 result containing packed intersection results.
Use scene.unpackNormal(r), scene.unpackDist(r), and scene.unpackSurfaceType(r) to extract the data.
If the ray did not intersect anything, infinity is returned by scene.unpackDist(r).
float4scene.sweepSphere(float3 origin, float3 rayDir, float rayLength, float rayRadius[, bool mask, int collisionFilterID]) [v2.6.0]
Issues a sphere-sweep query at location origin, towards direction rayDir, as far as distance rayLength, with a sphere radius rayRadius.
Optional parameter mask is a trace mask, which defaults to true. Passing false will not perform the sweep for this particle, and the return value will be undefined.
Optional parameter collisionFilterID is a collision filter (see scene.collisionFilter), to tell the game-engine which parts of the scene should be tested.
Returns a float4 result containing the intersection normal in its xyz components, and the intersection distance in its w component.
If the ray did not intersect anything, infinity is returned in w.
int4scene.sweepSphereExt(float3 origin, float3 rayDir, float rayLength, float rayRadius[, bool mask, int collisionFilterID]) [v2.6.0]
Issues a sphere-sweep query at location origin, towards direction rayDir, as far as distance rayLength, with a sphere radius rayRadius.
Optional parameter mask is a trace mask, which defaults to true. Passing false will not perform the sweep for this particle, and the return value will be undefined.
Optional parameter collisionFilterID is a collision filter (see scene.collisionFilter), to tell the game-engine which parts of the scene should be tested.
Returns an int4 result containing packed intersection results.
Use scene.unpackNormal(r), scene.unpackDist(r), and scene.unpackSurfaceType(r) to extract the data.
If the ray did not intersect anything, infinity is returned by scene.unpackDist(r).
float3scene.unpackNormal(int4 extReport)
Extracts the intersection normal from the int4 result of scene.intersectExt().
Equivalent to scene.intersect(a, b, c, d).xyz
floatscene.unpackDist(int4 extReport)
Extracts the intersection distance from the int4 result of scene.intersectExt().
Equivalent to scene.intersect(a, b, c, d).w
intscene.unpackSurfaceType(int4 extReport)
Extracts the intersection surface type from the int4 result of scene.intersectExt().
The returned surface type can be tested against one of the surface types configured in the project settings (see scene.surfaceType).

 

Axis system

Return typeDescription
float3scene.axisSide()
Returns the scene’s side axis. Use this function to make axis-independent effects.
float3scene.axisVertical()
Returns the scene’s vertical axis. Use this function to make axis-independent effects.
float3scene.axisDepth()
Returns the scene’s depth axis. Use this function to make axis-independent effects.
float3scene.axisLeft()
Returns the scene’s left direction axis. Use this function to make axis-independent effects.
float3scene.axisRight()
Returns the scene’s right direction axis. Use this function to make axis-independent effects.
float3scene.axisDown()
Returns the scene’s down direction axis. Use this function to make axis-independent effects.
float3scene.axisUp()
Returns the scene’s up direction axis. Use this function to make axis-independent effects.
float3scene.axisBackward()
Returns the scene’s backward direction axis. Use this function to make axis-independent effects.
float3scene.axisForward()
Returns the scene’s forward axis. Use this function to make axis-independent effects.
boolscene.isRight()
Returns true if the axis-system of the scene is right-handed, false otherwise
floatscene.isRightSign()
Returns 1.0 if the axis-system of the scene is right-handed, -1.0 otherwise

 

Orientations

Return typeDescription
orientationscene.orientation_f(float3 forward)
scene.orientation_f_norm(float3 forward)

Returns an orientation computed from forward vector forward.
The _norm version of the function expects the input vector to be an unit vector (normalized).
The regular version of the function will internally re-normalize the input vector.
orientationscene.orientation_u(float3 up)
scene.orientation_u_norm(float3 up)

Returns an orientation computed from up vector up.
The _norm version of the function expects the input vector to be an unit vector (normalized).
The regular version of the function will internally re-normalize the input vector.
orientationscene.orientation_fu(float3 forward, float3 up)
scene.orientation_fu_norm(float3 forward, float3 up)

Returns an orientation computed from forward vector forward and up vector up.
The _norm version of the function expects the input vector to be an unit vector (normalized).
The non-_norm version of the function will internally re-normalize the input vector.
orientationscene.orientation_aa(float3 axis, float angle)
scene.degrees.orientation_aa(float3 axis, float angle)
scene.radians.orientation_aa(float3 axis, float angle)

Returns an orientation computed from axis vector axis and the angle angle.
axis does not have to be an unit vector.
angle is a rotation angle. The base function expects angle to be specified in degrees.
Each version of the function in the degrees and radians namespaces will expect angle to be in the corresponding unit.
orientationscene.orientation_ea(float3 angles)
scene.degrees.orientation_ea(float3 angles)
scene.radians.orientation_ea(float3 angles)
scene.orientation_ea(float x, float y, float z)
scene.degrees.orientation_ea(float x, float y, float z)
scene.radians.orientation_ea(float x, float y, float z)

Returns an orientation computed from euler angles.
x, y, and z angles are the rotation angles along each corresponding axis in 3D-space.
Rotations are applied in yaw-pitch-roll order.
The base function expects the angles to be specified in degrees.
Each version of the function in the degrees and radians namespaces will expect angle to be in the corresponding unit.
float3scene.ea_from_orientation(orientation rot)
scene.degrees.ea_from_orientation(orientation rot)
scene.radians.ea_from_orientation(orientation rot)

Returns float3 euler angles extracted from an orientation rot.
The base function returns angles in degrees.
Each version of the function in the degrees and radians namespaces will return angles in the corresponding unit.

 

LOD

Return typeDescription
floatscene.lodBias()
Returns the LOD bias of the current scene.
This value is in the [-1, 1] range.
floatscene.lodDistanceMin()
Returns the min LOD distance of the current scene.
This value is in the [-1, 1] range.
floatscene.lodDistanceMax()
Returns the max LOD distance of the current scene.
This value is in the [-1, 1] range.
Was this article helpful to you? Yes No

How can we help?