210 likes | 441 Views
CS 535. Mapping Techniques. Raytracing provides a wealth of information about the visible surface point:Position, normal, texture coordinates, color
E N D
1. CS 535 Advanced Ray Tracing
2. CS 535 Mapping Techniques Raytracing provides a wealth of information about the visible surface point:
Position, normal, texture coordinates, color…
Raytracing also has great flexibility
Every point is computed independently, so effects can easily be applied on a per-pixel basis
Reflection and transmission and shadow rays can be manipulated for various effects
Even the intersection point can be modified
3. CS 535 Texture Mapping Define texture parameters over the surface
Determine texture parameters at each hit point
Use them to look up a texture map, just as with OpenGL
But…
Can also use them to look up other things…
4. CS 535 Bump Mapping Vary the surface normal vector according to some map
Influences shading and reflection and refraction
Variation may be
random - for effects like stucco
or structured - for effects like tiles
5. CS 535 Shadow Sharp shadows caused by point light sources
Real light sources extend over an area (area light sources) and cast soft-edged shadows
Some points see all the light - fully illuminated
Some points see none of the light source - the umbra
Some points see part of the light source - the penumbra
6. CS 535 Soft Shadows
7. CS 535 Soft Shadow Implementation To ray-trace area light sources, cast multiple shadow rays
Each one to a different point on the light source
Weigh illumination by the number that get through
8. CS 535 Aliasing Raytracing can alias badly
Each ray is a single point sample
multiple objects may cover portions of a pixel domain
The ray hits the red object and thus the entire pixel is colored red
9. CS 535 Cone Tracing Amanatides SIGGRAPH 84
Replace rays with cones
Cone samples pixel area
Intersect cone with objects
Analytic solution of cone-object intersection similar to ray-object intersection
Expensive
10. CS 535 Anti-aliasing Solution
Send out multiple rays per pixel; determine their respective colors, then average the results
11. CS 535 Anti-Aliasing Eye is extremely sensitive to patterns
Remove pattern from sampling
Randomize sampling pattern
12. CS 535 Accelerated Shadow Calculation Enclose each light source with a cube
Subdivide each face of the cube and determine the potentially visible objects that could projected into each sub-region
Keep a sorted list of objects at each subdivision cell
Now shadow ray need only be intersected with appropriate list!
13. CS 535 Shadow Caching Any interloper between surface point x and the light source s will cast a shadow
Doesn’t matter how many
Doesn’t matter which is closest
Stop ray intersections once any intersection found
Neighboring shadowed surface points x and x’ probably shadowed by the same object
Start shadow ray intersection search with object intersected in last shadow search
14. CS 535 Accelerated Ray Tracing The rendering time for a ray tracer depends on
The number of rays cast which is proportional to the number of pixels.
the number of ray intersection tests that are required for each ray. This is roughly dependent on the number of primitives.
We need to reduce the number of intersection tests.
15. CS 535 Bounding Volumes
16. CS 535 Hierarchical Bounding Volume Initial objects in the scene
17. CS 535 Hierarchical Bounding Volume Group objects into bounding volumes
18. CS 535 Hierarchical Bounding Volume Group groups
19. CS 535 Hierarchical Bounding Volume This can be represented as a tree structure
Root is the entire volume
Each internal bounding volume has sub-volumes
If ray misses a node’s bounding volume, then no need to check any node beneath it
If ray hits a node’s BV, then replace it with its children’s BV’s (or geometry)
20. CS 535 Spatial Subdivision Idea: Divide space in to sub-regions
Place objects within a sub-region into a list
Only traverse the lists of sub-regions that the ray passes through
Must avoid performing intersections twice if an object falls into more than one region
21. CS 535 Tagging Ray-object intersection test valid for ray with entire object
not just portion of object inside current cell
Need only intersect object once for each ray
In cell A – list = {#1}
Intersect r with #1? Yes
Miss ? Tag #1 with no-intersection
In cell B – list = {#2}
Intersect r with #2? Yes
ray r hits object #2 but later in cell C
Tag object #2 with intersection-at-D
In cell C – list = {#1,#2}
Intersect r with #1? No (no-intersection)
Intersect r with #2? No (intersection-at-D)
In cell D – list = {#2}
Intersect r with #2? No (intersection-at-D)
22. CS 535 Other Partitioning Structures Octree
Ray can parse through large empty areas
Requires less space than grid
Subdivision takes time
Binary Space Partition (BSP) Tree
Planes can divide models nearly in half
Trees better balanced, shallower
Added ray-plane intersections