Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SDF を作りたかった
Search
Yuichi Sato
January 29, 2021
Programming
560
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SDF を作りたかった
Blender で作成したベクトル場を Unity で利用する
https://qiita.com/YuichiSato/items/bc160896b5883f1a125b
Yuichi Sato
January 29, 2021
More Decks by Yuichi Sato
See All by Yuichi Sato
深層学習学習中
satoyuichi
0
55
深層学習はじめました
satoyuichi
0
64
瞑想アプリ
satoyuichi
0
53
初めての iPhone ネイティブアプリ
satoyuichi
0
70
キャンフェスにゲームを出そう -StruckOut 編-
satoyuichi
0
33
ミクちゃんが歌ったら 家に帰ろう
satoyuichi
0
25
体温記録送信アプリ
satoyuichi
0
32
コロナ横目にバージョンアップ
satoyuichi
0
87
本日のシェーダー芸
satoyuichi
1
820
Other Decks in Programming
See All in Programming
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
390
パスワード再設定メールのURLについて知っておこう
uyuki234
0
140
最近”作らせてる” ローカルAIアプリの話
akit37
0
460
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
golang-bob.pdf
iwatsukayura
0
130
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
480
パーソナライズPodcastを作った話
repunit11
0
140
速習iPhone Duo対応
yuukiw00w
2
980
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
1
310
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
170
残高管理から台帳サービスへの進化
artoy
1
200
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
440
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
340
Become a Pro
speakerdeck
PRO
31
6.3k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
220
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
580
My Coaching Mixtape
mlcsv
0
350
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Transcript
SDF を作りたかった 2020年12月24日 佐藤雄一
自己紹介 名前:佐藤 雄一 好物:エレキギター、(初期)仏教、Smalltalk Twitter:@satoyuichi80 趣味:読書、ギター演奏、映画鑑賞 最近好きなTV番組: 「サンドウィッチマン& 芦田愛菜の博士ちゃん」
目的 Unity の Visual Effect Graph で使う SDF データを作るため。下の画像の Teapot
の ように形状を表現するための 3D テクスチャを生成したかった。
Signed Distance Field(SDF)とは 内側で負、境界でゼロ、外側で正となり、形状表面からの距離を示す。これを二次元 や三次元テクスチャとして持ち、形状を表現する。 出所)https://niteeshyadav.com/blog/the-current-state-of-the-text-in-augmented-reality-7507/
が、しかし 手持ちのソフトで SDF を手軽に出力する方法がないようなので、ひとまず Blender で ベクトル場を作って、Unity にインポートすることにした。 SDF とベクトル場の違いは各ボクセルにスカラー値を持つか、ベクトル値を持つかな
ので、どちらかで対応できればもう片方にも適用できるはずと判断した。
Unity で .vf ファイルがインポートできることがわかったので、Blender のアドオンと組 み合わせて以下の順序で生成することにした。 生成順序 .fga をエクスポート (C
で作ったコンバータで ) .fga を .vf に変換 .vf を出力 Unity にインポート Blender でベクトル場を生成
Blender で作ったベクトル場 中心に吸い込み型の力場を作って、その力の方向を各ボクセルに記録しているよう す。
.fga ファイルの構造 Blender のアドオンを使ってベクトル場を作り .fga ファイルをエクスポートする。.fga ファイルはアスキー形式で、以下のような構造になっている。 分割数 X Y
Z BBox 最小値 X 座標 Y 座標 Z 座標 BBox 最大値 X 座標 Y 座標 Z 座標 Vector X 値 Y 値 Z 値 ...
.vf ファイルの構造 .vf ファイルはバイナリ形式で以下のような構造になっている。 • Float(用途:SDF) • Vector(用途:Vector Field, Vector
Gradient Field) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 FourCC(VF_V) X 分割数 Y 分割数 Z 分割数 ベクトル値(float, float, float) ... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 FourCC(VF_F) X 分割数 Y 分割数 Z 分割数 スカラー値 ...
結果
今後の展望 • Blender で SDF を作るアドオンを開発する • Blender で VGF(Vector
Gradient Field)を作るアドオンを開発する …が、すでにある気がする(調べた限りではないけど
参考資料 • Qiita(https://qiita.com/YuichiSato/items/bc160896b5883f1a125b) • Blender - FGA Vector Field Editor(https://github.com/isathar/Blender_UE4_VectorFieldEditor)
• VF : VectorField file format(https://github.com/peeweek/VectorFieldFile/blob/master/README.md) • fga2vf(https://github.com/satoyuichi/fga2vf)