DXR相关

编程入门 行业动态 更新时间:2024-10-19 12:38:13

<a href=https://www.elefans.com/category/jswz/34/1752635.html style=DXR相关"/>

DXR相关

Tips

DXR ray tracing tutorial中:

TraceRay(gRtScene,
RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_SKIP_CLOSEST_HIT_SHADER,
0xFF, 0, hitProgramCount, 0, rayAO, rayPayload);

We’re going to tell our ray to never run the closest-hit shader and to stop as soon as we find any intersection.
这里注意RAYFLAG可以设置为skip closest hit shader;在anyhit shader中只有通过alpha测试后才会得到有效的hit,才能结束search;整个过程中不会走closest hit shader,会走any hit shader,可能会走miss shader。这种设置可以在AO中发挥作用,具体看DXR ray tracing tutorial。

// What code is executed when our ray misses all geometry?
[shader("miss")]
void AoMiss(inout AORayPayload rayData)
{// Our ambient occlusion value is 1 if we hit nothing.rayData.aoValue = 1.0f;
}// What code is executed when our ray hits a potentially transparent surface?
[shader("anyhit")]
void AoAnyHit(inout AORayPayload rayData, BuiltInTriangleIntersectionAttributes attribs)
{// Is this a transparent part of the surface?  If so, ignore this hitif (alphaTestFails(attribs))IgnoreHit();
}

更多推荐

DXR相关

本文发布于:2024-02-07 02:08:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1752308.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:DXR

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!