-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: kevyuu <[email protected]>
- Loading branch information
kevyuu
committed
Jan 22, 2025
1 parent
ebd31ef
commit bcbd729
Showing
8 changed files
with
66 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "common.hlsl" | ||
|
||
[[vk::push_constant]] SPushConstants pc; | ||
|
||
[shader("callable")] | ||
void main(inout RayLight cLight) | ||
{ | ||
float32_t3 lDir = pc.light.position - cLight.inHitPosition; | ||
cLight.outLightDistance = length(lDir); | ||
cLight.outIntensity = pc.light.intensity / (cLight.outLightDistance * cLight.outLightDistance); | ||
cLight.outLightDir = normalize(lDir); | ||
float theta = dot(cLight.outLightDir, normalize(-pc.light.direction)); | ||
float epsilon = pc.light.innerCutoff - pc.light.outerCutoff; | ||
float spotIntensity = clamp((theta - pc.light.outerCutoff) / epsilon, 0.0, 1.0); | ||
cLight.outIntensity *= spotIntensity; | ||
} |
11 changes: 11 additions & 0 deletions
11
71_RayTracingPipeline/app_resources/light_directional.rcall.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "common.hlsl" | ||
|
||
[[vk::push_constant]] SPushConstants pc; | ||
|
||
[shader("callable")] | ||
void main(inout RayLight cLight) | ||
{ | ||
cLight.outLightDir = normalize(-pc.light.direction); | ||
cLight.outIntensity = 1.0; | ||
cLight.outLightDistance = 10000000; | ||
} |
13 changes: 13 additions & 0 deletions
13
71_RayTracingPipeline/app_resources/light_point.rcall.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "common.hlsl" | ||
|
||
[[vk::push_constant]] SPushConstants pc; | ||
|
||
[shader("callable")] | ||
void main(inout RayLight cLight) | ||
{ | ||
float32_t3 lDir = pc.light.position - cLight.inHitPosition; | ||
float lightDistance = length(lDir); | ||
cLight.outIntensity = pc.light.intensity / (lightDistance * lightDistance); | ||
cLight.outLightDir = normalize(lDir); | ||
cLight.outLightDistance = lightDistance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters