Slide 1

Slide 1 text

ύετϨʔγϯά ౉෦৺ !4IPDLFS@Y ϨΠτϨ߹॓ https://sites.google.com/site/raytracingcamp3/ PATH TRACING

Slide 2

Slide 2 text

ϨϯμϦϯάํఔࣜ Lo (x, o ) = Le (x, o ) + S2 Li (x, i )fs (x, i, o ) |n · i | d i ϞϯςΧϧϩ .$ ੵ෼ Lo (x, o ) = Le (x, o ) + Li (x, i )fs (x, i, o ) |n · i | p ( i ) ϥϯμϜʹαϯϓϧ͞Εͨೖࣹํ޲ i p ( i ) ɹΛαϯϓϧ͢Δ֬཰ີ౓ 1%' i

Slide 3

Slide 3 text

ೖࣹํ޲Λ֬཰తʹαϯϓϧɺޫݯʹ౰ͨΕ͹د༩Λܭࢉ ࢹ఺͔Βޫ༌ૹܦ࿏ΛτϨʔε

Slide 4

Slide 4 text

ೖࣹํ޲ͷαϯϓϦϯά %JGGVTF#4%' (MPTTZ#4%' 4QFDVMBS#4%' Ͳͷํ޲΋ࣅͨΑ͏ͳ஋ ڸ໘൓ࣹํ޲ͷ पғʹେ͖ͳ஋ ڸ໘൓ࣹํ޲Ҏ֎ͷ ஋͸θϩ গͳ͘ͱ΋#4%'͕େ͖ͳ஋Λ࣋ͭํ޲Λ ଟ͘αϯϓϧ͢Δͷ͕๬·͍͠à#4%'ͷॏ఺తαϯϓϦϯά

Slide 5

Slide 5 text

