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
SDF を作りたかった
Search
Yuichi Sato
January 29, 2021
Programming
0
430
SDF を作りたかった
Blender で作成したベクトル場を Unity で利用する
https://qiita.com/YuichiSato/items/bc160896b5883f1a125b
Yuichi Sato
January 29, 2021
Tweet
Share
More Decks by Yuichi Sato
See All by Yuichi Sato
深層学習学習中
satoyuichi
0
27
深層学習はじめました
satoyuichi
0
43
瞑想アプリ
satoyuichi
0
38
初めての iPhone ネイティブアプリ
satoyuichi
0
54
キャンフェスにゲームを出そう -StruckOut 編-
satoyuichi
0
18
ミクちゃんが歌ったら 家に帰ろう
satoyuichi
0
13
体温記録送信アプリ
satoyuichi
0
15
コロナ横目にバージョンアップ
satoyuichi
0
69
本日のシェーダー芸
satoyuichi
1
530
Other Decks in Programming
See All in Programming
ASP.NETアプリケーションのモダナイズ インフラ編
tomokusaba
1
410
Systèmes distribués, pour le meilleur et pour le pire - BreizhCamp 2025 - Conférence
slecache
0
110
Team topologies and the microservice architecture: a synergistic relationship
cer
PRO
0
1k
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
210
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
240
GraphRAGの仕組みまるわかり
tosuri13
8
480
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
860
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
250
PHP 8.4の新機能「プロパティフック」から学ぶオブジェクト指向設計とリスコフの置換原則
kentaroutakeda
2
540
Enterprise Web App. Development (2): Version Control Tool Training Ver. 5.1
knakagawa
1
120
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
380
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
46
31k
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
124
52k
Done Done
chrislema
184
16k
Designing Experiences People Love
moore
142
24k
Gamification - CAS2011
davidbonilla
81
5.3k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Agile that works and the tools we love
rasmusluckow
329
21k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Building Adaptive Systems
keathley
43
2.6k
Raft: Consensus for Rubyists
vanstee
140
7k
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)