ã¯ããã«
æ¬ã¨ã³ããªã¯ Unity Advent Calendar 2014 8æ¥ç®ã®è¨äºã«ãªãã¾ãã
Unity 5 ãã㯠Build ã¿ã¼ã²ããã« WebGL ã追å ããã¾ããUnity 5 ããªãªã¼ãåããã¼ã¿çã§ç¾å¨è©¦ããã¨ãåºæ¥ã¾ãã
ä»å¹´ã® 3/18 ã«è¡ããã GDC2014 㧠Unity 5 ãçºè¡¨ãããã¿ã¤ãã³ã°ã§ WebGL 対å¿ãçºè¡¨ããã¾ãããæ¥æ¬ã§ã 4/7ã8 ã§è¡ããã Unite 2014 ã«ããã¦ã WebGL ã«ã¤ãã¦ã®è¬æ¼ãããããã®åç»ãè¬æ¼è³æãå ¬å¼ãµã¤ãããé²è¦§ãããã¨ãåºæ¥ã¾ãã
ããã¾ã§ãæ§ã ãªãã©ãããã©ã¼ã 対å¿ãå®ç¾ãã¦ãã Unity ã§ããããã®ãªãªã¼ã¹ã«ãã£ã¦ä¸»è¦ãª Web ãã©ã¦ã¶ãåãç°å¢ã§ã¯ãã©ã°ã¤ã³ç¡ã㧠Unity ã§ä½æããã²ã¼ã ã§éã¹ãããã«ãªãã¾ããç¾ç¶ã§ã¯ ealy-access ãªå½¢ã§é¨åçãªå¯¾å¿ï¼ã¨ã¯ãã£ã¦ã大ä½åãï¼ã§ããã5.x ã®ãªãªã¼ã¹ãµã¤ã¯ã«ã§ WebGL ã®ãã«ãµãã¼ããç®æãã¦ããããã§ãã
æ¬ã¨ã³ããªã§ã¯ããã㪠Unity x WebGL ã§ãã£ã¦ããä¸çã«ã¤ãã¦ãå ¬å¼ã§ç´¹ä»ããã¦ãããã¢ãèªåã§ç°¡åã«ä½ã£ã¦ã¿ããã¢ãå§ããä»çµã¿ãããã©ã¼ãã³ã¹ããã«ãæ¹æ³ãç¾ç¶ã®æ©è½å¶éããã©ã¦ã¶ã® JavaScript ã¨ã®é£æºããã«ãå¾ã®å®¹éåæ¸ææ³ããã®ä»å¨è¾ºæè¡ãªã©ã交ãã¦ãç´¹ä»ãã¾ãã
ç°å¢
WebGL ãã«ãã Web ã§ä½é¨ãã¦ã¿ã
Unity ããå ¬å¼ã§æä¾ããã¦ãããµã³ãã«ãããã¤ãä¸ãã£ã¦ãã¾ãã
- http://beta.unity3d.com/jonas/DT2/
- Dead Trigger 2ãä»å¹´ã® 4 ææ«ã«å ¬éããã¾ãã
- Unity WebGL Player - AngryBots WebGL Demo
- Unity-er ã«ã¯ã馴æã¿ã® AngryBots
- http://unity-chan.com/events/c86/WebGL/
- ã¦ããã£ã¡ããã©ã¤ãï¼GitHub - unity3d-jp/unitychan-crs: Unity-Chan "Candy Rock Star" Live Demoï¼ã® WebGL ãã¢
- Unity WebGL Benchmarks
- å ¬å¼ãã³ããã¼ã¯ã§ã
ãã¢
ã¾ããèªåã§ãç°¡åã«ãã«ããã¦å ¬éãããã¨ãåºæ¥ã¾ããä¸è¨ã¯ WebGL ãã«ããããã®ã Node.js ã§ç«ã¦ã Socket.IO ãµã¼ãã§è¤æ°ã®ãã©ã¦ã¶ã®ã·ã¼ã³ãåæããªãã 3D ãã£ãããåºæ¥ããã¢ã«ãªãã¾ãã
- http://hecom.in/lab/webgl-chat/
- WASD ã§ç§»åãQE ã§å転ãSpace ã§ã¸ã£ã³ãã§ããååãã¡ãã»ã¼ã¸ã¯ãã¿ã³æ¼ä¸å¾ã®ããã³ããã§å ¥åã§ãã¾ãã
- 誰ã人ãããªãã£ããåç»ã®ããã« 2 æã®ãã©ã¦ã¶ã§éãã¦è¦ã¦ã¿ã¦ä¸ãã
Chrome ã§ã¯ç¾ç¶ãã¼æä½ãªã©ãä¸æãåããªãã¨ãããããã®ã§ãå®è¡ã«ã¯ Firefox ãå©ç¨ããã®ããªã¹ã¹ã¡ãã¾ãã
å¾è¿°ã®ãå®è·µä¾ãã«ã¦ä»çµã¿ã«ã¤ãã¦ã¯è©³ãã解説ãã¾ãã
<追è¨: 2014/12/24>
GitHub ã«ãµã³ãã«ããã¸ã§ã¯ããä¸ãã¾ããï¼
ä»çµã¿
æ¦è¦ã«ã¤ãã¦ã¯ä»¥ä¸ã®å ¬å¼ããã°ã«è©³ããæ¸ãã¦ããã¾ãã®ã§ãããããå¾ãããæ å ±ãå ã«ãã£ã¨ç´¹ä»ãã¾ãã
- On the future of Web publishing in Unity | Unity Blog
- Benchmarking Unity performance in WebGL | Unity Blog
Unity ã Web ã§åããããã«ãUnity ã®ã©ã³ã¿ã¤ã ã³ã¼ãã¨ã¦ã¼ã¶ãè¨è¿°ããã³ã¼ãããã® 2 ã¤ãã©ãã«ãã㦠Web ã§åãã³ã¼ãã«å¤æããªããã°ãªãã¾ããã
Unity ã®ã©ã³ã¿ã¤ã ã«ã¤ãã¦
ã¾ãä¸åãã® C/C++ ã§è¨è¿°ããã Unity ã®ã©ã³ã¿ã¤ã ã«ã¤ãã¦ã¯ãã³ã³ãã¤ã©ããã³ãã¨ã³ãã® Clang ãéã㦠LLVM-IRï¼ã³ã³ãã¤ã©åºç¤ LLVM ã®ä¸éã³ã¼ãï¼ãããã³ã¼ãï¼ï¼ã¸ã¨å¤æããã㦠LLVM-IR ã JavaScript ã«å¤æãããã¨ãåºæ¥ã Emscripten ã使ã£ã¦ Web ä¸ã§åãã³ã¼ãã«ã³ã³ãã¤ã«ããã¾ãã
ãã®ããã« C++ ã JavaScript ã¸ã¨å¤æãããã¨ã¯ Emscripten ãç»å ´ãã¦ä»¥æ¥æ§ã ãªããã¸ã§ã¯ãã«å¯¾ãã¦è¡ããã¦ãã¦ãVim ã gnuplot ãªã©å種ãã¼ã«ãã Ruby ã Perl ã¨ãã£ãåè¨èªãQt ãªã©ã®ã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã«è³ãã¾ã§æ§ã ãªãã®ãå¤æããã¦ãã¾ãã
Emscripten ããåãåºããã JavaScript 㯠asm.js ã¨ãã JavaScript ã®ãµãã»ããã®å½¢å¼ï¼= asm.js ã«å¯¾å¿ãã¦ãªããã©ã¦ã¶ã§ãæ®éã«åãå½¢å¼ï¼ã«ãªã£ã¦ããããã¸ãã¯ã«å½±é¿ããªãå½¢ã§æ§ã
ãªåã¢ãã¼ãã¼ã·ã§ã³ãã³ã¼ãã«ä»ä¸ãã¦éçåä»ãããã¨ã§ãJITï¼Just-In-Timeãå®è¡æï¼ã³ã³ãã¤ã«æã«æé©åãããã¨ãå¯è½ã«ãªããåçåä»è¨èªã§ãã JavaScript ã®é度çãªå¼±ç¹ãæ¹åãã¦ãã¾ããå
·ä½çã«è¨ã㨠a|0
㯠int
åã®ã+a
㯠double
åãªã©ã¨ãã¦è¡¨ç¾ããã¾ãã
- asm.js
- asm.js performance improvements in the latest version of Firefox make games fly! - Mozilla Hacks - the Web developer blog
ç¾å¨ãasm.js ãå®è£ ããããã©ã¦ã¶ã¯ Firefox ã®ã¿ã§ãï¼Chrome が対応する?みたいな噂ãããã¾ãï¼ããåè¿°ã®ããã« asm.js 㯠JavaScript ã®ãµãã»ããã¨ãã¦è¨è¿°ããã¦ããã®ã§ãå®è¡é度ã¯å£ãã¾ãã Chrome ã§ãåé¡ãªãåãã¾ãã
ã¦ã¼ã¶ã³ã¼ãã«ã¤ãã¦
ä¸æ¹ãã²ã¼ã ä¸ã§å©ç¨ããããã¸ãã¯çã®ã³ã¼ã㯠C# ã UnityScript ã§è¨è¿°ããã¦ãã¾ããé常ã¯ããã C# ã UnityScript ã®ã³ã¼ã㯠CILï¼Common Intermediate Languageã.NET ã®å ±éä¸éè¨èªï¼ã¸ã¨ã³ã³ãã¤ã«ãããMono ã«ãã£ã¦ãã® CIL ã JIT ã³ã³ãã¤ã«ãããã¤ãã£ãã³ã¼ãã¨ãªãå®è¡ããã¾ãï¼iPhone ãªã©ã§ã¯ã»ãã¥ãªãã£ã®å¶ç´ä¸ AOTï¼Ahead-Of-Timeãäºåï¼ã³ã³ãã¤ã«ããã¦ãã¾ãï¼ãMono ãä¸éè¨èªã解éãã¦åãã©ãããã©ã¼ã ç¨ã®ãã¤ãã£ãã³ã¼ããåãåºãã¦ãããå½¢å¼ãã¨ããã¨ã§ãWindows ã§ã Mac ã§ã Linux ã§ããã®ä»è«¸ã ã®ç°å¢ã§ãåãä»çµã¿ã«ãªã£ã¦ããããã§ãã
ã§ã¯ãã® C# / UnityScript ã§è¨è¿°ãããã³ã¼ãã JavaScript ã¸ã¨å¤æããããã«ã©ããããæ°ã«ãªãã¨æãã¾ããããããåãã¨ããã§ãUnity ã§ã¯è²ã ãªæ¹æ³ã模索ããçµæãé©ãã¹ããã¨ã« IL2CPP ã¨ãã C# / UnityScript ã®ã³ã¼ãï¼æ£ç¢ºã«ã¯ CILï¼ã C++ ã®ã³ã¼ãã«å¤æããç¬èªã®ãã¼ã«ãéçºãããã¨ã§è§£æ±ºããããã§ãããã㯠2 å¹´åããå®é¨çã«é²ãã¦ããã¨æ¸ããã¦ãã¾ãã
ãã㦠WebGL ã«ãã«ãããããã«ã¯ãå ç¨ã¨åæ§ã« Clang / Emscripten ã«ãã£ã¦å¾ããã C++ ã JavaScript ã¸ã¨å¤æããããã§ããã¾ã¨ããã¨ã以ä¸ã®æ§ãªæé ãè¡ã£ã¦ããããã§ãã
- C# / UnityScript ã³ã¼ãã Mono ã®ã³ã³ãã¤ã©ã§ CIL ã«å¤æ
- CIL ã IL2CPP 㧠C++ ã³ã¼ãã«å¤æ
- C++ ã Clang 㧠LLVM IR ã«å¤æ
- LLVM IR ã Emscripten 㧠asm.js å½¢å¼ã® JavaScript ã«å¤æ
- JavaScript ã minifyï¼å¾è¿°ãã Fast / Fastest ãã«ãã®ã¿ï¼
ãã®ããããã®ãã§ã¼ãºã§ã©ã®ãããªã³ã¼ããåãåºããã¦ãããã«ã¤ãã¦ã¯ãUnite 2014 ã§ã®è³æã«æ¸ãã¦ãããã¨ã¦ãé¢ç½ãã®ã§æ¯éã覧ãã ããã
IL2CPP ã®æ©æµã¯ WebGL åã ãã«ã¨ã©ã¾ãããåºåã C++ ã«ãªããã¨ã§éç解æãæé©åã«ããããã©ã¼ãã³ã¹åä¸ãå¯è½ã¨ãªã£ããã大éã«ããåãã©ãããã©ã¼ã ã®ã¢ã¼ãä¾åã®æ©æ¢°èªã¨ Mono ã®ãã¤ã³ãã£ã³ã°ã C++ ã«ç½®ãæãããããã¨ã§å¤§å¹ ã«è»½æ¸ããã移æ¤æ§ãã¡ã³ããã³ã¹æ§ãåä¸ããè¦è¾¼ã¿ã§ãï¼è©³ç´°ã¯公式ブログåç §ï¼ãã¾ããæè¿ã® iOS 64bit 対å¿ã®ããã«ã IL2CPP ã®æè¡ã¯ä½¿ããã¦ãã¾ãã
ããè¨èªã C++ ã¸ã¨å¤åãé«éåãããã¨ãã話㯠Facebook ã® HipHop ãæãæµ®ãã³ã¾ããããã¡ãã¯è²ã ãªçç±ãã JIT ã³ã³ãã¤ã«ã«æ¹é転æãããªã©ãããã¨ãåéçã«ã¯è²ã èå¯ãããããããããªã¨ããã§ãããæ®å¿µãªããç§ã«ãã¾ãç¥è¦ããªãã®ã§ããããã®ããå ·ä½çãªè©±ã¯ã©ãªããã解説ãã¦ããããã¨ãæå¾ ãã¦ãã¾ãã
ããã©ã¼ãã³ã¹
åä½é度
å ¬å¼ã®ããã°ã®ãã³ããã¼ã¯çµæãè¦ã¦ã¿ã¾ãã
ç§ãææã¡ã® MacBook Pro Retina 13 Late 2013ï¼Core i7 2.8GHzï¼ã¨ Alienware 17ï¼Core i7 4910MQãGTX 880Mï¼ã® Chrome ã§åããã¦ã¿ãã¨ããããããã 25694ã89835 ã§ããã以ä¸ãå ¬å¼ã®èå¯ãæç²ãã¦ã¿ã¾ãã
- asm.js ãå¹ã Firefox ã Chrome / Safari ããéã
- GPU ãæ¯é çãªç¶æ³ã§ã¯ WebGL ã¯ãã¤ãã£ãã¨åçã®ããã©ã¼ãã³ã¹ãçºæ®
- ãã©ã¦ã¶ããã¤ãã£ãããéãæããããããã㯠IL2CPP ã®æé©åã®ãããï¼
- 3D ã®ç©çæ¼ç®ãªã©ã§ã¯ãã¤ãã£ããå§åçã«åãããããã¯ãã«ãã¹ã¬ããã SIMD ã«ãããã®
- 3D ã®ç©çã¨ã³ã¸ã³ã¯ PhysX 3.3 ã§ãã«ãã¹ã¬ããã SIMD 対å¿
- 2D ã®ç©çã¨ã³ã¸ã³ã¯ Box2D ã§ãã«ãã¹ã¬ããé対å¿
GPU ãæ¯é çãªè¡¨ç¾ã¯ãããããµã¯ãµã¯åããCPU ã使ããã¸ãã¯ã«é¢ãã¦ã asm.js ã«ãããã¤ãã£ãã¨æ¯è¼ãã¦ãéè²ãªãããã©ã¼ãã³ã¹ãåºãããã ããã«ãã¹ã¬ããç³»ã SIMD ãªã©ãã·ã³ã°ã«ã¹ã¬ãããã¼ã¹ã® JavaScript ã ã¨å³ããã¨ããã§å¤§ããªå·®ãåºããã¨ããæãã§ãããã«ãã¹ã¬ããåã SIMD ã«ãã£ã¦é«éåãã試ã¿ã«ã¤ãã¦ã¯æªã å ¥ã£ã¦ããªãã対å¿ãã¦ããããã¨ã®ãã¨ã§ããããããã㯠Emscripten ã Web ããã©ã¦ã¶ãã®ãã®ã¨å¯æ¥ã«çµã³ã¤ãã¦ããã®ã§ãæ¥çå ¨ä½ãè¦ãªããä»å¾ã®ã¢ãããã¼ãã«æå¾ ã§ãã
- WebGL in Web Workers, Today - and Faster than Expected! - Mozilla Research
- Introducing SIMD.js - Mozilla Hacks - the Web developer blog
- [webkit-dev] SIMD support in JavaScript
- Bringing SIMD to JavaScript | 01.org
ãã«ãæ¹æ³
åç½®ããé·ããªãã¾ããããå ·ä½çã«åä½ãã WebGL ã¢ããªãåºåããæ¹æ³ãç´¹ä»ãã¾ãã
ãã«ã
ãã«ãã¯ç°¡å㧠Build Settings ã® Platform ãã WebGL (Preview) ãé¸æãã¦ãã«ãããã ãã§ãã
C++ ãã JS ã«ã³ã³ãã¤ã«ãã¦ããã¨æããããNative Compile to JSããã¨ã¦ãé·ãã§ã...ãæ°åã¯å¾ ã¡ã¾ãããã«ããå®äºããã¨ä»¥ä¸ã®æ§ãªãã¡ã¤ã«æ§æã§ãã£ã¬ã¯ããªãåºåããã¾ãã
<åºåå>.js
ãã¡ã¤ã³ã® JS ã«ãªãããã®ä»ã® js ã¯äºã Unity ã§å®ç¾©ããã便å©é¢æ°ï¼ããã°ã¬ã¹ãã¼ããã¼ããå¾è¿°ãã Unity ã®ä¸çã§å®ç¾©ããé¢æ°ã¨ã®ããåãçï¼ãªã©ãè¨è¿°ããã¦ãã¾ããå¾ã¯ãªã½ã¼ã¹ãå«ã¾ãã¦ããå½¢ã«ãªãã¾ãï¼å
·ä½çã« .data ã .mem ãä½ãæ ¼ç´ãã¦ãããã«ã¤ãã¦ã¯æªç¢ºèªã§ãï¼ã
ãã©ã¦ã¶ã®ã»ãã¥ãªãã£çã«ãã¼ã«ã«ã®ã¾ã¾ã§ã¯å®è¡ã§ããªãã®ã§ãApache ã nginx ãªã©ã§é©å½ãªãµã¼ããç«ã¦ããã©ããã«ã¢ãããã¼ããã¦ç¢ºèªãã¦ä¸ãããindex.html
ãéãã¨ä»¥ä¸ã®æ§ãªç»é¢ã表示ããã¾ãã
ä½è«ã§ããããããã£ãå°ããªã·ã¼ã³ã§ããååãã¼ãã¯ããªãæéããããã®ã§æ°é·ã«å¾ ã¤å¿ è¦ãããã¾ãããã®ä½æåä¸ã®ããã«ãã©ã³ã¿ã¤ã é¨åã CDN ã§æä¾ããã FileSystem API ã®å©ç¨ãAssetBundle ã®ãããªä»çµã¿ã®å°å ¥ãéåæã¹ããªã¼ãã³ã°ã«ãããã¼ããªã©è²ã ã¨èª²é¡ãããããã§ããå¾è¿°ãã¾ãããgzip ã«ãã転ééã®åæ¸ã¯ããã¦ãã¦ãããã«ããããªãã®ãããã¯ã¼ã¯è»¢ééã®åæ¸ãããã¦ãã¾ãã
WebPlayer ã WebPlayerTemplates
ãã£ã¬ã¯ããªã«ãã£ã¦è¦ãç®ãå¶å¾¡ã§ããã®ã«å¯¾ãäºåã« WebGL ããã³ãã¬ã¼ãããããããã©ããã¯ä¸æã§ããå¿è«æ¸ãã ããå¾ã¯ãããã§ãä¿®æ£å¯è½ã§ãã
Optimization Level
æ¸ãåºãæã«ãOptimization Level ã¨ãããã«ãã¦ã³ã¡ãã¥ã¼ãããã3ã¤ã®ãªãã·ã§ã³ãç¨æããã¦ãã¾ãã
- Slow (fast builds)
- Fast
- Fastest (very slow builds)
ããã¥ã¡ã³ãããªãã£ãã®ã§è©¦ããæ触ã§ããããã®åã®éã Slow ã§ã¯ãã«ããæ©ãåãå®è¡é度ãé ãã§ããFastest ã§ã¯å®è¡ãæ©ãåããã«ããæ¿é ã§ããã¾ãåºåãµã¤ãºã FastestãFastãSlow ã®é ã§å¤§ãããªã£ã¦ããã¾ãã容éã«ã¤ãã¦ã®è©³ç´°ã¯å¾è¿°ãã¾ãã
ãã«ãã®ã«ã¹ã¿ãã¤ãº
ãEdit > Project Settings > Playerãã« HTML5 ã®ã¿ãã追å ããã¦ãã¾ãã
ãã㧠WebGL ã®ãµã¤ãºãªã©ã®è¨å®ãåºæ¥ã¾ããä¾ãã° Run In Background ãªã©ã¯ãã¹ã¯ãããã¢ããªçã¨åãããã«ãã§ãã¯ããªãã®æã¯ãã©ã¼ã«ã¹ãå¤ããã¨ï¼ä¾ãã°ãã©ã¦ã¶ã®ã¤ã³ã¹ãã¯ã¿ã«ãã©ã¼ã«ã¹ãããã£ã¦ããæï¼å®è¡ãæ¢ã¾ãããªã³ã ã¨ãã©ã¼ã«ã¹ãå½ãã£ã¦ããªãã¦ãå®è¡ãããããã«ãªãã¾ãã
ãã®ä»ã®è¨å®ã«ã¤ãã¦ã¯ã¾ã æ å ±ãå°ãªããã¨ãããããã¾ã試ãã¦ãã¾ããã
æ©è½å¶é
ãã©ã¦ã¶ä¸ã§åããããããã¹ã¯ãããã¢ããªã¨ãã¦åãã¦ããå ¨ã¦ã®æ©è½ã使ããããã§ã¯ããã¾ãããã¾ããPreview çã§ãããã¨ãããæ¬æ¥ Web ã§ã¯åºæ¥ãããã©ç¾ç¶ã§ã¯æªå¯¾å¿ãªãã®ãããã¾ãã
以ä¸ãç¾ç¶åºæ¥ãªããã®ä¸è¦§ã¨ä½ã§åºæ¥ãªããã®èå¯ãªã©ã«ãªãã¾ãã
- Runtime generation of Substance textures
- ãã¶ãããã·ã¼ã¸ã£ã«ãããªã¢ã«ã®ãã¨ï¼
- http://docs-jp.unity3d.com/Documentation/Manual/ProceduralMaterials.html
- MovieTextures
- åç»ãã¯ã¹ãã£ï¼
MovieTexture
ã¯ã©ã¹ï¼
- åç»ãã¯ã¹ãã£ï¼
- Networking other then WWW class (a WebSockets plug-in is available)
WWW
ã¯ã©ã¹ä»¥å¤ã®ãããã¯ã¼ã¯æ©è½- ã¯ãã¹ãã¡ã¤ã³å¶ç´ã®ç¸ãæãã¨æããã©è©¦ãã¦ãªãã§ã...
- Support for WebCam and Microphone access
- ã¦ã§ãã«ã¡ã©ããã¤ã¯ã¸ã®ã¢ã¯ã»ã¹
getUserMedia
ã§ã¢ã¯ã»ã¹ã§ããããã©å®è£ é¢åãã
- Hardware cursor support
- ãã¼ãã¦ã§ã¢ã«ã¼ã½ã«ã®ãµãã¼ã
- Most of the non-basic audio features
- å¤ãã®éæ¨æºãªã¼ãã£ãªæ©è½
- ãªãã ããï¼
- Script debugging
- ãããã°
- Chrome ã®ãªã¢ã¼ããããã°ã¿ããã«ãã...ã®ã¯ã¤ãããã¦ç¡çããã§ã
- Threads
- ã¹ã¬ãã
- WebWorker ã使ãã¨ã¹ã¬ããéã§ã¡ã¢ãªã®å ±æãã§ããªãã®ã§å®è£ ã¤ãããã§ã
- Any .NET features requiring dynamic code generation
- åçãªã³ã¼ãçæãä¼´ã .NET æ©è½
System.Reflection.Emit
ã¨ãCSharpCodeProvider
ã¨ãï¼
å¾ã¯ããã«ã¯æ¸ããã¦ãã¾ãããããã¼ã«ã«ã®ãã¡ã¤ã«ã®ã¢ã¯ã»ã¹ããã¤ãã£ã DLL ã®å©ç¨ãªã©ã¯ WebPlayer åæ§åºæ¥ã¾ããã
JavaScript 㨠Unity å ã§å®ç¾©ããã³ã¼ãã®é£æº
Unity ãã JavaScript ã®ã³ã¼ããå¼ã³åºã
Unity ã§ä½æããä¸çã¨å¤ã®ä¸çã¨ã®ããåãã«ã¤ãã¦ã¯ãUnite 2014 の資料ã«ä»¥ä¸ã®ããã«æ¸ãã¦ããã¾ãã
- You can just write a plugin directly in JavaScript and call functions from that from your C# scripts.
- You can also just add C++ source files to your project, and call functions from them from your game scripts.
- You can use
Application.ExternalCall
orApplication.ExternalEval
, like you would do in the Web Player.
2 çªç®ã«ã¤ãã¦ã¯è³æãè¦ã¤ãããªãã£ããããããã§ã¯ããã£ã¨ãç°¡å㪠3 çªç®ï¼1 çªç®ãå«ãï¼ããã£ã¦ã¿ã¾ãã
Application.ExternalCall()
ã¯ç¬¬ 1 å¼æ°ã§æå®ããã JavaScript ã®é¢æ°ã第 2 å¼æ°ä»¥éãå¼æ°ã¨ãã¦å¼ã³åºãé¢æ°ã§ããApplication.ExternalEval()
ã¯ãã®åã®éã JavaScript å´ã§ eval()
ããã³ã¼ãã§ããWebPlayer ã®é ã«ä½¿ããã¦ããã³ã¼ãã WebGL æ¸ãåºãã«é¢ãã¦ãåãããã«ä½¿ããããã§ãããç°¡åãªãã¹ãããã¦ã¿ã¾ãã
using UnityEngine; using System.Collections; public class ExternalCallTest : MonoBehaviour { void Update() { if (Input.GetKeyDown(KeyCode.C)) { Application.ExternalCall("console.log", "hogehoge", 100, 123.456f); } if (Input.GetKeyDown(KeyCode.E)) { Application.ExternalEval("document.body.bgColor = '#000'"); } } }
ãããé©å½ãªãªãã¸ã§ã¯ãã«ã¢ã¿ãããã¦ãã«ããC / E ãã¼ãæ¼ä¸ãã¦ã¿ãã¨ãããªæãã«ãªãã¾ãã
eval()
ã«ããèæ¯ãé»ããªããconsole.log()
ã«ãã£ã¦ãã°ãæ¸ãåºããã¦ãã¾ããã
ä»ã«ã jslib
ãã¡ã¤ã«ã¨ [DllImport("__Internal")]
attribute ãå©ç¨ããæ¹æ³ãããããã§ãï¼æªããã¥ã¡ã³ãï¼ããµã³ãã«ãç¨æä¸ã¨ã®ãã¨ã§ãè¿ããã¡ã«æ
å ±ãä¸ããã®ã§ã¯ãªãã§ããããã
JavaScript ãã Unity ã®ã³ã¼ããå¼ã³åºã
éã«ãJavaScript ãã Unity ã®ã³ã¼ããå¼ã³åºãã«ã¯ã©ããããè¯ãã§ãããããWebPlayer ã§ã¯ UnityObject2
ãªãã¸ã§ã¯ããéã㦠SendMessage()
ãã¦ããã¨ããã¦ãã¾ããã
- http://docs.unity3d.com/Manual/UnityWebPlayerandbrowsercommunication.html
- http://docs.unity3d.com/Manual/WorkingwithUnityObject.html
WebGL ã§ã¯ SendMessage()
é¢æ°ã UnityConfig.js
ã®ä¸ã§ã°ãã¼ãã«ãªé¢æ°ã¨ãã¦ç¨æããã¦ããããã®ã¾ã¾ä½¿ç¨ãããã¨ãåºæ¥ã¾ãã
試ãã« Unity ã§ä»¥ä¸ã®ãããªã³ã¼ããæ¸ãã¦ã¿ã¾ãã
using UnityEngine; using System.Collections; public class CubeGenerator : MonoBehaviour { public GameObject cube; void Generate() { var pos = Vector3.up * 10f + Random.onUnitSphere; Instantiate(cube, pos, Quaternion.identity); } }
ã¤ã³ã¹ãã¯ã¿ã§æå®ããã GameObject ãããããçæããæãã§ããé©å½ã§ããããã Main Camera
ã«ã¢ã¿ãããã¦é©å½ãª Prefab ã cube
ã«æ¾ãè¾¼ãã§ããã¾ããããã JS ãããã¼æ¼ä¸ããã度ã«å¼ã³åºãã¦ã¿ã¾ãã
document.addEventListener("keydown", function() { SendMessage("Main Camera", "Generate"); });
SendMessage()
ã§ã¯ç¬¬ 1 å¼æ°ã«ã¡ãã»ã¼ã¸ãéã GameObject ã®ååãã第 2 å¼æ°ã«é¢æ°åã第 3 å¼æ°ã«æ¸¡ããã©ã¡ã¿ãè¨è¿°ãã¾ããããã§ãã¼æ¼ä¸ããã度ã«ä¸ã§å®ç¾©ãã Generate
ãå¼ã°ããå½¢ã«ãªãã¾ããå®éã«ãã«ããã¦ãã¹ããã¦ã¿ã¾ããã
ã¨ã¦ãè¯ãæãã«åãã¾ãã
ããã¯çµæ§é¢ç½ãã¦ãä¾ãã° Unity å´ã§æ¸ãã®ãé¢åãªãã¨ã¯é©å®ä¾¿å©ãª HTML5 ã®æ©è½çã使ããªãã JS å´ã§æ¸ãã¦ãã¾ã£ã¦ãçµæã ã Unity ã«ä¼ãããã¿ãããªãã¨ãç°¡åã«ã§ãã¾ããã°ãªã³ã°ãªã³ Web ä¸ã§åã Twitter ã¯ã©ã¤ã¢ã³ãããªãããç°¡åã«ä½ãããã§ãããWebSocket ã§ãµã¼ãã¨ããã¨ããã¦ãã©ã¦ã¶ä¸ã§ãªã¢ã«ã¿ã¤ã ã«è¤æ°äººã§ã³ã©ãã¬ã¼ã·ã§ã³ã§ãããªãããªã²ã¼ã ãç°¡åã«åºæ¥ã¾ãï¼å¾è¿°ï¼ã
ãã ããApplication.ExternalCall()
ã SendMessage()
ã¯æ»ãå¤ã§çµæãåå¾ã§ããªãã®ã§ãUnity ã®ä¸ã®ä¸çã®å¤ãå¤ããåãåããã¦åã£ã¦ããã«ã¯ãè¡ã帰ãã® 2 段éã®ã³ã¼ã«ããã¯ãçµç±ããªããã°ãªãã¾ãããããããªãã WebPlayer ã¨ã¯ç°ãªãããã«ãå¾ã¯ Unity ã®ä¸çãåãã³ã³ããã¹ãã®ä¸ã§åã JavaScript ã«ãªããããããã»ã¹ã¾ãããçºçãããApplication.ExternalCall()
ã SendMessage()
ç´å¾ã«å¼ã³åºãå
ã®ã³ã¼ããå®è¡ããã¾ãããã®ããå¾å¾©ãã¦ãé
延ãçºçããªãã®ã§ããã¾ãã©ãããã¦ãããã°ä¾¿å©ã«ã§ããã¨æãã¾ãã
容éã®åæ¸
ä½ããªãã·ã¼ã³ï¼Main Camera 㨠Directional Light ã®ã¿åå¨ï¼ã Slow è¨å®ã§ãã«ããã¦ã¿ã¾ãã容éãè¦ãã¨ãä½ã¨ 132 MB ãããã¾ããããã¯ä¸»ã«ã¡ã¤ã³ã® JS ãã¡ã¤ã«ï¼Data/PROJECT_NAME.js
ï¼ã 110 MB ã¨ãã大ããªå®¹éãå ãã¦ããããã§ããSlow è¨å®ã§ã¯ JS ãã¡ã¤ã«ã minify ããã¦ããªããããã®ãããªå¤§ããªãµã¤ãºã«ãªã£ã¦ãã¾ãããFastest è¨å®ã§ãã«ãããã㨠minify ãå¹ãçµæãå
¨ä½ã¯ 35 MB ç¨åº¦ãã¡ã¤ã³ã® JS ãã23 MB ã«ãªãã¾ããããã§ã WebPlayer ãªã©ã¨æ¯è¼ããã¨ã¡ãã£ã¨å¤§ãããµã¤ãºã§ãã
ããã«ã¤ãã¦ã¯ä»¥ä¸ã®ã¹ã¬ããã§è°è«ããã¦ãã¾ãã
ããã§ã¯ãåºåããããã£ã¬ã¯ããªã«ã¯ Data
㨠Compressed
ã¨ãã 2 ã¤ã®ãã£ã¬ã¯ããªãããããã®ä¸ã®ãªã½ã¼ã¹ã .htaccess
ã«ãã£ã¦ãããªã«å²ãæ¯ããã¦ãããã¨ãæ¸ãã¦ããã¾ãããã£ã¬ã¯ããªåºåããããã£ã¬ã¯ããªã«ãã .htaccess
ãè¦ã¦ã¿ã¾ãã
Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP:Accept-encoding} gzip RewriteRule (.*)Data(.*)\.js $1Compressed$2\.jsgz [L] RewriteRule (.*)Data(.*)\.data $1Compressed$2\.datagz [L] RewriteRule (.*)Data(.*)\.mem $1Compressed$2\.memgz [L] RewriteRule (.*)Data(.*)\.unity3d $1Compressed$2\.unity3dgz [L] AddEncoding gzip .jsgz AddEncoding gzip .datagz AddEncoding gzip .memgz AddEncoding gzip .unity3dgz
ããã§ã¯ gzip ã«ããå§ç¸®ã許容ããã¦ããã° gzip å½¢å¼ã®ãã¡ã¤ã«ã代ããã«ä½¿ç¨ããã«ã¼ã«ãè¨è¿°ããã¦ãã¾ãã
ã¢ãã³ãªãã©ã¦ã¶ã§ã¯ gzip ã解åãã¦ãããã®ã§è»¢ééã®åæ¸ãã§ããããã§ãããã¤ã¾ã Data
ãã£ã¬ã¯ããªå
ã® .js
ã.data
ã.mem
ã.unity3d
ã¯ã¢ãã³ãªãã©ã¦ã¶ã®ã¿ãèæ
®ããã°åé¤ãã¦ãè¯ããã¨ã«ãªãã¾ãã
gzip ã«ãã転éãå¹ããããããä¾ãã° Mac & Apache ã§ä½æ¥ãã¦ãã人㯠/private/etc/apache2/httpd.conf
ã® 2 ç®æãæ¸ãæãã¾ããã¾ããRewriteCond / RwriteRule ãå¹ãããã« mod_rewrite
ããªã³ã«ãã¾ãã
# 以ä¸ã®ã³ã¡ã³ããå¤ã LoadModule rewrite_module libexec/apache2/mod_rewrite.so
ããã¦ã.htaccess
ãã使ããããã« AllowOverride
ã All
ã«ãã¾ãã
DocumentRoot "PATH_TO_YOUR_WWW_DIR" <Directory "PATH_TO_YOUR_WWW_DIR"> ... # AllowOverride None ã All ã«ãã AllowOverride All ... </Directory>
ããã§ã¬ã¹ãã³ã¹ãããã確èªããã¨ä»¥ä¸ã®ããã«ãContent-Encoding
ã gzip
ã«ãªã£ã¦ãããã¨ã確èªã§ãã¾ãã
ãªãã2åç®ã®ãã¼ãã¯ãã£ãã·ã¥ããèªã¿è¾¼ã¾ããï¼304ï¼ã®ã§éããªãã¾ãã
è¦ããªããã¡ã¤ã«ï¼Data
ãã£ã¬ã¯ããªå
㧠Rwrite ããã対象ã®ãã¡ã¤ã«ï¼ãæ¶å»ãã¦ãåä½ããSlow ãã«ãã§ã¯å
¨ä½ã¯ 16.5 MB ã»ã©ã«ãªããå
ã¨æ¯è¼ãã¦ããã 1/8 ã®ãµã¤ãºã«ãªãã¾ãããFastest ã§ã¯ä½ã¨ 6.2 MB ã«ã¾ã§å°ãããªãã¾ãã
ãã ãgzip 転éãã§ããã®ã¯ããã¾ã§ .htaccess
ã«ãã£ã¦è¨å®ã§ããç°å¢ã«éãããã®ã§ãDropbox ã®ãããªç°å¢ã§ã¯ Data
å
ã®ãã¡ã¤ã«ãå
¨é¨ã¨ã£ã¦ããå¿
è¦ãããã¾ãï¼éã« Compressed
ã¯è¦ããªãã§ãï¼ã
å®è·µä¾
ãµã³ãã«ã¨ãã¦åé ã®ãã¢ã§ä½æãããNode.js ã§ç«ã¦ã Socket.IO ã«ããè¤æ°ã®ãã©ã¦ã¶éãåæããæ¹æ³ã«ã¤ãã¦ç´¹ä»ãã¾ããä»çµã¿ã¨ãã¦ã¯ãUnity ã«ãã WebGL ã®ä¸çããã¯ãå
ã«ç´¹ä»ãã Application.ExternalCall
ãå©ç¨ãã¦èªåã®æ¸ãã JavaScript ã®ã³ã¼ãã«èªæ©ã®ä½ç½®ãã¼ã¿çãå¼ã渡ããããã Socket.IO ãéãã¦ä»ã®ã¯ã©ã¤ã¢ã³ãã¸è»¢éããã¡ãã§ã¯ SendMessage()
ã㦠Unity ã® WebGL ã®ä¸çã¸ä½ç½®ãã¼ã¿çãä¼ããå½¢ã«ãªãã¾ãã
èªæ©ã®ä½ç½®ãä»ã®ãã©ã¦ã¶ã¸éä¿¡
ã¾ããèªæ©ã®æ å ±ããµã¼ãã«ä¼ããã¨ãããè¦ã¦ã¿ã¾ãã
ãã®å¦çã¯ä¾ãã°ä»¥ä¸ã®ãããªã·ã³ãã«ãªå½¢ã«ãªãã¾ãã
using UnityEngine; using UnityEngine.UI; using System.Collections; public class PlayerController : MonoBehaviour { public Text textUi; private Vector3 prePosition_; private Quaternion preRotation_; void Update() { // ...(ç¥: ãã¬ã¤ã¤ã¼ãåããå¦ç) EmitPosition(); EmitRotation(); } void EmitPosition() { // ä½ç½®ãæ´æ°ããã¦ããããµã¼ãã«ä¼ãã var pos = transform.position; if (pos != prePosition_) { prePosition_ = pos; Application.ExternalCall("socket.emit", "move", pos.x, pos.y, pos.z); } } void EmitRotation() { // åããæ´æ°ããã¦ããããµã¼ãã«ä¼ãã var rot = transform.rotation; if (rot != preRotation_) { preRotation_ = rot; Application.ExternalCall("socket.emit", "rotate", rot.x, rot.y, rot.z, rot.w); } } void Talk(string message) { // ã¡ãã»ã¼ã¸ãæ´æ°ãã¦ãµã¼ãã«ä¼ãã textUi.text = message; Application.ExternalCall("socket.emit", "talk", message); } }
socket.emit
åºæ¥ãããã«ãJavaScript ã§ã¯ Socket.IO ãèªã¿è¾¼ãã§ä»¥ä¸ã®ããã« socket
ãã°ãã¼ãã«ã«ç½®ãã¦ããã¾ãã
var socket = io() || {};
ãããããã¨ã§ãUnity ã®ã³ã¼ãããããã® socket
ãªãã¸ã§ã¯ããç´æ¥åç
§ã§ããããã«ãªããããsocket.emit()
çµç±ã§ãã¼ã¿ããµã¼ãã¸ã¨éããããã«ãªãã¾ãã
ãµã¼ãå´ã§éããã¦ããæ å ±ã転é
ãããã¦éããã¦ããæ å ±ããNode.js ãµã¼ãã§ã¯ä»¥ä¸ã®æ§ãªã³ã¼ããæ¸ãã¦æ å ±ã転éãã¾ãã
var io = require('socket.io')(3000); io.on('connection', function(socket) { var id = socket.id; socket.on('move', function(x, y, z) { socket.broadcast.emit('move', id, x, y, z); }); socket.on('rotate', function(x, y, z, w) { socket.broadcast.emit('rotate', id, x, y, z, w); }); socket.on('talk', function(message) { socket.broadcast.emit('talk', id, message); }); socket.on('disconnect', function(message) { socket.broadcast.emit('destroy', id); }); });
ãã½ã¨ãã¦ã¯ã¯ã©ã¤ã¢ã³ãã«å²ãæ¯ããã socket.id
ãåæã«è»¢éãããã¨ã§ãããããã¦ã¼ã¶ã®èå¥åã¨ãã¦å¾ã§ä½¿ãã¾ãã
ä»æ©ã®ä½ç½®ãèªåã®ãã©ã¦ã¶ä¸ã«åæ
æå¾ã«éããã¦ããæ å ±ãå ã«èªåã®ã·ã¼ã³ã«ç¸æãåºãã¾ãã
ã¾ãããµã¼ãããéããã¦ãããã¼ã¿ã Unity ã®ä¸çã«ä¼ãã¾ããå
ã»ã©ç¨æãã socket
ã«ç¶ãã¦ä»¥ä¸ã®ããã«æ¸ãã¾ãã
var socket = io() || {}; socket.isReady = false; // <-- Awake() ã®ã¿ã¤ãã³ã°ã§ true ã«ãªã window.addEventListener('load', function() { var execInUnity = function(method) { // ã·ã¼ã³ããã¼ããããã¾ã§ãã¼ã¿ã®åæã¯ããªã if (!socket.isReady) return; // "Network Player Manager" ã²ã¼ã ãªãã¸ã§ã¯ãã« SendMessage(method, args) ãã // å¼æ°ã¯ 1 ã¤ããåããªãã®ã§ , åºåãã®æååã§å¼ã渡ã var args = Array.prototype.slice.call(arguments, 1); SendMessage('Network Player Manager', method, args.join(',')); }; socket.on('move', function(id, x, y, z) { execInUnity('Move', id, x, y, z); }); socket.on('rotate', function(id, x, y, z ,w) { execInUnity('Rotate', id, x, y, z, w); }); socket.on('talk', function(id, message) { execInUnity('Talk', id, message); }); socket.on('destroy', function(id) { execInUnity('DestroyPlayer', id); }); });
ã·ã¼ã³ã®ãã¼ããå®äºããåã« Unity ã®ä¸ç㸠SendMessage()
ãè¡ãã¨ã¨ã©ã¼ã«ãªããããisReady
ã¨ãããã©ã°ãè¨ãã¦ãã¾ãã
ç´æ¥ãªãã¸ã§ã¯ãã« SendMessage()
ãã¦ãè¯ãã®ã§ãããSendMessage
対象ã®ãªãã¸ã§ã¯ããåå¨ãã/ããªãå¤å®ãããªãã¨ãªããé¢åãªã®ã§ã Network Player Manager
ã¨ãã仲ä»å½¹ãè¨ãã¦ããã¨ããããã¨ã«ãã¾ããããã㧠Unity ã®ä¸ç㸠SendMessage()
ã§æ
å ±ãä¼ããããããã«ãªã£ãã®ã§ãæå¾ã« Unity å´ã§åæããå¦çãæ¸ãã¾ãã
using UnityEngine; using System.Collections.Generic; public class NetworkPlayerManager : MonoBehaviour { public GameObject networkPlayerPrefab; private Dictionary<string, NetworkPlayerController> players_ = new Dictionary<string, NetworkPlayerController>(); static private readonly char[] Delimiter = new char[] {','}; void Awake() { Application.ExternalEval("socket.isReady = true;"); } void Move(string argsStr) { var args = argsStr.Split(Delimiter); GetPlayer(args[0]).Move(new Vector3(float.Parse(args[1]), float.Parse(args[2]), float.Parse(args[3]))); } void Rotate(string argsStr) { var args = argsStr.Split(Delimiter); GetPlayer(args[0]).Rotate(new Quaternion( float.Parse(args[1]), float.Parse(args[2]), float.Parse(args[3]), float.Parse(args[4]))); } void Talk(string argsStr) { var args = argsStr.Split(Delimiter); GetPlayer(args[0]).Talk(args[1]); } NetworkPlayerController GetPlayer(string id) { return players_.ContainsKey(id) ? players_[id] : CreatePlayer(id); } NetworkPlayerController CreatePlayer(string id) { var obj = Instantiate(networkPlayerPrefab) as GameObject; obj.name = id; var player = obj.GetComponent<NetworkPlayerController>(); players_.Add(id, player); return player; } void DestroyPlayer(string id) { var player = GetPlayer(id); player.Talk("[LOGOUT] Good by!"); players_.Remove(id); Destroy(player.gameObject, 3f); } }
éããã¦ããã¡ãã»ã¼ã¸ã id
ã«å¿ãã¦éãå
ãå²ãæ¯ã£ã¦å®è¡ããã¹ã¯ãªããã§ããid
ã«ç´ä»ãããããªãã¸ã§ã¯ããåå¨ããªãå ´åã¯æ°è¦ã«ä½ããæ¥ç¶ãåããï¼= ãã©ã¦ã¶ãéããããï¼ã対象ã®ãªãã¸ã§ã¯ããæ¶å»ããå½¹å²ãæ
ã£ã¦ãã¾ãã
æå¾ã«ãããã§ãããã¯ã¼ã¯å´ã®ãªãã¸ã§ã¯ããåãã NetworkPlayerController
ãä½ã£ã¦åæç¨ãªãã¸ã§ã¯ãã® Prefab ã«ã¢ã¿ãããã¦ããã¾ãã
using UnityEngine; using UnityEngine.UI; using System.Collections; public class NetworkPlayerController : MonoBehaviour { public Text textUi; public void Move(Vector3 position) { transform.position = position; } public void Rotate(Quaternion rotation) { transform.rotation = rotation; } public void Talk(string message) { textUi.text = message; } }
åæç¨ã®ãªãã¸ã§ã¯ãã« Rigidbody ã³ã³ãã¼ãã³ãã使ãå ´å㯠Is Kinematic ããªã³ãUse Gravity ããªãã«ãã¦ããã¾ããããã§åé ã®ãã¢ã®å®æã§ãã
æ½è±¡åããªãã§ã´ãªã´ãªæ¸ãã¦ãã¾ã£ãã®ã§ã·ã³ãã«ã§ã¯ãããã®ã®è¥å¹²æé ã¯å¤ãã§ããã¾ããç¾ç¶ã®ä»çµã¿ã§ã¯ãã«ãããªãã¨ãããã°åºæ¥ãªããããæ¸ãåºãã«æéã®ããã WebGL ãã«ãã§ã¯è¦è¡æãããã¾ãããªã®ã§ãå®éã«éçºããéã«ã¯ããã©ã¦ã¶ã§ã®å®è¡ã Editor ã§ã®å®è¡ããè¦ã¦å¦çãåãåãã¦ãããã¬ã¤ã¤ãã¯ããã§ãããæ¹ãè¯ãã¨æãã¾ããã¨ã¯ããä»çµã¿ã¯ã·ã³ãã«ãªã®ã§ããªãã¨ã§ãããæ§ã¯ããã¨æãã¾ãã®ã§æ¯éããããä½ã£ã¦ã¿ã¦ãã ããã
ãã®ä»ã®ã²ã¼ã ã¨ã³ã¸ã³ã® WebGL 対å¿
Unreal Engine
æ¨å¹´ã®æç¹ã§ Unreal Engine 3 ã®ãµã³ãã«ã Mozilla ã¨ååã㦠WebGL ã«åºåãããã¢ãå ¬éããã¦ãã¾ããã
- 最新バージョンのChrome 31とOpera 18、asm.jsとWebGLで高速実行を実現。Unreal Engine 3対応に - Publickey
- WebGL.com - Beauty at the intersection of Math, Code & Design
ããã¦ç¾å¨ã® Unreal Engine 4 ã§ãã«ããã WebGL ãµã³ãã«ãããã¤ãä¸ãã£ã¦ãã¾ãã
ç¾å¨ã¯ã½ã¼ã¹ã³ã¼ããããã«ããã㨠HTML5 åºåã試ããããã§ãã
ä»çµã¿ã¨ãã¦ã¯åãã§ãEmscripten ã«ãã£ã¦ asm.js å½¢å¼ã® JS ãåãåºããã¾ãã 容éãé度ã«ããæ¯è¼ãªã©ã¯ãã¾ãä¸ãã£ã¦ããªãããã§ããUnreal Engine 㯠Unity ã®ããã«ä¸ã« Mono ã®ã¬ã¤ã¤ãããããã§ã¯ãªã C++ / Blueprint ãªã®ã§ Unity ãããå¤æã楽ãªã®ããªããã¨ç´ 人ç®ç·ã§ã¯æã£ã¦ãã¾ãã®ã§ããå®éã¯ã©ããªã®ã§ããããã
Esenthel Engine
Esenthel Engine ã§ã WebGL ãã«ããåºæ¥ãããã§ãã
ãã®ä»
C++ ãã JavaScript ã¸ã®å¤æ㯠Emscripten ãæ ã£ã¦ãããããEmscripten ã® Wiki ã«å©ç¨ãã¦ããã¡ã¸ã£ã¼ãªããã¸ã§ã¯ãä¸è¦§ãã®ã£ã¦ãã¾ãã
ãã®ä»æ°ã«ãªãåå
WebGL 2.0
ç¾è¡ã® WebGL 㯠OpenGL ES 2.0 ãã¼ã¹ã§ãããWebGL 2.0 ã§ã¯ OpenGL ES 3.0 ãã¼ã¹ã«ãªãã¾ããããã«ããè²ã ã¨è¡¨ç¾åãä¸ããã®ã§ããããã®å¯¾å¿ã«é¢ãã¦ã¯ Unity 5.x ã«ã¦èãã¦ãã㨠Unite 2014 ã®è³æã«è¨è¼ããã¦ãã¾ããã
WebVR
Oculus Rift 以å¤ã«ã Morpheus ã Google CardboardãGearVR ã®ãããªã¹ããç³»ããã¤ã¹ãªã©è²ã 㪠VR ããã¤ã¹ãããã¾ãããããããã©ãã©ãªæ©å¨ã«å¯¾ãã¦æç»ãããããã©ããã³ã°ããã¸ã·ã§ã³ãã©ããã³ã°ã¨ãã£ãæ©è½ãçµ±åçã«æ±ãã㨠Chrome ã Firefox ã§ã¯ WebVR ãéçºãã¦ãã¾ããããã¤ããµã³ãã«ãåºã¦ãå§ãã¦ãã¾ãã
- http://blog.bitops.com/blog/2014/06/26/first-steps-for-vr-on-the-web/
- WebVR(ブラウザーでVRデバイスが使用できるAPI)を軽く試して気づいたこと - Qiita
- Oculus Riftの仮想空間でプログラミングしてリアルタイムで3Dアニメーションを作成 - GIGAZINE
æ¥å¹´è¾ºãã«ã¯ã²ã¼ã ã¨ã³ã¸ã³ãã WebGL æ¸ãåºãã§ãããã¨ãã«ããã¦ã©ããã®ãµã¼ãã«ç½®ãã°çãã¢ã¯ã»ã¹ããã ãã§ã³ã³ãã³ãã楽ããããã¿ãããªä¸çãæ¥ã¦ãããã§ããã
Chrome ã® NPAPI 対å¿æã¡åãã«ãã WebPlayer ã®å»æ¢
2015/1 ãã Chrome ã® NPAPI 対å¿ãæã¡åã㨠Google ãçºè¡¨ãã¾ããã
Chrome ã¨ãã¦ã¯ããã«ãã NPAPI ã«ä¾åãã WebPlayer ã¯ãFirefox / Safari / IE ã§ã¯åä½ãã¾ãããChrome ä¸ã§ã¯åããªããªãã¾ããUnite 2014 ã§ã NPAPI ã«é¢ãã¦ã»ãã¥ãªãã£ãªã¹ã¯ã«è§¦ãããã¦ã¯ãã¾ãããããããªã«æ©ãå»æ¢ã«è¸ã¿åãã¨ã¯...ã¨ããæãã ã¨æãã¾ããå ¬å¼ã§ã¯ãããåãæ¢ãã¦ããããã㯠WebGL ãããã°ããããã¨è¨ã£ã¦ãã¾ãã
.NET ã®ãªã¼ãã³ã½ã¼ã¹å
å æ¥ãMicrosoft ã .NET ã®ã³ã¢ã©ã³ã¿ã¤ã ããªã¼ãã³ã½ã¼ã¹åããã¾ããã
ãããæãã㦠Unity ã«ã©ãå½±é¿ããã®ããè²ã è°è«ããã¦ã¾ãããããããã¾ããï¼èª°ãæãã¦ãã ããï¼ã
ã¡ãªã¿ã«ãããã°ã«ã¯ Microsoft ã¨ãä»æ¥ååã㦠.NET ã®ã¢ããã°ã¬ã¼ããé²ãã¦ãããã¨è¨è¼ããã¦ãã¾ãã
æ©ãæ°ããææ³ä½¿ã£ã¦ã³ã¼ãæ¸ãããã§ããã
æ¬æä¸ã«è¨è¼ãã¦ããªãåèæç®
- 【Unite Japan 2014】ブラウザで動くUnity。魔術的WebGL対応の技術が明らかに! - GAME Watch
- Mozillaのゲームに対する本気度を担当者が語る。WebGLが拓くゲームプラットフォームとしてのWebブラウザの姿
- 対è«ã®å 容ããã®ãããåèã«ãªãã¾ã
ãããã«
ã²ã¼ã ã¨ã³ã¸ã³ãã WebGL æ¸ãåºãã§ãããã¨ã«ãããThree.js ãªã©ãã¡ã¤ã³ã ã£ãããã¾ã§ã® Web ã® 3D ã³ã³ãã³ãã®æ·å± ã大ããä¸ãããã¾ã表ç¾åã¯ããè±ããªãã®ã¨ãªãã¾ãããã³ã³ã¼ãã¼ãªãã¶ã¤ãã®æ¹ã§ãããªãã®ãã®ãä½ããã¨æãã¾ãããµã³ãã«ã¨ãã¦ä½æãããã¢ãè¦ã¦ããåããé ããããã«ãæ¢åã® Web ã«å¯¾ããç¥è¦ã¨ã®è¦ªåæ§ãé«ãã§ããä»å¾ãããã©ã¨ãã£è±ããªã³ã³ãã³ããåºã¦ãããã¨ãã¨ã¦ã楽ãã¿ã§ãã
次åã® 12/9 ã¯ãã«ããããï¼@kiruroboï¼ã®ãKinectã§MMDã¢ãã«ãåãã話ãã«ãªãã¾ãã * KinectでMMDモデルを動かす話 – キルロボブログ