$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SDF を作りたかった
Search
Yuichi Sato
January 29, 2021
Programming
0
470
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
29
深層学習はじめました
satoyuichi
0
44
瞑想アプリ
satoyuichi
0
40
初めての iPhone ネイティブアプリ
satoyuichi
0
55
キャンフェスにゲームを出そう -StruckOut 編-
satoyuichi
0
19
ミクちゃんが歌ったら 家に帰ろう
satoyuichi
0
14
体温記録送信アプリ
satoyuichi
0
17
コロナ横目にバージョンアップ
satoyuichi
0
72
本日のシェーダー芸
satoyuichi
1
610
Other Decks in Programming
See All in Programming
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
260
テストやOSS開発に役立つSetup PHP Action
matsuo_atsushi
0
150
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
320
tparseでgo testの出力を見やすくする
utgwkk
1
190
Go コードベースの構成と AI コンテキスト定義
andpad
0
120
チームをチームにするEM
hitode909
0
300
AIコーディングエージェント(Manus)
kondai24
0
160
20 years of Symfony, what's next?
fabpot
2
350
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.3k
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
200
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
130
愛される翻訳の秘訣
kishikawakatsumi
1
310
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Cult of Friendly URLs
andyhume
79
6.7k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
Building Flexible Design Systems
yeseniaperezcruz
330
39k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
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)