Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
tsukihiができるまで #レイトレ合宿4
Search
がむ
August 27, 2016
Technology
1
8.8k
tsukihiができるまで #レイトレ合宿4
レイトレ合宿4で発表したレンダラーtsukihiの紹介です。
https://sites.google.com/site/raytracingcamp4/
がむ
August 27, 2016
Tweet
Share
More Decks by がむ
See All by がむ
距離関数を極める! / SESSIONS 2024
gam0022
0
280
redflash [portal] renderer / Raytracing Camp 10
gam0022
0
12
つぶやきGLSL解読! / Raytracing Camp 10
gam0022
0
16
LTC(Linearly Transformed Cosines)によるエリアライトのUnity URP実装
gam0022
1
10
redflash [4D] renderer / Raytracing Camp 9
gam0022
0
210
Object Space Raymarching in Unreal Engine 5.2
gam0022
0
280
IFSによるフラクタルのモデリング
gam0022
0
330
Transcendental Cube / グラフィックス解説
gam0022
1
150
redflash revolution renderer / Raytracing Camp 8
gam0022
0
2
Other Decks in Technology
See All in Technology
B2B SaaS × AI機能開発 〜テナント分離のパターン解説〜 / B2B SaaS x AI function development - Explanation of tenant separation pattern
oztick139
2
220
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
12k
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
フルカイテン株式会社 採用資料
fullkaiten
0
40k
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
360
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
750
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
510
SSMRunbook作成の勘所_20241120
koichiotomo
2
120
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
Lambdaと地方とコミュニティ
miu_crescent
2
370
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
430
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
Practical Orchestrator
shlominoach
186
10k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Rails Girls Zürich Keynote
gr2m
94
13k
Ruby is Unlike a Banana
tanoku
97
11k
Transcript
CPU RENDER tsukihi Sho Hosoda / @gam0022
None
UTVLJIJ͕Ͱ͖Δ·Ͱ 1
͓ “Rendering a beautiful image within 5 minutes.”
ϨΠϚʔνϯά×ύετϨʔγϯά ̑Ͳ͜Ζ͔ ̑࣌ؒͩͬͨ…
Ͳ͏ͬͯ ̑Ҏʹඳը͢Δʁ
४උ࣌ؒ εΩϧΓͳ͍ʜʜ
ઓུ ٖࣅදݱͰޡຐԽͦ͏ʂ
UTVLJIJͷಛ 2
⁞ϨΠͱγʔϯͷিಥఆϨΠϚʔνϯά ϥϯόʔτࣹʹΑΔݹయతͳγΣʔσΟϯά ٖࣅ"0ٖࣅίʔςΟΫεΛՃ্࣭͑ͯ
⁞ϨΠͱγʔϯͷিಥఆϨΠϚʔνϯά ϥϯόʔτࣹʹΑΔݹయతͳγΣʔσΟϯά ٖࣅ"0ٖࣅίʔςΟΫεΛՃ্࣭͑ͯ
w ڑؔʢӄؔʣͰදݱ͞Εͨγʔϯͱ ϨΠͱͷަΛۙతʹٻΊΔख๏ w ϑϥΫλϧਤܗڑؔͰఆٛͰ͖Δ w ࢀߟࢿྉʢ4MJEF4IBSFʣ γΣʔμ͚ͩͰੈքΛΔʂUISFFKTʹΑΔϨΠϚʔνϯά ϨΠϚʔνϯά
struct RaymarchingSphere : public RaymarchingObject { public: RaymarchingSphere(const Vec3 &position,
const double scale, const Color &emission, const Color &color, const ReflectionType reflection_type) : RaymarchingObject(position, scale, emission, color, reflection_type) { } double distanceFunction(const Vec3 &p) const { return length(p - position) - scale; } }; code ϨΠϚʔνϯάͷΦϒδΣΫτͷఆٛ 3BZNBSDIJOH0CKFDUΛܧঝͯ͠EJTUBODF'VODUJPOΛ࣮͢ΕΑ͍ઃܭ
const double mengerSpongeLoop(const Vec3& p) const { double d =
0.0; const double one_third = 1.0 / 3.0; for (int i = 0; i < 4; i++) { double k = pow(one_third, i); double kh = k * 0.5; d = std::max(d, -crossBar(mod(p + kh, k * 2.0) - kh, k * one_third)); } return d; } code ϝϯΨʔͷεϙϯδͷແݶ൛ͷڑؔ
⁞ϨΠͱγʔϯͷিಥఆϨΠϚʔνϯά ϥϯόʔτࣹʹΑΔݹయతͳγΣʔσΟϯά ٖࣅ"0ٖࣅίʔςΟΫεΛՃ্࣭͑ͯ
w ී௨ͷϥϯόʔτࣹ w ޫݯٿޫݯͷΈ w ڑͷٯଇʹΑΔޫͷݮਰ ݹయతͳγΣʔσΟϯά
⁞ϨΠͱγʔϯͷিಥఆϨΠϚʔνϯά ϥϯόʔτࣹʹΑΔݹయతͳγΣʔσΟϯά ٖࣅ"0ٖࣅίʔςΟΫεΛՃ্࣭͑ͯ
w ΦϯϥΠϯϨϯμϦϯάͷσϞγʔϯͰ ༻͍ΒΕΔख๏Ͱ"0ιϑτγϟυΛٖࣅදݱ w ίʔςΟΫεٖࣅදݱʢྗٕʣ ٖࣅදݱʹΑΔ্࣭
"0ແ "0༗ ݀ͷःณ෦͕҉͘ͳΔ ٖࣅ"0
"0ແ "0༗ ٖࣅͱ͍͑ɺޮՌൈ܈ ٖࣅ"0
inline double calcAO(const Vec3 pos, const Vec3 normal) { double
k = 1.0, occluded = 0.0; for (int i = 0; i < 5; i++) { double length = 1.5 * i; double distance = map(normal * length + pos); occluded += (length - distance) * k; k *= 0.3; } return clamp(1.0 - occluded, 0.0, 1.0); } code ٖࣅ"0
ٖࣅ"0 occluded += (length - distance) * k; ःณͳ͠ EJTUBODFMFOHUI
ःณ͋Γ EJTUBODFMFOHUI
ٖࣅίʔςΟΫε ٖࣅίʔςΟΫε ύετϨʔγϯάʹΑΔ ίʔςΟΫε
inline double calcCaustics(const Vec3 pos, const Vec3 light_dir, const double
distance) { for (int i = 0; i < 20; i++) { Vec3 p = pos + light_dir * depth_to_refraction; d_to_refraction = refraction_map(p); if (std::abs(distance - depth_to_refraction) < kEPS || depth_to_refraction > depth_to_other) break; if (std::abs(d_to_refraction) < kEPS) { Vec3 n = calcRefractionNormal(p); return 1.0 + pow(1.07 * std::max(dot(n, -light_dir), 0.0), 100.0); } depth_to_refraction += d_to_refraction; } return 1.0; } code ٖࣅίʔςΟΫε
ٖࣅίʔςΟΫε w EPU O MJHIU@EJS MJHIU@EJSিಥ͔ΒޫݯͷϕΫτϧ O۶ંΦϒδΣΫτͷ๏ઢ
w ୯७ͳੵ͕ͩɺٿମʹݶΓͦΕͬΆ͘ͳΔ w ಾͷͱ͍͏ఆ return 1.0 + pow(1.07 * std::max(dot(n, -light_dir), 0.0), 100.0);
1280x960px 4spp 37.24sec @Core i7-6700K 4core Λେ͖͘Լճͬͨʂ
ιʔείʔυ w IUUQTHJUIVCDPNHBNUTVLJIJ w FEVQUΛGPSL࣮ͯ͠ʢIPMF͞Μʹײँʂʣ w དྷͦ͜ύετϨΛ͍ͨ͠