文档

Unity Engine

Unity Engine

SetGlobalRayTracingAccelerationStructure

Adds a command to bind the RayTracingAccelerationStructure object to all shader stages.
阅读时间2 分钟最后更新于 25 天前

Definition

SetGlobalRayTracingAccelerationStructure(string, RayTracingAccelerationStructure)

Adds a command to bind the RayTracingAccelerationStructure object to all shader stages.
public void SetGlobalRayTracingAccelerationStructure(string name, RayTracingAccelerationStructure accelerationStructure)

Parameters

name

The name of the acceleration structure in shader code.

accelerationStructure

The acceleration structure to set.

Remarks

This command binds a RayTracingAccelerationStructure object to all shader stages. You can use the structure for inline ray tracing (ray queries) or as an argument in
TraceRay
calls in ray tracing shaders. The RayTracingAccelerationStructure object must be built using the CommandBuffer.BuildRayTracingAccelerationStructure method before calling this command.
Ray queries can be used to perform acceleration structure traversal and geometry intersection tests. To access this functionality, the HLSL code must be compiled using the
#pragma require inlineraytracing
directive or by using the built-in shader keyword
UNITY_DEVICE_SUPPORTS_INLINE_RAY_TRACING
(for example, #pragma multi_compile _ UNITY_DEVICE_SUPPORTS_INLINE_RAY_TRACING).

SetGlobalRayTracingAccelerationStructure(int, RayTracingAccelerationStructure)

Adds a command to bind the RayTracingAccelerationStructure object to all shader stages.
public void SetGlobalRayTracingAccelerationStructure(int nameID, RayTracingAccelerationStructure accelerationStructure)

Parameters

nameID

The name ID of the acceleration structure in shader code. Use Shader.PropertyToID to get this value.

accelerationStructure

The acceleration structure to set.

Remarks

This command binds a RayTracingAccelerationStructure object to all shader stages. You can use the structure for inline ray tracing (ray queries) or as an argument in
TraceRay
calls in ray tracing shaders. The RayTracingAccelerationStructure object must be built using the CommandBuffer.BuildRayTracingAccelerationStructure method before calling this command.
Ray queries can be used to perform acceleration structure traversal and geometry intersection tests. To access this functionality, the HLSL code must be compiled using the
#pragma require inlineraytracing
directive or by using the built-in shader keyword
UNITY_DEVICE_SUPPORTS_INLINE_RAY_TRACING
(for example, #pragma multi_compile _ UNITY_DEVICE_SUPPORTS_INLINE_RAY_TRACING).