Top Banner
3/23/2005 © Dr. Zachary Wartell 1 Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144, 1993. Presentation Revision 1.0
38

3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 1

“Stereoscopic ray-tracing”

Stephen J. Adelson and Larry F. Hodges

The Visual Computer, vol. 10, no. 3, pp. 127--144, 1993.

Presentation Revision 1.0

Page 2: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 2

Abstract

• approximate ray-trace stereoscopic image pair• save 50%-95% computation on second view• present worst case performance

– at least as good as two pass approach

Page 3: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 3

Ray-Tracing Methods• “reverse” light-path tracing from geometric optics• better model global illumination

COP

View Window

Page 4: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 4

Ray-Tracing Tree

PT1

T3

R1 R2

R3

R4

S1 S2

S4S3

S1

S3 S2

S4

R1

R3

R4

T3 R2

T1

●primary ray recursively spawns T and R “secondary” ray●creates ray-tracing tree●stopping condition:

-ray intersects no surface-ray intersects non-reflecting light source-tree reaches pre-determined maximum depth

Page 5: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 5

Prior Work

• similar to animation of camera – take advantage of temporal coherence– visibility differences: occlusion & object-

frustum intersection• Badt (1988) – reprojection for r.t. when viewpoint

moves slightly– moves pixels to inferred position– cleanup unknown or questionable pixels

• new approach is more exact – take advantage of stereo geometry

Page 6: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 6

Notation

• left-handed coordinate system!

sl sr

Basic:

Stereo:

y =y

/ 2 , /

s p p

s p p

p p

sl p p p sr sl p p

x x d z d

y y d z d

y d z d

x x d z e z d x x e z d z

Page 7: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 7

Differences in left & right views

• left/right image due to diff. surface visibility per eye & eyepoint dependent optical phenomena

• Visibility 3 Cases:– missing pixel problem– overlapped pixel problem– bad pixel problem

Page 8: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 8

Missing Pixel Problem

• data structure for reprojected right image scanline:

• if no left image pixel reprojects to a given right image pixel, P, then we just have to re-r.t.’s through P for right image

struct { boolean wasReprojected; Color color; } [SCAN_LINE_WIDTH]

Page 9: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 9

Overlapping Pixel Problem

z dT

d

-d

●denominator of T < denominator of T0 implies T0 < T●hence object surface at T0 is closer than one a T●process pixels left to right & overwrite scanline causes the nearest surface color to be the final reprojected color

Z+

Page 10: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 10

Bad Pixel Problem

x, x+1

New(x) New(x+1)diff > 1

detect diff > 1, so clear interveningpixel (force re-r.t.)

Page 11: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 11

Bad Pixel Problem: Final Pixel Problem

LR

last pixel

move left

Problem!

R=New(L)

must clear pixel’s

to forcere-r.t.

Page 12: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 12

Pseudo-Code

struct { boolean hit; Color color; } line_rec [M]

Page 13: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 13

Another Variation

• algorithm scans left to right & handles overlapping pixels by overwriting; it is also possible to scan right to left and only write once (check if .HIT=FALSE)

• this avoids overwrites and the algorithm could be further adjusted to handle the bad pixel problem with right-to-left scan, but:– right-to-left scan would require an additional

clearing of the scan-line data structure at every pass which negates the benefit of avoid overwrites

Page 14: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 14

Performance

• Test cases: – 20 ellipsoids, random size, position, color– 512 x 512 pixels (262144 pixels)

Page 15: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 15

Results:

• 7.07% right eye pixels need re-tracing!• many due to left side

Theory:

assume 1st col. of left image is

empty (zp=∞), then pixels reproj.

by e. This causes pix. gap (bad pix. prob.) which forcese N pixels to be re-r.t.’ed

in test examples this would be 4.39% of the image

Page 16: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 16

Results:

• time comparison:– 504 s (ave) for left eye*2 vs 291 s (ave) for

new alg. Savings of 84%!• correctness:

– 14.6% of r.e. pixels differ from std. r.e. image• average difference (dist. in RGB space): 0.60%

• anecdotally the two version look identical

Page 17: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 17

Extension 1: N rays per pixel

• better image quality and anti-aliasing• assume 9 rays per pixel

– share data from left pixel’s right row & lower pixels top row → x 4 computation

aiming ray

(requires slight adjustment to “bad-pixel” solution)

Page 18: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 18

Results:

• test 30 scenes, results averaged over• Frame Time: 1075 s (3.69 x 1-ray/pixel)• Missed Ray: 20K, 7.84% (9.93% more than 1-

ray/pix)• Alg. Speed Up: 80% (vs 84% 1-ray/pix)• Pixel Errors: 15.6% pixels in error by 0.72%

distance in RGB space

Page 19: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 19

Extension 2: Reflection & Refraction

• before only z is needed, now we need:– Refl: normal on 3D surface– Refr: normal, object shape, exit normal, index

of refraction• generally, reprojection alg. only useful for first-

level of ray-tracing, but– stereo alg. may still be benefitial in “real-

world” scenes where refl. & refr. surfaces are small %

Page 20: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 20

Experiment

• spawn 2 rays, 1 per eye, for all r.t. levels beyond first one