for (int j = 0; j < ImageHeight; ++j) { for (int i = 0; i < ImageWidth; ++i) { px = i + rnd01(); py = j + rnd01(); ray, We, dirPDF = sampleCameraRay(px, py); alpha *= We / dirPDF; // シーンと交叉判定 hit, surfPt = intersect(ray); if (!hit) break; while (true) { ... ray = Ray(surfPt.p, dir); // シーンと交叉判定 hit, surfPt = intersect(ray); if (!hit) break; // Russian Roulette if (rnd01() >= ProbRR) break; alpha /= ProbRR; } } } // 光源にヒットした場合、寄与を蓄積 if (surfPt.isEmitting()) contribution += alpha * surfPt.Le(-ray.dir); // BSDFの重点的サンプリング fs, dir, dirPDF = surfPt.BSDF.sample(rnd01(), rnd01()); alpha *= fs * absDot(surfPt.n, dir) / dirPDF; ϨϯμϦϯάํఔࣜ ͷ.$ੵ෼ ͦͷ·· Li (x, i )fs (x, i, o ) |n · i | p ( i )

Slide 6

Slide 6 text

ೖࣹํ޲Λ֬཰తʹαϯϓϧɺޫݯʹ౰ͨΕ͹د༩͕ͱΕΔ ࢹ఺͔Βޫ༌ૹܦ࿏ΛτϨʔε ͳ͔ͳ͔౰ͨΒͳ͍ʂ(ಛʹޫݯ͕খ͍͞ͱ͖)

Slide 7

Slide 7 text

NEXT EVENT ESTIMATION

Slide 8

Slide 8 text

NEXT EVENT ESTIMATION ޫݯ্ͷ఺Λ໌ࣔతʹαϯϓϧɺࢹઢܦ࿏ͱ઀ଓ͢Δ

Slide 9

Slide 9 text

for (int j = 0; j < ImageHeight; ++j) { for (int i = 0; i < ImageWidth; ++i) { px = i + rnd01(); py = j + rnd01(); ray, We, dirPDF = sampleCameraRay(px, py); alpha *= We / dirPDF; // シーンと交叉判定 hit, surfPt = intersect(ray); if (!hit) break; if (surfPt.isEmitting()) contribution += alpha * surfPt.Le(-ray.dir); while (true) { ... // BSDFの重点的サンプリング fs, dir, dirPDF = surfPt.BSDF.sample(rnd01(), rnd01()); alpha *= fs * absDot(surfPt.n, dir) / dirPDF; ray = Ray(surfPt.p, dir); // シーンと交叉判定 hit, surfPt = intersect(ray); if (!hit) break; // Russian Roulette if (rnd01() >= ProbRR) break; alpha /= ProbRR; } } } // 光源上の点を明示的にサンプルして現在の点と接続 lightSurfPt, areaPDF = sampleLightPoint(rnd01(), rnd01()); if (unoccluded(surfPt, lightSurfPt)) { shadowDir = normalize(lightSurfPt.p – surfPt.p); fs = surfPt.BSDF.eval(shadowDir, -ray.dir); G = absDot(surfPt.n, shadowDir) * absDot(lightSurfPt.n, shadowDir) / sqDistance(surfPt.p, lightSurfPt.p); contribution += alpha * fs * lightSurfPt.Le(-shadowDir) * G / areaPDF; } γϟυ΢ϨΠΛඈ͹ͯ͠ःณΛνΣοΫ ःณ͕ແ͚Ε͹د༩Λ஝ੵ

Slide 10

Slide 10 text

ʁʁʁ

Slide 11

Slide 11 text

// 光源上の点を明示的にサンプルして現在の点と接続 lightSurfPt, areaPDF = sampleLightPoint(rnd01(), rnd01()); if (unoccluded(surfPt, lightSurfPt)) { shadowDir = normalize(lightSurfPt.p – surfPt.p); fs = surfPt.BSDF.eval(shadowDir, -ray.dir); G = absDot(surfPt.n, shadowDir) * absDot(lightSurfPt.n, shadowDir) / sqDistance(surfPt.p, lightSurfPt.p); contribution += alpha * fs * lightSurfPt.Le(-shadowDir) * G / areaPDF; } ͜Ε͸Կʁ DPT߲ͭͱڑ཭ͷೋ৐ ͔֬ʹͦΕͬΆ͍߲͕ͩ ϨϯμϦϯάํఔࣜʹͦΜͳ߲͚͋ͬͨͬʁʁ

Slide 12

Slide 12 text

ແ͍ DPT߲ͻͱͭͩ͠ڑ཭ೋ৐΋ແ͍ Lo (x, o ) = Le (x, o ) + S2 Li (x, i )fs (x, i, o ) |n · i | d i

Slide 13

Slide 13 text

୯Ґͷ࿩

Slide 14

Slide 14 text

֬཰ʹ୯Ґ͸ແ͍͕֬཰ີ౓ 1%' ʹ͸୯Ґ͕͋Δ Lo (x, o ) = Le (x, o ) + Li (x, i )fs (x, i, o ) |n · i | p ( i ) #4%'ͷαϯϓϦϯάͰ͸ೖࣹํ޲ΛαϯϓϦϯά ํ޲ ཱମ֯ ʹؔ͢Δ1%' [sr 1] /FYU&WFOU&TUJNBUJPOͰ͸ޫݯ্ͷҐஔΛαϯϓϦϯά ෺ମද໘্ͷҐஔ ໘ੵ ʹؔ͢Δ1%' [m 2]

Slide 15

Slide 15 text

Ґஔʹؔ͢ΔαϯϓϦϯάͰ͸ ѻ͏ϨϯμϦϯάํఔ͕ࣜएׯมΘΔ Lo (x x ) = Le (x x ) + M Li (x x)fs (x x x )G(x x )dA x x x x ੵ෼߲͸γʔϯதͷ෺ମද໘ɹ্ͷੵ෼ͱͯ͠มܗ͞ΕΔ M زԿ߲ɹ͸ੵ෼ͷม਺ม׵ͷ݁Ռ ϠίϏΞϯ G

Slide 16

Slide 16 text

#4%'ͷαϯϓϦϯά /FYU&WFOU&TUJNBUJPO ͨͩ͠/FYU&WFOU&TUJNBUJPO͕ٯޮՌʹͳΔ͜ͱ΋

Slide 17

Slide 17 text

MULTIPLE IMPORTANCE SAMPLING ଟॏॏ఺తαϯϓϦϯά

Slide 18

Slide 18 text

Light ޫ୔BSDF #4%'ͷد༩ʹԊͬͨॏ఺తαϯϓϦϯά #4%'د༩ʹԊͬͯೖࣹํ޲αϯϓϧɿߴ͍֬཰Ͱߴ͍د༩ à௿͍෼ࢄ ޫݯ͕ྑ͍৔ॴʹ͋Ε͹ C = 1 N N i=1 f(¯ xi ) pBSDF (¯ xi )

Slide 19

Slide 19 text

Light ֦ࢄBSDF #4%'ͷد༩ʹԊͬͨॏ఺తαϯϓϦϯά #4%'د༩ʹԊͬͯೖࣹํ޲αϯϓϧɿ௿͍֬཰Ͱߴ͍د༩ àߴ͍෼ࢄ ͨ·ʹ͔͠౰ͨΒͳ͍ͨΊ C = 1 N N i=1 f(¯ xi ) pBSDF (¯ xi )

Slide 20

Slide 20 text

Light ֦ࢄBSDF ޫݯ্ͷҐஔͷॏ఺తαϯϓϦϯά ޫݯ্ͷҐஔΛαϯϓϧͯ͠઀ଓɿߴ͍֬཰Ͱߴ͍د༩ à௿͍෼ࢄ #4%'ͷ஋͕ൺֱతҰ༷Ͱ͋Ε͹ C = 1 N N i=1 f(¯ xi ) plight (¯ xi )

Slide 21

Slide 21 text

Light ޫ୔BSDF ޫݯ্ͷҐஔͷॏ఺తαϯϓϦϯά ޫݯ্ͷҐஔΛαϯϓϧͯ͠઀ଓɿ௿͍֬཰Ͱߴ͍د༩ àߴ͍෼ࢄ #4%'ͷ஋͕ඇҰ༷ͳͨΊ C = 1 N N i=1 f(¯ xi ) plight (¯ xi )

Slide 22

Slide 22 text

ޫݯ໘ͷαϯϓϦϯά #4%'ͷαϯϓϦϯά n  VEACH, E. 1997. Robust Monte Carlo methods for light transport simulation. PhD thesis, Stanford, CA, USA.

Slide 23

Slide 23 text

ଟॏॏ఺తαϯϓϦϯά C = 1 N N i=1 f(¯ xlight,i ) plight (¯ xlight,i ) C = 1 N N i=1 f(¯ xBSDF,i ) pBSDF (¯ xBSDF,i ) C = 1 N N i=1 wBSDF (¯ xBSDF,i ) f(¯ xBSDF,i ) pBSDF (¯ xBSDF,i ) + wlight (¯ xlight,i ) f(¯ xlight,i ) plight (¯ xlight,i ) ϛοΫεʂ

Slide 24

Slide 24 text

.*4΢ΣΠτ Ұྫ: όϥϯεώϡʔϦεςΟοΫ
 (΢ΣΠτ = ͦΕͧΕͷPDFͷॏΈ෇͖ฏۉ) C = 1 N N i=1 wBSDF (¯ xBSDF,i ) f(¯ xBSDF,i ) pBSDF (¯ xBSDF,i ) + wlight (¯ xlight,i ) f(¯ xlight,i ) plight (¯ xlight,i ) wBSDF (¯ x) = pBSDF (¯ x) pBSDF (¯ x) + plight (¯ x) wlight (¯ x) = plight (¯ x) pBSDF (¯ x) + plight (¯ x) (࣮ࡍʹ͸PDFͷ୯ҐΛ߹ΘͤΔඞཁ͕͋Δ)

Slide 25

Slide 25 text

όϥϯεώϡʔϦεςΟοΫɿཁ͢Δʹ BSDF ʮύε͖࣋ͬͯͨΑʯ ʮਪఆ݁Ռʹࣗ৴ͷ΄Ͳ͸ʯ BSDF ʮʯ ʮMJHIU͕Ծʹ͜ͷύεͭͬͨ͘ͳΒࣗ৴͸ʯ lightʮʯ ʮ͡Ό͋#4%'͕͖࣋ͬͯͨύεͷॏΈ͸ ɹ ͬͯ͜ͱͰʯ lightʮύε͖࣋ͬͯͨΑʯ ʮਪఆ݁Ռʹࣗ৴ͷ΄Ͳ͸ʯ lightʮʯ ʮ#4%'͕Ծʹ͜ͷύεͭͬͨ͘ͳΒࣗ৴͸ʯ BSDF ʮʯ ʮ͡Ό͋MJHIU͕͖࣋ͬͯͨύεͷॏΈ͸ ɹ ͬͯ͜ͱͰʯ

Slide 26

Slide 26 text

.*4ʹΑΔ΢ΣΠτ഑෼ .VMUJQMF*NQPSUBODF4BNQMJOH n  VEACH, E. 1997. Robust Monte Carlo methods for light transport simulation. PhD thesis, Stanford, CA, USA.

Slide 27

Slide 27 text

for (int j = 0; j < ImageHeight; ++j) { for (int i = 0; i < ImageWidth; ++i) { px = i + rnd01(), py = j + rnd01(); ray, We, dirPDF = sampleCameraRay(px, py); alpha *= We / dirPDF; hit, surfPt = intersect(ray); if (!hit) continue; if (surfPt.isEmitting()) contribution += alpha * surfPt.Le(-ray.dir); while (true) { ... // BSDFの重点的サンプリング fs, dir, dirPDF = surfPt.BSDF.sample(rnd01(), rnd01()); alpha *= fs * absDot(surfPt.n, dir) / dirPDF; ray = Ray(surfPt.p, dir); hit, surfPt = intersect(ray); if (!hit) break; ... // Russian Roulette if (rnd01() >= ProbRR) break; alpha /= ProbRR; } } } // 光源上の点を明示的にサンプリングして現在の点と接続 lightSurfPt, lightPDF = sampleLightPoint(rnd01(), rnd01()); if (unoccluded(surfPt, lightSurfPt)) { shadowDir = normalize(lightSurfPt.p – surfPt.p); cosShd = absDot(surfPt.n, shadowDir); cosLight = absDot(lightSurfPt.n, shadowDir); dist2 = sqDistance(surfPt.p, lightSurfPt.p); fs = surfPt.BSDF.eval(shadowDir, -ray.dir); G = cosShd * cosLight / dist2; // 単位をlightPDF[m^-2]に合わせる。 bsdfPDF = surfPt.BSDF.evalDirectionalPDF(shadowDir, -ray.dir) * cosLight / dist2; MISWeight = lightPDF / (bsdfPDF + lightPDF); contribution += alpha * MISWeight * fs * lightSurfPt.Le(-shadowDir) * G / lightPDF; } /FYU&WFOU&TUJNBUJPO.*4΢ΣΠτ

Slide 28

Slide 28 text

for (int j = 0; j < ImageHeight; ++j) { for (int i = 0; i < ImageWidth; ++i) { px = i + rnd01(), py = j + rnd01(); ray, We, dirPDF = sampleCameraRay(px, py); alpha *= We / dirPDF; hit, surfPt = intersect(ray); if (!hit) continue; if (surfPt.isEmitting()) contribution += alpha * surfPt.Le(-ray.dir); while (true) { ... // BSDFの重点的サンプリング fs, dir, dirPDF = surfPt.BSDF.sample(rnd01(), rnd01()); alpha *= fs * absDot(surfPt.n, dir) / dirPDF; ray = Ray(surfPt.p, dir); hit, surfPt = intersect(ray); if (!hit) break; ... // Russian Roulette if (rnd01() >= ProbRR) break; alpha /= ProbRR; } } } // 光源にヒットした場合、寄与を蓄積 if (surfPt.isEmitting()) { cosLight = absDot(ray.dir, surfPt.n); dist2 = sqDistance(ray.org, surfPt.p); bsdfPDF = dirPDF; // 単位をbsdfPDF[sr^-1]に合わせる。 lightPDF = surfPt.evalAreaPDF() * dist2 / cosLight; MISWeight = bsdfPDF / (bsdfPDF + lightPDF); contribution += alpha * MISWeight * surfPt.Le(-ray.dir); } #4%'4BNQMJOH.*4΢ΣΠτ

Slide 29

Slide 29 text

DEPTH OF FIELD ඃࣸքਂ౓

Slide 30

Slide 30 text

ബϨϯζϞσϧΛ༻͍ͨ%P'දݱ ཧ࿦ɾखॱͷৄࡉ͸8ϖʔδࢀর ୺తʹड़΂Δͱʜ xp x0 x1 x1 x0 xp x1 γʔϯதͷҐஔ ηϯαʔ໘ ෺໘ Ϩϯζ্ͷ఺ɹΛαϯϓϧɺ ϐΫηϧதͷҐஔɹʹରԠ͢Δ෺໘্ͷ఺ɹʹ޲͔ͬͯϨΠτϨʔε ϨϯζҐஔͷαϯϓϧΛߦ͍ͬͯΔͷͰ1%'ɹɹɹͰد༩ΛׂΔ pA (x0 )

Slide 31

Slide 31 text

࣮૷͢Δͱʜ ϐϯϗʔϧ ബϨϯζϞσϧʹΑΔ%P'

Slide 32

Slide 32 text

ͪΌΜͱϘέͯΔΈ͍͚ͨͩͲ ϐϯϗʔϧͱ໌Δ͞ҧ͏͠ɺ Ϩϯζͷେ͖͞ʹΑͬͯ໌Δ͞มΘΔʜ ݱ࣮ͷΧϝϥͱҰॹ Ϩϯζ͕େ͖͚Ε͹औΓೖΕΔޫͷྔ͕૿͑ͯ໌Δ͘ͳΔ àը૾ͷ໌Δ͞ΛҰఆʹอ͍ͪͨͷͳΒ ηϯαʔͷײ౓Λมߋ͢Δඞཁ͕͋Δ

Slide 33

Slide 33 text

ηϯαʔͷײ౓Λద੾ʹઃఆ͢Δͱʜ ϐϯϗʔϧ ബϨϯζϞσϧʹΑΔ%P'

Slide 34

Slide 34 text

ͪΐͬͱ଴ͯ

Slide 35

Slide 35 text

ϐϯϗʔϧΧϝϥ͸ബϨϯζϞσϧͰ Ϩϯζ͕ۃݶʹখ͍͞৔߹ͱଊ͑Δ͜ͱ͕Ͱ͖Δ à1%'ͷ஋͕ແݶͱͳΔͷͰɺ1%'ͰׂΔͱ݁Ռ͸θϩ Ϩϯζ͕େ͖͍ఔը૾͕໌Δ͍ͷ͸౰ͨΓલ ͡Ό͋ϐϯϗʔϧΧϝϥͷը૾͸ਅͬ҉ͳͷͰ͸ʜʁ ͋Δҙຯਖ਼ղ ॳาతͳύετϨ౳ͷ࣮૷Ͱ͸ ͦ΋ͦ΋Ϩϯζ໘ͷ1%'ͰׂͬͨΓ͍ͯ͠ͳ͍ à1%'ΛΩϟϯηϧ͢Δ͚ͩͷ ແݶͷηϯαʔײ౓͕͋Δͷͱ౳͍͠

Slide 36

Slide 36 text

͓͠·͍ *#-ͱ͔৭ʑ࿩͔͚ͨͬͨ͠Ͳ ͦͷ͏ͪ8ϖʔδʹॻ͖·͢ IUUQTSBZTQBDFYZ[$(