UnityGame/Library/PackageCache/com.unity.rendering.light-transport/Runtime/UnifiedRayTracing/Hardware/HWRayTracingMaterial.shader

35 lines
972 B
Plaintext
Raw Normal View History

2024-10-27 10:53:47 +03:00
Shader "RayTracing/StandardMaterial"
{
SubShader
{
Pass
{
Name "RayTracing"
HLSLPROGRAM
#define UNIFIED_RT_BACKEND_HARDWARE
#include "Packages/com.unity.rendering.light-transport/Runtime/UnifiedRayTracing/Bindings.hlsl"
#pragma raytracing test
struct AttributeData
{
float2 barycentrics;
};
[shader("closesthit")]
void ClosestHitMain(inout UnifiedRT::Hit payload : SV_RayPayload, AttributeData attribs : SV_IntersectionAttributes)
{
payload.instanceID = InstanceID();
payload.primitiveIndex = PrimitiveIndex();
payload.uvBarycentrics = attribs.barycentrics;
payload.hitDistance = RayTCurrent();
payload.isFrontFace = (HitKind() == HIT_KIND_TRIANGLE_FRONT_FACE);
}
ENDHLSL
}
}
}