| 12345678910111213141516171819202122232425262728293031 |
- #include "Common.hlsl"
- [shader("closesthit")]
- void ChunkClosestHit(inout HitInfo currentPayload, ChunkHitAttributes attrib)
- {
- if (currentPayload.hitCount == 0)
- {
- return; // already inside of shadow ray
- }
- HitInfo tmpPayload;
- // shadow rays
- for (int i = 0; i < currentPayload.hitCount; i++)
- {
- tmpPayload.color[0].rgb = unpackLight(currentPayload.dayLight[i]) * dayLightFactor;
- /*tmpPayload.hitCount = -1; // shadow ray
- RayDesc ray;
- ray.Origin = WorldRayOrigin() + (currentPayload.distance[i] - 0.0001) * WorldRayDirection();
- ray.Direction = -dayLightDirection;
- ray.TMin = 0.1;
- ray.TMax = 1000;
- TraceRay(TLAS,
- 0, 0xFF, 0,
- 0, 0, ray, tmpPayload);
- if (tmpPayload.hitCount == 0)
- {
- tmpPayload.color[0].rgb = tmpPayload.color[0].rgb / 2;
- }*/
- currentPayload.dayLight[i] = packLight(tmpPayload.color[0].rgb);
- }
- // TODO: reflection rays
- }
|