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.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
400
redflash [portal] renderer / Raytracing Camp 10
gam0022
0
17
つぶやきGLSL解読! / Raytracing Camp 10
gam0022
0
200
LTC(Linearly Transformed Cosines)によるエリアライトのUnity URP実装
gam0022
1
24
redflash [4D] renderer / Raytracing Camp 9
gam0022
0
230
Object Space Raymarching in Unreal Engine 5.2
gam0022
0
300
IFSによるフラクタルのモデリング
gam0022
0
360
Transcendental Cube / グラフィックス解説
gam0022
1
160
redflash revolution renderer / Raytracing Camp 8
gam0022
0
3
Other Decks in Technology
See All in Technology
.NET 9 のパフォーマンス改善
nenonaninu
0
530
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
UI State設計とテスト方針
rmakiyama
2
320
MLOps の現場から
asei
6
630
2024年にチャレンジしたことを振り返るぞ
mitchan
0
130
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
270
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
180
5分でわかるDuckDB
chanyou0311
10
3.2k
Qiita埋め込み用スライド
naoki_0531
0
860
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
190
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
1
230
Featured
See All Featured
Navigating Team Friction
lara
183
15k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
The Pragmatic Product Professional
lauravandoore
32
6.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Documentation Writing (for coders)
carmenintech
66
4.5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Why Our Code Smells
bkeepers
PRO
335
57k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Designing for humans not robots
tammielis
250
25k
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 དྷͦ͜ύετϨΛ͍ͨ͠