GpuParticlesCollisionSdf3D
A baked signed distance field 3D particle collision shape affecting GPUParticles3D nodes.
A baked signed distance field 3D particle collision shape affecting GpuParticles3D nodes.
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 GpuParticlesCollisionSdf3D.Size will be taken into account for baking, regardless of their GeometryInstance3D.GIMode.
Note: Baking a GpuParticlesCollisionSdf3D's GpuParticlesCollisionSdf3D.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 GpuParticlesCollisionSdf3D.Texture property in an exported project.
Note: ParticleProcessMaterial.CollisionMode must be ParticleProcessMaterial.CollisionModeEnum.Rigid or ParticleProcessMaterial.CollisionModeEnum.HideOnContact on the GpuParticles3D's process material for collision to work.
Note: Particle collision only affects GpuParticles3D, not CpuParticles3D.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
GpuParticlesCollisionSdf3DConstructor
public GpuParticlesCollisionSdf3D();Properties5
BakeMaskProperty
public uint BakeMask { get; set; }Geometry render layers for SDF baking. Not the emitter-selection CullMask. Changing selection/geometry requires validating and regenerating the field, not just assigning a mask.
ResolutionProperty
public GpuParticlesCollisionSdf3D.ResolutionEnum Resolution { get; set; }The bake resolution to use for the signed distance field GpuParticlesCollisionSdf3D.Texture. The texture must be baked again for changes to the GpuParticlesCollisionSdf3D.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.
SizeProperty
public Vector3 Size { get; set; }Full local SDF-region dimensions, not half extents. Response requires appropriate Texture data and supported rendering. Changing Size is not the same as rebaking geometry.
TextureProperty
public Texture3D Texture { get; set; }3D distance-field data for collision. Not visible albedo or a gameplay CollisionShape. Check generated-data availability/freshness; mesh edits do not rewrite this texture automatically.
ThicknessProperty
public float Thickness { get; set; }The collision shape's thickness. Unlike other particle colliders, GpuParticlesCollisionSdf3D is actually hollow on the inside. GpuParticlesCollisionSdf3D.Thickness can be increased to prevent particles from tunneling through the collision shape at high speeds, or when the GpuParticlesCollisionSdf3D is moved.
Methods12
GetBakeMaskuint
public uint GetBakeMask();uintGetBakeMaskValuebool
public bool GetBakeMaskValue(int layerNumber);Returns whether or not the specified layer of the GpuParticlesCollisionSdf3D.BakeMask is enabled, given a layer_number between 1 and 32.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
boolGetResolutionGpuParticlesCollisionSdf3D.ResolutionEnum
public GpuParticlesCollisionSdf3D.ResolutionEnum GetResolution();GpuParticlesCollisionSdf3D.ResolutionEnumGetSizeVector3
public Vector3 GetSize();Vector3GetTextureTexture3D
public Texture3D GetTexture();Texture3DGetThicknessfloat
public float GetThickness();floatSetBakeMaskvoid
public void SetBakeMask(uint mask);| Name | Type | Default |
|---|---|---|
mask | uint | — |
SetBakeMaskValuevoid
public void SetBakeMaskValue(int layerNumber, bool value);Based on value, enables or disables the specified layer in the GpuParticlesCollisionSdf3D.BakeMask, given a layer_number between 1 and 32.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
value | bool | — |
SetResolutionvoid
public void SetResolution(GpuParticlesCollisionSdf3D.ResolutionEnum resolution);| Name | Type | Default |
|---|---|---|
resolution | GpuParticlesCollisionSdf3D.ResolutionEnum | — |
SetSizevoid
public void SetSize(Vector3 size);| Name | Type | Default |
|---|---|---|
size | Vector3 | — |
SetTexturevoid
public void SetTexture(Texture3D texture);| Name | Type | Default |
|---|---|---|
texture | Texture3D | — |
SetThicknessvoid
public void SetThickness(float thickness);| Name | Type | Default |
|---|---|---|
thickness | float | — |
GpuParticlesCollisionSdf3D.ResolutionEnum
| Value | Description |
|---|---|
Max = 6 | Represents the size of the |
Resolution128 = 3 | Bake a 128×128×128 signed distance field. |
Resolution16 = 0 | Bake a 16×16×16 signed distance field. This is the fastest option, but also the least precise. |
Resolution256 = 4 | Bake a 256×256×256 signed distance field. |
Resolution32 = 1 | Bake a 32×32×32 signed distance field. |
Resolution512 = 5 | Bake a 512×512×512 signed distance field. This is the slowest option, but also the most precise. |
Resolution64 = 2 | Bake a 64×64×64 signed distance field. |