Force Field Introduction

../_images/ForceField.JPG

The APEX ForceField module creates effects with APEX Basic IOS particles and APEX Particle IOS particles (based on PhysX 3 Particles). It will also work with PhysX 3.x objects such as particles and rigid bodies. The combination of APEX ForceField and APEX Particles allows a particle system that can be used to create a wide variety of force field effects. Good targets for APEX ForceField are things like explosions.

Limitations: The APEX Force Field module only supports PhysX 3.x on Windows, so it may not be included in all APEX distributions. ForceFields only interact with particles and rigid bodies at this point. Support for interaction with cloth will be added in a future APEX release.

ForceField Assets

This link describles all of the ForceField asset parameters.

ForceField Actors

This link describles all of the ForceField actor parameters.

Interaction with PhysX Shapes

ForceField actors can interact with PhysX shapes if the collision filtering settings are set correctly (set in the ForceField asset or actor).

Parameters

Lifetime

Force field lifetime determines how long a force field actor is active after creation.

Strength

Force field strength determines the amount of strength the force field applies to objects it interacts with. Strength magnitude is constant in the include shape of the actor, unless a spacial falloff is specified. Direction of force is dependent on the coordinate system type for the force field actor.

Spacial Falloff

Spacial falloff affects the strength of the force field in the include shape, depending on the distance of the point from the center of the force field.

Falloff Types

There are 3 predefined fallof shapes that can be used to configure spacial falloff.

../_images/FalloffShapes.JPG

The start and end distances for the falloff can be defined, and the force field strength between these distances will be scaled depending on the falloff type used.

Include Shapes

There are 5 different include shapes that can be used with a force field actor. Currently, only one include shape is supported for each force field actor. The include shape defines the space in which a force field acts in. The pose of the include shape can be used to rotate it, or to position it as an offset from the force field actor’s position.

To define the dimensions of the include shape and to position it relative to the force field actor, refer to the following table:

Shape x y z position (0,0,0) orientation
sphere radius     center of sphere  
capsule radius height   half height vertical
cylinder radius height   half height vertical
cone top radius height bottom radius half height vertical
box half dimension half dimension half dimension center of box as coordinates

Noise

In order to add randomness, noise can be applied to force fields. Simplex noise is used here. Strength value, space scale, time scale and noise octaves parameters can be used to configure the characteristics of noise to be added.

Force Field Types

Spherical Force Field

The only force field type supported for now is the spherical force field. Spherical force fields creates an area where forces act in a direction radially outwards from the center of the force field. Falloff distance is also calculated based on the distance from the center of this force field.

Debug Visualization

All APEX modules come with debug visualization rendering, to help understand what is happening in an APEX scene. When you hit the V key in SimpleForceField, default APEX visualization rendering is turned on, as well as default PhysX SDK visualization.

Click here for a list of the Forcefield debug visualization parameters

For general information on how to use debug visualization within APEX, please see Debug Visualization.

../_images/ForceFieldDebugVisualization.JPG

Errors and Warnings

APEX ForceField outputs the following error and warning messages using the standard APEX error stream.

