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
9k
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
480
redflash [portal] renderer / Raytracing Camp 10
gam0022
0
31
つぶやきGLSL解読! / Raytracing Camp 10
gam0022
0
300
LTC(Linearly Transformed Cosines)によるエリアライトのUnity URP実装
gam0022
1
54
redflash [4D] renderer / Raytracing Camp 9
gam0022
0
250
Object Space Raymarching in Unreal Engine 5.2
gam0022
0
360
IFSによるフラクタルのモデリング
gam0022
0
400
Transcendental Cube / グラフィックス解説
gam0022
1
160
redflash revolution renderer / Raytracing Camp 8
gam0022
0
3
Other Decks in Technology
See All in Technology
バックエンドエンジニアのためのフロントエンド入門 #devsumiC
panda_program
18
7.4k
管理者しか知らないOutlookの裏側のAIを覗く#AzureTravelers
hirotomotaguchi
2
350
モノレポ開発のエラー、誰が見る?Datadog で実現する適切なトリアージとエスカレーション
biwashi
6
800
Culture Deck
optfit
0
410
RECRUIT TECH CONFERENCE 2025 プレイベント【高橋】
recruitengineers
PRO
0
150
データ資産をシームレスに伝達するためのイベント駆動型アーキテクチャ
kakehashi
PRO
2
520
Developer Summit 2025 [14-D-1] Yuki Hattori
yuhattor
19
6.1k
開発組織のための セキュアコーディング研修の始め方
flatt_security
3
2.3k
『衛星データ利用の方々にとって近いようで触れる機会のなさそうな小話 ~ 衛星搭載ソフトウェアと衛星運用ソフトウェア (実物) を動かしながらわいわいする編 ~』 @日本衛星データコミニティ勉強会
meltingrabbit
0
140
Larkご案内資料
customercloud
PRO
0
650
Classmethod AI Talks(CATs) #16 司会進行スライド(2025.02.12) / classmethod-ai-talks-aka-cats_moderator-slides_vol16_2025-02-12
shinyaa31
0
100
2025-02-21 ゆるSRE勉強会 Enhancing SRE Using AI
yoshiiryo1
1
250
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Faster Mobile Websites
deanohume
306
31k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Rails Girls Zürich Keynote
gr2m
94
13k
Building an army of robots
kneath
303
45k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
12
960
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 དྷͦ͜ύετϨΛ͍ͨ͠