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
450
redflash [portal] renderer / Raytracing Camp 10
gam0022
0
24
つぶやきGLSL解読! / Raytracing Camp 10
gam0022
0
260
LTC(Linearly Transformed Cosines)によるエリアライトのUnity URP実装
gam0022
1
39
redflash [4D] renderer / Raytracing Camp 9
gam0022
0
240
Object Space Raymarching in Unreal Engine 5.2
gam0022
0
330
IFSによるフラクタルのモデリング
gam0022
0
380
Transcendental Cube / グラフィックス解説
gam0022
1
160
redflash revolution renderer / Raytracing Camp 8
gam0022
0
3
Other Decks in Technology
See All in Technology
なぜfreeeはハブ・アンド・スポーク型の データメッシュアーキテクチャにチャレンジするのか?
shinichiro_joya
2
320
Copilotの力を実感!3ヶ月間の生成AI研修の試行錯誤&成功事例をご紹介。果たして得たものとは・・?
ktc_shiori
0
340
OPENLOGI Company Profile
hr01
0
58k
When Windows Meets Kubernetes…
pichuang
0
300
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.3k
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
350
Kotlin Multiplatformのポテンシャル
recruitengineers
PRO
2
150
Git scrapingで始める継続的なデータ追跡 / Git Scraping
ohbarye
5
480
Bring Your Own Container: When Containers Turn the Key to EDR Bypass/byoc-avtokyo2024
tkmru
0
840
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!座学①
siyuanzh09
0
110
.NET 最新アップデート ~ AI とクラウド時代のアプリモダナイゼーション
chack411
0
190
シフトライトなテスト活動を適切に行うことで、無理な開発をせず、過剰にテストせず、顧客をビックリさせないプロダクトを作り上げているお話 #RSGT2025 / Shift Right
nihonbuson
3
2.1k
Featured
See All Featured
Become a Pro
speakerdeck
PRO
26
5.1k
The Invisible Side of Design
smashingmag
299
50k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Practical Orchestrator
shlominoach
186
10k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
3
170
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Unsuck your backbone
ammeep
669
57k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
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 དྷͦ͜ύετϨΛ͍ͨ͠