Table of Contents

Class GPUParticlesCollisionSDF3D

A baked signed distance field 3D particle collision shape affecting GPUParticles3D nodes.

Inheritance
GPUParticlesCollisionSDF3D

Remarks

A baked signed distance field 3D particle collision shape affecting GPUParticles3D nodes.

Signed distance fields (SDF) allow for efficiently representing approximate collision shapes for convex and concave objects of any shape. This is more flexible than GPUParticlesCollisionHeightField3D, but it requires a baking step.

Baking: The signed distance field texture can be baked by selecting the GPUParticlesCollisionSDF3D node in the editor, then clicking Bake SDF at the top of the 3D viewport. Any visible MeshInstance3Ds within the size will be taken into account for baking, regardless of their gi_mode.

Note: Baking a GPUParticlesCollisionSDF3D's texture is only possible within the editor, as there is no bake method exposed for use in exported projects. However, it's still possible to load pre-baked Texture3Ds into its texture property in an exported project.

Note: collision_mode must be ParticleProcessMaterial.COLLISION_RIGID or ParticleProcessMaterial.COLLISION_HIDE_ON_CONTACT on the GPUParticles3D's process material for collision to work.

Note: Particle collision only affects GPUParticles3D, not CPUParticles3D.

Properties

bake_mask

The visual layers to account for when baking the particle collision SDF. Only MeshInstance3Ds whose layers match with this bake_mask will be included in the generated particle collision SDF. By default, all objects are taken into account for the particle collision SDF baking.

var bake_mask : int = 4294967295

Property Value

int

Remarks

  • void set_bake_mask(int value)
  • int get_bake_mask

resolution

The bake resolution to use for the signed distance field texture. The texture must be baked again for changes to the resolution property to be effective. Higher resolutions have a greater performance cost and take more time to bake. Higher resolutions also result in larger baked textures, leading to increased VRAM and storage space requirements. To improve performance and reduce bake times, use the lowest resolution possible for the object you're representing the collision of.

var resolution : int = 2

Property Value

int

Remarks

  • void set_resolution(int value)
  • int get_resolution

size

The collision SDF's size in 3D units. To improve SDF quality, the size should be set as small as possible while covering the parts of the scene you need.

var size : Vector3 = Vector3(2, 2, 2)

Property Value

Vector3

Remarks

texture

The 3D texture representing the signed distance field.

var texture : Texture3D

Property Value

Texture3D

Remarks

thickness

The collision shape's thickness. Unlike other particle colliders, GPUParticlesCollisionSDF3D is actually hollow on the inside. thickness can be increased to prevent particles from tunneling through the collision shape at high speeds, or when the GPUParticlesCollisionSDF3D is moved.

var thickness : float = 1.0

Property Value

float

Remarks

  • void set_thickness(float value)
  • float get_thickness

Methods

get_bake_mask_value(int)

Qualifiers: const

Returns whether or not the specified layer of the bake_mask is enabled, given a layer_number between 1 and 32.

bool get_bake_mask_value(int layer_number)

Parameters

layer_number int

set_bake_mask_value(int, bool)

Based on value, enables or disables the specified layer in the bake_mask, given a layer_number between 1 and 32.

void set_bake_mask_value(int layer_number, bool value)

Parameters

layer_number int
value bool