Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
4304f8b2
Commit
4304f8b2
authored
3 years ago
by
Katharina Krämer
Browse files
Options
Downloads
Patches
Plain Diff
[
#94
] added plane to scene
parent
44a4faf3
No related branches found
No related tags found
1 merge request
!77
Resolve "SAF-R Module"
Pipeline
#27199
passed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/saf_r/shaders/raytracing.comp
+14
-1
14 additions, 1 deletion
projects/saf_r/shaders/raytracing.comp
with
14 additions
and
1 deletion
projects/saf_r/shaders/raytracing.comp
+
14
−
1
View file @
4304f8b2
...
@@ -89,7 +89,7 @@ bool rayIntersect(const vec3 origin, const vec3 dir, out float t0, const int id)
...
@@ -89,7 +89,7 @@ bool rayIntersect(const vec3 origin, const vec3 dir, out float t0, const int id)
Intersection sceneIntersect(const vec3 rayOrigin, const vec3 rayDirection) {
Intersection sceneIntersect(const vec3 rayOrigin, const vec3 rayDirection) {
//distance if spheres will be rendered
//distance if spheres will be rendered
float min_d = 1
0000
0; // lets start with something big
float min_d = 1
.0 / 0.
0; // lets start with something big
Intersection intersection;
Intersection intersection;
intersection.hit = false;
intersection.hit = false;
...
@@ -109,6 +109,19 @@ Intersection sceneIntersect(const vec3 rayOrigin, const vec3 rayDirection) {
...
@@ -109,6 +109,19 @@ Intersection sceneIntersect(const vec3 rayOrigin, const vec3 rayDirection) {
}
}
}
}
}
}
float checkerboard_dist = min_d;
if (abs(rayDirection.y)>1e-3) {
float d = -(rayOrigin.y + 4) / rayDirection.y; // the checkerboard plane has equation y = -4
vec3 pt = rayOrigin + rayDirection * d;
if (d > 0 && abs(pt.x) < 10 && pt.z<-10 && pt.z>-30 && d < min_d) {
checkerboard_dist = d;
intersection.hit = true;
intersection.pos = pt;
intersection.N = vec3(0, 1, 0);
intersection.material = inSpheres[1].material;
}
}
return intersection;
return intersection;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment