NPR in Ray Tracing
description
Transcript of NPR in Ray Tracing
![Page 1: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/1.jpg)
NPR in Ray Tracing
Dan Maljovec
![Page 2: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/2.jpg)
ReferenceChoudhury, A. N. and Parker, S. G. 2009. Ray tracing NPR-style feature lines. In
Proceedings of the 7th international Symposium on Non-Photorealistic Animation and Rendering (New Orleans, Louisiana, August 01 - 02, 2009). S. N. Spencer, Ed. NPAR '09. ACM, New York, NY, 5-14.
![Page 3: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/3.jpg)
Ray Stencil
Compare:• Geometry ID (gs)
• Depth (ts)
• Normal (ns)
S
N = 1
![Page 4: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/4.jpg)
Types of Feature Lines
Compare:• Geometry ID (gs)
• Depth (ts)
• Normal (ns)
Intersections & silhouettes
Silhouettes& self-occluding
contours
Creases
S
N = 1
![Page 5: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/5.jpg)
Edge Strength Function
• You want the largest edge strength to be when half of your rays see something different
• Let M = # of stencil rays we are going to shoot
![Page 6: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/6.jpg)
Different Geometry
Compare:• Geometry ID
For each stencil ray rIf(gs != gr)
m++
Radiance = lambertian * eM(m)
S
M = # of stencil rays
Edge Strength Function
N = 1
![Page 7: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/7.jpg)
Depth Discontinuity
Compare:• Depth
For each stencil ray rIf(|ts – tr| > Td)
d++
Radiance = lambertian * eM(d)
Td = depth threshold
M = # of stencil rays
Edge Strength Function
N = 1
S
![Page 8: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/8.jpg)
Normal Discontinuity
Compare:• Normal
For each stencil ray rIf(||ns – nr|| > TN)
Radiance = black
TN = normal threshold
S
M = # of stencil rays
Edge Strength Function
N = 1
![Page 9: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/9.jpg)
Results
![Page 10: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/10.jpg)
Results
![Page 11: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/11.jpg)
Alternative Method
Do we need to shoot the ray stencil? – We already have that information from the neighboring rays
![Page 12: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/12.jpg)
Alternative Method
Do we need to shoot the ray stencil? – We already have that information from the neighboring rays
Solution: – Shoot one ray per pixel– Pass normal, geometry, color, and depth values to shader
that computes edge strengths.
![Page 13: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/13.jpg)
Alternative Method
Do we need to shoot the ray stencil? – We already have that information from the neighboring rays
Solution: – Shoot one ray per pixel– Pass normal, geometry, color, and depth values to shader
that computes edge strengths.
Ideally, you would want to pass the Optix buffers to a CUDA program and process in parallel– Eliminating the overhead of involving OpenGL
![Page 14: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/14.jpg)
Alternative Method
![Page 15: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/15.jpg)
Alternative Method
![Page 16: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/16.jpg)
Performance
Pure Optix Method• Works well for N = 1
– (5-point stencil)
• Slows down for N > 1
• Dependent on # of rays that need stencil rays
CG Hybrid Method• Slight stutter in animation
– Copy overhead?
• Scales better when N > 1
• Independent of number of scene layout
In practice, N > 2 doesn’t look very good, witness Exhibit A:
![Page 17: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/17.jpg)
N = 3
![Page 18: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/18.jpg)
N = 7
![Page 19: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/19.jpg)
Open Issue
![Page 20: NPR in Ray Tracing](https://reader036.fdocuments.us/reader036/viewer/2022081420/5681665c550346895dd9ddb1/html5/thumbnails/20.jpg)
Open Issue
No Feature LinesThrough glass