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
BabylonJs Editorで軽率にWebVRしたい話
Search
にー兄さん
March 23, 2021
Technology
490
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
BabylonJs Editorで軽率にWebVRしたい話
WebXR Tech Tokyoで登壇した資料になります
にー兄さん
March 23, 2021
More Decks by にー兄さん
See All by にー兄さん
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
520
ついにAuraも登場したのでJetpack XR SDKについて今一度語りたい / i wanna talk about xreal aura
drumath2237
0
44
『Ground Truth: How We Create Geometrically Accurate Reconstructions (Niantic Spatial Blog)』 を読む / read Ground Truth: How We Create Geometrically Accurate Reconstructions
drumath2237
0
80
この時代にOSS開発に向き合ってみる / face the oss development in this era
drumath2237
0
65
プログラマの職能が代替可能になりつつあるこの時代でプログラムと向き合う修行を積む / dedicating myself to the discipline of programming
drumath2237
0
130
個人的3D Gaussian Splattingニュースをご紹介 / sharing 3d gaussian splatting news
drumath2237
0
670
Jetpack XR SDKから紐解くAndroid XR開発と技術選定のヒント / about-androidxr-and-jetpack-xr-sdk
drumath2237
1
890
XRエンジニアの視点から XRのイマと社会実装の実現について考える / thinking-about-xr-popularization
drumath2237
0
99
軽率にプログラミング言語のシンタックスについて考えてみよう / lets-think-about-programming-lang-syntax
drumath2237
0
150
Other Decks in Technology
See All in Technology
全社共通データ基盤をつくる。ソニーのDatabricks活用とデータガバナンス設計の裏側
sony
0
290
行動するAIのためのオントロジー | DevRev — Encraft #26.pdf
dvrv_tknrszk
2
660
DORA_Metrics.pdf
wagnerfusca
1
140
React Nativeでの OTA Updateって、 どう説明する?
ichiki1023
0
130
スキルを作る、その前に!複数人で使われるスキルを 作るためのプロセス
junkifurukawa
1
160
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
3
21k
Claude起点の仕様駆動開発
tanakaseiya
0
280
猫でもわかるKiro Web
kentapapa
1
160
Lambda MicroVMsが分からなすぎたので使い所を1から考えてみた
tsukuboshi
2
290
VS Code × GitHub Copilot での Fabric 開発
ryomaru0825
1
210
20260930_Gemma4_Hands-on
tsho
0
210
セルフサービスのオブザーバビリティ基盤をOpenTelemetryで作る / Building a Self-Service Observability Platform with OpenTelemetry
ymotongpoo
3
500
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Designing for humans not robots
tammielis
254
26k
Site-Speed That Sticks
csswizardry
13
1.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
510
Git: the NoSQL Database
bkeepers
PRO
432
67k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
How to make the Groovebox
asonas
2
2.5k
How to Talk to Developers About Accessibility
jct
2
560
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
200
Transcript
BabylonJs Editorで軽率に WebVRしたい話 WebXR Tech Tokyo #5 @ cluster にー兄さん(@ninisan_drumath)
自己紹介 にー兄さん(@ninisan_drumath) 筑波大学情報科学類3年 普段はUnityでxRやったりVFXやったり、、、 最近Webフロントの勉強を嗜む程度に
入門したばかりなので 間違っているorより良い手法 があるかもです🙏
スライドとサンプルプロジェクト 公開しています👍
agenda はじめに Editorプロジェクトを見てみる WebXRアプリにする おわりに
はじめに
Babylon.js は、ゲームの開発と 使いやすさを重視した WebGL ベースの 3D エンジンです。 (docs.microsoft.comより)
Babylon.jsについて - Microsoftが開発しているWebGLライブラリ - Three.jsみたいなやつ - 周辺ツールがしっかりしている - sandbox, playground,
editor, exporter, etc... - ドキュメントがしっかり - TypeScriptサポートが強い(大事) - WebXR 対応がしっかり - Microsoft Mesh対応プラットフォームになる予 定
Babylon.js Editorについて - Electronで作られたGUIエディタ - 使用感はUnityに寄せている印象 - TSスクリプトをオブジェクトにアタッチでき る -
プレビューしながらシーンを構築できる - まだRC版 - VSCodeでコーディング・デバッグできる - 文献が少ない(つらい
今回の試行について Babylon.js Editorはシーンプレビューできる ↓ VR空間をリアルタイムプレビューしたい ↓ WebVR開発が捗るのでは? ↓ やってみよう!
Editorプロジェクトを見てみる
None
主なディレクトリ構成(青字はbuildされた成果物を動かすのに必要なもの ) / ├─ node_modules/ │ └─ cannon.js 物理演算ライブラリ ├─
dist/ │ └─ bundle.js webpackされたスクリプト ├─ projects/ ├─ scenes/ ├─ src/ tsスクリプトが配置される ├─ index.html mainページ └─ webpack.config.json webpackの設定ファイル
src/以下のディレクトリ構成及びスクリプトの構造 /src ├─ scenes/ │ ├─ scene/ │ │ └─
index.ts │ └─ MyComponent.ts └─ index.ts export default class MyComponent extends Node { protected constructor() {} public onInitialize(): void {} public onStart(): void {} public onUpdate(): void {} public onMessage (name: string, data: any, sender: any){} }
ビルドの仕組み - Webpackによるビルド - 自動でwebpack.config.jsが作成される - Editorと連携するためのプラグインが組み込まれている - プロジェクト内のコードの変更を監視している -
http-serverで鯖が立ってる? - npm run buildすれば良さそう(実は動かない)
WebXRアプリにする
Babylon.jsのWebXR APIについて - Mixed Reality Devices, Oculus Rift, などのPCVR -
Oculus QuestやAndroidなどのモバイル - Polyfillによるサポート - WebVR APIからのmigration対応など const xr = scene.createDefaultXRExperienceAsync(); 詳しくはこちらのページへ https://doc.babylonjs.com/divingDeeper/webXR/introToWebXR
EditorでWebXRを有効にする - Sceneオブジェクトが必要 - index.tsでsceneをいじれる→あまりいじりたくない - Node._sceneで現在のシーンを取得できる→これがよさそう? public onInitialize(): void
{ const env = this._scene.createDefaultEnvironment(); this._scene.createDefaultXRExperienceAsync({ floorMeshes: [env.ground] }); }
でも動かない。。。 ローカルホストでもだめなんだなぁという知見を得る htmlをLiveServerとかでホストすればBabylon.js自体は動きます
LAN内でHTTPSの有効化 - WebXR APIはHTTPS通信じゃないと利用できない - http-serverでhttps鯖を立てよう openssl req -newkey rsa:2048
-new -nodes -x509 -days 3650 -keyout key.pem -out cert.crt yarn http-server -p 1338 -c-1 -S -C cert.crt 1. opensslコマンドで秘密鍵と証明書を一発で作れるらしい 2. 途中でCommon Nameを問われるのでローカルIPを入力 3. 出力されたpemファイルを指定してhttp-serverを立ち上げる
実際に動かしてみる
動くけど、、、 - fpsが2,3くらいしか出ない - 動くけど動かん - 左右で見え方違う気がする - 左目に変な影ができちゃってる
Post Processingの除去によるパフォーマンス改善 - 動作が重い原因はPost Processing - とくにSSAOあたりが重いらしい - 先ほどのSceneConfigにPPを除去するコードを追記 this._scene._postProcessRenderPipelineManager.supportedPipelines.forEach(pp=>{
this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline( pp.name, this._scene.activeCamera ); })
Editor無しでビルドできるようにする - 普通にnpm run buildでよくない?→実はよくない - Webpack ConfigにEditorと連携するためのpluginがある - これがEditorの応答を待ってしまう
- 環境変数によってビルドの仕方を変えよう! "scripts": { ... "build": "cross-env BUILD_IN=\"editor\" webpack --mode production", "build:ci": "cross-env BUILD_IN=\"shell\" webpack --mode production", ... },
Editor無しでビルドできるようにする - webpack.config.jsで環境変数によって - Editor用のpluginを入れるか判断する - これで無事にシェル上でビルドが可能になる let plugins =
[ new webpack.BannerPlugin({ banner: `${package.name} ${package.version} ${new Date().toString()}`, }), new webpack.WatchIgnorePlugin([/\.js$/, /\.d\.ts$/]), ]; if (process.env.BUILD_IN === "editor") { plugins.push(editor.createProgressPlugin(new webpack.ProgressPlugin())); }
GitHub Pagesへのデプロイ - WebXRはインストール不要で 体験を共有できる - pushしたらすぐ公開したい - ビルド用のCIを回そ -
GitHub Pagesはhttps配信で きるのでWebXR APIもニッコリ ^^ - name: build project run: npm run build:ci - name: copy files to public run: | mkdir ./public mkdir ./public/node_modules cp -r ./dist ./public/dist cp -r ./scenes ./public/scenes cp -r ./node_modules/cannon ./public/node_modules/cannon cp index.html ./public/index.html - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public
GitHub Pagesへのデプロイ(デモ)
おわりに
まとめ - BabylonJs Editorを使ってWebVRが作れた - しかしいろいろ工夫が必要みたい - 今後のアプデに期待!
謝辞 今回の試行にあたり、 BabylonJsの情報発信を多くされているLimesさんと BabylonJs Editorの開発者であるJulien Moreauさん のお二人にTwitterでご助言を賜りました この場を借りて感謝申し上げます。ありがとうございました!🙏
参考文献 - 今回のサンプルプロジェクト https://github.com/drumath2237/babylonjs-editor-webxr-app - BabylonJsのWebXRに関するドキュメント https://doc.babylonjs.com/divingDeeper/webXR - BabylonJs Editor
http://editor.babylonjs.com/