ERROR CODE MESSAGE Explanation
APEX_INVALID_OPERATION Not yet implemented! The ForceField Module does not support dynamically editing the NvParameterized::Interface
APEX_INVALID_OPERATION Not implemented! The ForceField module does not support preparing an asset for another platform
APEX_DEBUG_WARNING Driver error = %04d from file <%s>, line %i.  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - invalid value  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - out of memory  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - not initialized  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - launch failure  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - out of resources  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - lauch timeout  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - invalid context  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - error unknown  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - error deitialized  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - error invalid handle  
APEX_DEBUG_WARNING FORCEFIELD FATAL ERROR - unknown error  
APEX_DEBUG_WARNING [ERROR] Advection3DDevice::initialize_storage - u dimensions mismatch  
APEX_DEBUG_WARNING [ERROR] Advection3DDevice::initialize_storage - v dimensions mismatch  
APEX_DEBUG_WARNING [ERROR] Advection3DDevice::initialize_storage - v dimensions mismatch  
APEX_DEBUG_WARNING [ERROR] Advection3DDevice::initialize_storage - u,v,w layout mismatch  
APEX_DEBUG_WARNING [ERROR] Advection3DDevice::initialize_storage - u has no ghost cells  
APEX_DEBUG_WARNING [ERROR] Advection3DDevice::initialize_storage - v has no ghost cells  
APEX_DEBUG_WARNING [ERROR] Advection3DDevice::initialize_storage - w has no ghost cells  
APEX_DEBUG_WARNING [ERROR] Advection3DDevice::initialize_storage - garbage hx,hy,hz value  
APEX_DEBUG_WARNING [ERROR] AdvectionMacCormack3DDeviceF::initialize_storage - error allocating extra grids  
APEX_DEBUG_WARNING [ERROR] AdvectionUpwind3DDeviceF::invoke_kernel_downsample - bad level = %d  
APEX_DEBUG_WARNING [ERROR] AdvectionUpwind3DDevice::invoke_kernel_downsample - CUDA error “%s” A CUDA error occurred. A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] AdvectionUpwind3DDeviceF::invoke_kernel_upsample - bad level = %d  
APEX_DEBUG_WARNING [ERROR] AdvectionUpwind3DDevice::invoke_kernel_upsample - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] AdvectionUpwind3DDevice::invoke_kernel_apply_upwind - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING Before BC: Max u at level %d = %f  
APEX_DEBUG_WARNING After: Max u at level %d = %f  
APEX_DEBUG_WARNING [ERROR] AdvectionUpwind3DDeviceF::solve - garbage req_dt %f!  
APEX_DEBUG_WARNING level %d  
APEX_DEBUG_WARNING [ERROR] AdvectionUpwind3DDeviceF::solve - too fast level = %d, _num_levels = %d!  
APEX_DEBUG_WARNING Max u at level %d = %f  
APEX_DEBUG_WARNING Max deriv_u at level %d = %f  
APEX_DEBUG_WARNING [ERROR] Advection3D::initialize_storage - error allocating derivative grids  
APEX_DEBUG_WARNING [ERROR] apply_3d_boundary_conditions_level1_nocorners - invalid boundary condition types %d, %d, %d, %d, %d,%d  
APEX_DEBUG_WARNING [ERROR] apply_3d_boundary_conditions_level1_nocorners - must have at least 1 ghost point  
APEX_DEBUG_WARNING [ERROR] apply_3d_boundary_conditions_level1_nocorners - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] apply_3d_mac_boundary_conditions_level1 - invalid boundary condition types %d, %d, %d, %d, %d,%d  
APEX_DEBUG_WARNING [ERROR] apply_3d_mac_boundary_conditions_level1 - layout mismatch  
APEX_DEBUG_WARNING [ERROR] apply_3d_mac_boundary_conditions_level1 - must have at least 1 ghost point  
APEX_DEBUG_WARNING [ERROR] apply_3d_mac_boundary_conditions_level1 - v_grid dimension mismatch (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] apply_3d_mac_boundary_conditions_level1 - w_grid dimension mismatch (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] apply_3d_mac_boundary_conditions_level1 - CUDA error in x “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] apply_3d_mac_boundary_conditions_level1 - CUDA error in y “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] apply_3d_mac_boundary_conditions_level1 - CUDA error in z “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] apply_3d_boundary_conditions_level1_nocorners - invalid boundary condition types %d, %d, %d, %d, %d,%d  
APEX_DEBUG_WARNING [ERROR] Grid1DDeviceT::clear_zero - cudaMemset failed  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::copy_interior_data - nx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::copy_interior_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::copy_all_data - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::copy_all_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::copy_interior_data - nx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::copy_interior_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::copy_all_data - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::copy_all_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::linear_combination - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DDeviceF::linear_combination - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::linear_combination - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::linear_combination - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DDeviceF::linear_combination - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] Grid1DDevice::init - gpu buffer alloc failed  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::copy_interior_data - nx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::copy_interior_data - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::linear_combination - nx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::linear_combination - nx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::linear_combination - nx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::init - host buffer alloc failed  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::copy_interior_data - nx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::copy_interior_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::copy_all_data - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::copy_all_data - cudaMemcpy failed with %s  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::copy_all_data - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid1DHost copy_partial_data_async - pnx mismatch: %d != %d  
APEX_DEBUG_WARNING [ERROR] Grid3DDeviceT::clear_zero - cudaMemset failed  
APEX_DEBUG_WARNING [ERROR] Grid3DDeviceF::clear - CUDA error A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] Grid3DDeviceF::clear - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - non specialized function called  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::linear_combination - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDeviceF::linear_combination - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::linear_combination - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::linear_combination - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DDeviceF::linear_combination - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] Grid3DDevice::init - gpu buffer alloc failed  
APEX_DEBUG_WARNING ERROR: calling base implementation of initCUDAFunction  
APEX_DEBUG_WARNING [ERROR] Grid3DHost::copy_interior_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DHost::copy_interior_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DHost::copy_interior_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::linear_combination - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid1DHost::linear_combination - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DHost::init - host buffer alloc failed  
APEX_DEBUG_WARNING [ERROR] Grid3DHost::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] Grid3DHost::copy_all_data - cudaMemcpy failed  
APEX_DEBUG_WARNING [ERROR] Grid3DHost::copy_all_data - mismatch: (%d, %d, %d) != (%d, %d, %d)  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3DDeviceF::invoke_kernel_calculate_relax - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] MultigridPressure3DDeviceF::invoke_kernel_calculate_residual - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] MultigridPressure3DDeviceF::invoke_kernel_restrict - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] MultigridPressure3DDeviceF::invoke_kernel_prolong - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - garbage hx,hy,hz value %f %f %f  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::relax - failed at level %d  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::restrict_residuals - failed at level %d -> %d  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::prolong - failed at level %d -> %d  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::apply_boundary_conditions - failed at level %d  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::apply_boundary_conditions - failed at level %d  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3::initialize_storage - error in grid calculation  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - rhs has invalid ghost cells (%d,%d,%d), must be >= 1  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - rhs dimension mismatch (%d,%d,%d) != (%d,%d,%d)  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - could not initialize _r_grid[0]  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - could not initialize _u_grid[0]  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - could not initialize _u_grid[%d]  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - could not initialize _b_grid[%d]  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - could not initialize _r_grid[%d]  
APEX_DEBUG_WARNING [ERROR] MultigridPressure3D::initialize_storage - grid dimension mismatch  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DBase::convert_bc_to_poisson_eqn - invalid boundary condition type %d  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DBase::initialize_base_storage - u dimensions mismatch  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DBase::initialize_base_storage - v dimensions mismatch  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DBase::initialize_base_storage - v dimensions mismatch  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DBase::initialize_base_storage - u,v,w layout mismatch  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::initialize_base_storage - must have at least one ghost cell on all sides  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DBase::initialize_base_storage - garbage hx,hy,hz value  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::calculate_divergence - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::subtract_grad_p - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::solve - could not enforce boundary conditions  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::solve - could not calculate divergence  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::solve - could not solve for pressure  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::solve - could not subtract gradient of pressure  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::solve - could not enforce boundary conditions  
APEX_DEBUG_WARNING Max divergence: before = %.010f, after = %.010f (reduction %fx)  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::initialize_storage - failed to initialize base storage  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::initialize_storage - failed to initialize divergence  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::initialize_storage - divergence layout mismatch  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::initialize_storage - failed to initialize pressure_solver  
APEX_DEBUG_WARNING [ERROR] ProjectDivergence3DDevice::initialize_storage - pressure layout mismatch  
APEX_DEBUG_WARNING ERROR: calling base implementation of initCUDAFunction  
APEX_DEBUG_WARNING [ERROR] sample_points_3d - position arrays do not have matching sizes  
APEX_DEBUG_WARNING [ERROR] sample_points_3d - CUDA error A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] sample_points_3d - position arrays do not have matching sizes  
APEX_DEBUG_WARNING [ERROR] sample_weighted_points_3d - CUDA error A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] calculate_velocity_weights - CUDA error “%s” A CUDA error occurred.
APEX_DEBUG_WARNING [ERROR] sample_points_mac_grid_3d - failed on u sampling  
APEX_DEBUG_WARNING [ERROR] sample_points_mac_grid_3d - failed on v sampling  
APEX_DEBUG_WARNING [ERROR] sample_points_mac_grid_3d - failed on w sampling  
APEX_DEBUG_WARNING [ERROR] sample_points_minmax_3d - position arrays do not have matching sizes  
APEX_DEBUG_WARNING [ERROR] sample_points_minmax_3d - CUDA error “%s” A CUDA error occurred.