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
Unity WebGL向けにjsでネイティブプラグイン書いた話
Search
あるど
May 28, 2021
Technology
530
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Unity WebGL向けにjsでネイティブプラグイン書いた話
あるど
May 28, 2021
More Decks by あるど
See All by あるど
OSSをゆるっとやるだけでも 楽しいなって話
mizotake
2
4.4k
手軽なトラッキング技術で遊んでみた
mizotake
0
3.9k
GitHub_Actionsをセルフホストランナーで導入する
mizotake
0
4.1k
Kotlin/Native With Unity
mizotake
1
310
Unity開発でCI/CDを使おうと思った時
mizotake
0
1.2k
Other Decks in Technology
See All in Technology
組み立てて楽しむ AWS Blocks 入門
kmiya84377
0
220
契約書画像からの情報抽出に特化した視覚接地モデルを育てる話
sansantech
PRO
1
150
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
7
1.6k
go-sqletch
moznion
0
110
味覇で作るパスタが美味い - 20261001_yabaubuki.dev
livesense
PRO
0
110
AgentCoreで実践するハーネスエンジニアリング
yakumo
1
290
MCPゲートウェイを作って運用してわかったこと — Agent時代の権限管理の現在地
mtpooh
10
3.2k
[2026-09-30]ロックンロールは鳴り止まないっ - 信頼性かまってちゃん - 「データ駆動を投げ捨ててまで。」追いかける信頼性改善に向けた取り組みの話
tosite
0
210
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
310
Lambda MicroVMsが分からなすぎたので使い所を1から考えてみた
tsukuboshi
2
430
FactoryBotアンチパターン / factory_bot anti-patterns
toshimaru
0
140
Codex概要
ymiya55
0
470
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
23k
It's Worth the Effort
3n
188
29k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
280
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
470
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
420
ラッコキーワード サービス紹介資料
rakko
1
5.2M
Chasing Engaging Ingredients in Design
codingconduct
0
350
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
How to train your dragon (web standard)
notwaldorf
96
6.9k
How to Ace a Technical Interview
jacobian
280
24k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
420
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
520
Transcript
Unity WebGL向けにjsで ネイティブプラグイン書いた話
UnityでWeb周り触ったこと ないので触ってみたい
ネタで作ったサイト
PartyParrotVRM
PartyParrot
そのVRM版
PartyParrotVRM
というgifが作れるサイト
どうやって作ったか
要素 - gifダウンロード - 顔のトラッキング - VRM読み込み
要素 - gifダウンロード - UnityのWebGLビルドでgif撮影/保存する - 顔のトラッキング - tensorflow facemesh
(当時) → mediapipe facemesh (現行) - VRM読み込み - UnityのWebGLで作ったサイトにドラッグ&ドロップでVRMを出現させる
要素 - gifダウンロード - UnityのWebGLビルドでgif撮影/保存する - 顔のトラッキング - tensorflow facemesh
(当時) → mediapipe facemesh (現行) - VRM読み込み - UnityのWebGLで作ったサイトにドラッグ&ドロップでVRMを出現させる
WebGL対応ライブラリ探すのが めんどくさかったのでjs書いてました
顔のトラッキング
基本画面が目に毒
顔のトラッキング - tensorflow/tfjs-models (一部アーカイブされてmediapipeへ移行) - サンプルコードを少し書くだけで簡単に顔のパーツ取得可能 - VRMへの適応はVRMBlendShapeProxyを使用
https://github.com/tensorflow/tfjs-models/blob/master/facemesh/mesh_map.jpg
顔のトラッキング - 画像を拡大すると顔パーツごとに配列のindexが確認できる - 顔パーツの配列で位置などが返ってくる - 顔パーツの位置はわかるので一定距離近づいたら瞬きなどをVRMへ適応
簡易的なトラッキングでも 案外それっぽく見える
jsネイティブプラグインとの やりとりで気づいたこと
ネイティブプラグインとのやり取り - jsの関数を定義、必要な引数を用意する - C#側で呼び出したい関数の定義、引数とかをネイティブとそろえる - ネイティブからコールバックなどをSendMessageで受け取る - GameObject名や関数を指定する必要がある -
引数に入れて設定しても良いが引数が多くなって増減がめんどくさい
ネイティブプラグインとのやり取り - jsの関数を定義、引数を文字列のみにする - C#側で呼び出したい関数の定義、引数を文字列のみにする - C#で呼び出す際、渡したいパラメーターをjsonにして関数に渡す - js側でjsonをparseして取り扱う(SendMessageの時も同様) -
引数が増減しても受け取る関数を変えなくてよくなる - 言語の違いによるデータ型を合わせる意識が必要ない
ネイティブプラグイン書く時の 選択肢として結構よさそう
まとめ - 基本画面は落ち着いた画面にしておけばよかった - ネタもの作るだけでも学びが案外ある - 簡易トラッキングでも案外それっぽくなって楽しい - ネイティブプラグインのやり取りをjsonでやるのよさそう