GPUParticlesCollisionSDF3D
继承: GPUParticlesCollision3D
< VisualInstance3D
< Node3D
< Node
< Object
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 MeshInstance3D
s within the size
will be taken into account for baking, regardless of their GeometryInstance3D.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 Texture3D
s into its texture
property in an exported project.
Note: ParticleProcessMaterial.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
.
属性
方法
bool | get_bake_mask_value ( layer_number: int ) const1 |
void | set_bake_mask_value ( layer_number: int , value: bool ) |
枚举
enum Resolution:
Resolution RESOLUTION_16 = 0
Bake a 16×16×16 signed distance field. This is the fastest option, but also the least precise.
Resolution RESOLUTION_32 = 1
Bake a 32×32×32 signed distance field.
Resolution RESOLUTION_64 = 2
Bake a 64×64×64 signed distance field.
Resolution RESOLUTION_128 = 3
Bake a 128×128×128 signed distance field.
Resolution RESOLUTION_256 = 4
Bake a 256×256×256 signed distance field.
Resolution RESOLUTION_512 = 5
Bake a 512×512×512 signed distance field. This is the slowest option, but also the most precise.
Resolution RESOLUTION_MAX = 6
Represents the size of the Resolution enum.
属性说明
int
bake_mask = 4294967295
The visual layers to account for when baking the particle collision SDF. Only MeshInstance3D
s whose VisualInstance3D.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.
Resolution resolution = 2
void
set_resolution ( value: Resolution )- Resolution get_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.
Vector3
size = Vector3(2, 2, 2)
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.
Texture3D
texture
The 3D texture representing the signed distance field.
float
thickness = 1.0
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.
方法说明
bool
get_bake_mask_value ( layer_number: int
) const1
Returns whether or not the specified layer of the bake_mask
is enabled, given a layer_number
between 1 and 32.
void
set_bake_mask_value ( layer_number: int
, value: bool
)
Based on value
, enables or disables the specified layer in the bake_mask
, given a layer_number
between 1 and 32.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。