Version: 2023.2
LanguageEnglish
  • C#

RayTracingShader.maxRecursionDepth

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public float maxRecursionDepth;

Description

The maximum number of ray bounces this shader can trace (Read Only).

This value can be set in a .raytrace file using #pragma max_recursion_depth followed by a positive number.

If you set max_recursion_depth value too low, your graphics device may go into removed state, and crash Unity. To generate rays, your max_recursion_depth value must be at least 0. However, if you invoke the TraceRay HLSL function inside a closest hit shader (for example) your max_recursion_depth value must be at least 1.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961