• 125 ellipsoids (w/ spec. highlighs):– no refl. / refr.– 10% refl. ellipsoids– 10% refr. ellipsoids– 10% refr. & 10% refl. ellipsoids

Page 21: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 21

Experiment: no refl./no refr.

Page 22: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 22

Experiment: 10% refl./10% refr.

Page 23: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 23

Results:

• savings drops off but is still high

Page 24: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 24

Results with 100/1000 ellipsoid scenes:

• 80 object scene – only reflective sphere• rest 10% refl.,10% refr., 80% spec. highlights

Page 25: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 25

Quantitization Error

• up to ½ pixel• refr. pixel color is correct (due to 2-ray

approach), but wronglocation

Error

reprojection

stereo alg. reusescalc. of primary ray.

but spawns 2, 2ndary (refr.) rays, 1 per eye

rRrL

Page 26: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 26

Errors

• error up to 1.5% inRGB distance (%0.61in diffuse case)

• worst error pixelsin refr. objects

• Binocular rivalry cancreate problems

RGB diff’s enhanced 25 fold

Page 27: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 27

N-rays per pixel (revisited)

• ‘aiming’ ray approach not good enough• instead: multiply row and columns by n & filter

each n x n block. jitter ray through each sub-pixel. Computation increases by n2

• better: adaptive super-sampling– recursively subdivide when colors at r.t.’ed

points aren’t similar enough

Page 28: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 28

Adaptive Super-sampling in Stereo Alg.

• k levels , n = 2k + 1 for n x n blocks• r.t. through (1,1),(n,1), (1,n), (n,n) if colors not in

tolerance then r.t. (n/2,1),(1,n/2), (n/2,n/2),(n,n/2), (n/2,n)

• use reprojection technique on each of n rows• reuse bottom row and left column

Page 29: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 29

Experiment

• Use k=2 and k=3 max. level of super-adaptive sampling

Page 30: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 30

Experiment

Page 31: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 31

Experiment

Fig. 5 – ellipsoids diffuseFig. 8 - ellipsoids 10% refl./10% refr.Fig. 10 – spheres in rowsFig. 12 – 1000 ellipsoidsFig. 13 – “buzz“

Page 32: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 32

Theoretical worst cases

• 75% - 95% of computation in r.t. is intersection tests – not color computations

• theoretical analysis focus on savings in # of rays generated

• 1 theoretical failure not to problematic in practice

Page 33: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 33

Worst case

• Qualitative:– object close to left eye, unseen by right eye– wall between left and right eye

• in above stereo alg. no worse than standard r.t.• Quantitative

– N - # of primary rays in left eye view– M - % of prim. rays needing re-r.t. in right view; [0,1]– S - # of light sources– L – maximum r.t. recursion depth– v – # of levels of refl. and refr. (v ≤ L)

Page 34: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 34

Worse case analysis

• No light: (full: N p-ray’s, reproj:MN p-ray’s): 100(1-M) %

• Diffuse: (full: N p-ray’s, NS s-ray’s, reproj: MN p-ray’s MNS s-ray’s:100(1-M) %

• Diffuse & (Refl. or Refr.): v = L : 100 * ((1-M)/L) % v < L : 100 * (1-M)(1+S)/((1+S) v +1) %

• Diffuse & Refl. & Refr.: v = L : 100 * (1- M)*(1/2L-1))% v < L : 100 * (1- M)*(1+S)/((2v-1)(1+S)+2v)%

• 100% Refl. or Refr.: v = L : 100 * (1- M)* L% v < L : 100 * (1- M)*(1- v/(v+1))%

• Refl. & Refr. (¬Diffuse): v = L : 100 * (1- M)*(1/(2L-1))% v < L : 100 * (1- M)*(1/(2v+1-1))%

Page 35: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 35

Worst case assuming L=5 (and v=L)

●unless each eye see’s diff. scene, stereo alg. is better●in all cases stereo alg. is no worse than std. two pass alg.

Page 36: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 36

Factors affecting M• M increases with e : reproj. dist. max. = e. Hence larger e

yields larger left-hand side gaps which bad-pixel prob. solution forces a r.t. on;

• more crowded image → less likely to have large z differences in consecutive i.e. pixels → smaller pixel gaps → less re-r.t.’ing– M is 0.15 in sparse 20 ellipsoid case and 0.05 in 1000

ellipsoid case• rendering method : 1-ray/pixel M < 0.18, adaptive super-

sampling greater k implies higher M, for k =2,3 M < 0.3

reproj. doesn’t alwaysyield savings

Page 37: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 37

Factors affecting M: Reprojection Quantum

reproj. quantum : depth range z[znear, zfar] where reproj. distance is some constant K

assume: e=13,d=512

Page 38: 3/23/2005 © Dr. Zachary Wartell 1 “Stereoscopic ray-tracing” Stephen J. Adelson and Larry F. Hodges The Visual Computer, vol. 10, no. 3, pp. 127--144,

3/23/2005 © Dr. Zachary Wartell 38

Conclusions

• reprojection alg. can save up to 95% (worst ex. was 50%)

• limitations: – restricts pixel processing order– for refl. & refr. need N-rays/pixel due to pixel

quantization error• alg. less efficient with lots of refl. and refr. but

always better than standard r.t.