npr in ray tracing
DESCRIPTION
NPR in Ray Tracing. Dan Maljovec. Reference. - PowerPoint PPT PresentationTRANSCRIPT
NPR in Ray Tracing
Dan Maljovec
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.
Ray Stencil
Compare:• Geometry ID (gs)
• Depth (ts)
• Normal (ns)
S
N = 1
Types of Feature Lines
Compare:• Geometry ID (gs)
• Depth (ts)
• Normal (ns)
Intersections & silhouettes
Silhouettes& self-occluding
contours
Creases
S
N = 1
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
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
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
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
Results
Results
Alternative Method
Do we need to shoot the ray stencil? – We already have that information from the neighboring rays
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.
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
Alternative Method
Alternative Method
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:
N = 3
N = 7
Open Issue
Open Issue
No Feature LinesThrough glass