<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Kadinche Engineering - Medium]]></title>
        <description><![CDATA[Kadinche is an IT venture company established in 2008. We are engaged in joint research and contract development for virtual reality (VR), augmented reality (AR), mixed reality (MR), deep learning, machine learning, etc. - Medium]]></description>
        <link>https://medium.com/kadinche-engineering?source=rss----210dae76dd12---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Kadinche Engineering - Medium</title>
            <link>https://medium.com/kadinche-engineering?source=rss----210dae76dd12---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 01:15:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/kadinche-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Unreal Engine DMX Fixtures]]></title>
            <link>https://medium.com/kadinche-engineering/unreal-engine-dmx-fixtures-bb3f3219db88?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/bb3f3219db88</guid>
            <category><![CDATA[moving-head-lights]]></category>
            <category><![CDATA[unreal-engine]]></category>
            <category><![CDATA[dmx-plugin]]></category>
            <dc:creator><![CDATA[kalin go]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 04:39:23 GMT</pubDate>
            <atom:updated>2024-09-11T03:52:57.011Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unreal Engine DMX Fixtures/ムービングライトのカスタマイズ</h3><h3>概要</h3><p>Unreal Engine内で実機のムービングライトを設定し、照明を連動させる方法を解説します。特に、BP_MovingHeadを使用して、実機のゴボホイールとカラーホイールに合わせる手順を説明します。WebやYoutubeで見かけなかったので手探りで設定したことをまとめています。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FtEqO6-x1_aE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DtEqO6-x1_aE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FtEqO6-x1_aE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/de17da52db0f79b517d1e2504a3f0b75/href">https://medium.com/media/de17da52db0f79b517d1e2504a3f0b75/href</a></iframe><p>※動画の通り動作速度や色・ゴボ角度の一致調整は未対応です(今後)</p><h4>使用環境と灯体</h4><ul><li><strong>Unreal Engine</strong>: ver 5.3 &amp; DMX Plugin</li><li><strong>照明制御</strong>: Q Light Controller Plus (QLC+)</li><li><strong>実機灯体</strong>: AMERICAN DJ STINGER SPOT (StingerSpot)</li><li><strong>UE内灯体</strong>: DMX FixturesのBP_MovingHead</li></ul><h4>事前準備</h4><p><strong>１．Unreal Engine 5.3で空のプロジェクトを作成しDMX Pluginを有効化</strong></p><ul><li>プラグインの設定でDMX Plugin類にチェックを入れ再起動します。</li><li>DMX Pluginの導入設定は、<a href="https://dev.epicgames.com/documentation/ja-jp/unreal-engine/dmx-quick-start-in-unreal-engine?application_version=5.3">公式のドキュメント</a>や他の方がまとめていただいている記事や動画を参考にしてください。</li></ul><p><strong>２．BP_MovingHeadをコピーしシーンに追加</strong></p><ul><li>Engine/Plugins/DMX_Fixturesコンテンツ/LightFixturesにあるBP_MovingHeadをコピーしBP_MovingHeadStingerに名前変更します。</li><li>任意のフォルダに移動し、シーンに追加します。</li></ul><p><strong>３．QLC+からDMX信号を発信し、ArtNet経由でUEのDMX Pluginで受信</strong></p><ul><li>今回はUE外部から照明制御をしたいのでQLC＋からDMX信号を発信し、ArtNetを経由してUEのDMX Pluginで受信する構成としています。</li><li>QLC＋にStingerSpotを機器登録し、チャンネルを割り当てます。 StingerSpotは9チャンネル仕様を設定します。DMXチャートは製品マニュアル（<a href="https://www.soundhouse.co.jp/download/adj/stingerspot_v101.pdf?srsltid=AfmBOooP5_07cmNCDM_IagiIxdoy_WwAXuyZ4Bhf02FXemJso9usOWcj">日</a>・<a href="https://d295jznhem2tn9.cloudfront.net/ItemRelatedFiles/11167/ADJ%20Stinger%20Spot%20-%20User%20Manual.pdf">英</a>）を参照します。</li><li>QLC+を使わずに、UEのDMXConsoleからDMX信号を送信する構成もOKです。</li></ul><p>以下のような状態になれば、準備OKです。</p><blockquote><strong>・レベルにBP_MovingHeadStingerが追加されている</strong></blockquote><blockquote><strong>・DMXで BP_MovingHeadStingerが動いている</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6mGWBKBxfMqAh3CE1DEd1A.gif" /><figcaption>事前準備：MovingHeadがDMXコントローラーで動く状態</figcaption></figure><h4>ゴボホイールの変更手順</h4><p><strong>1．ゴボテクスチャの準備</strong></p><ul><li>StingerSpotの各ゴボ、1枚ずつpngで用意します。今回は<a href="https://d295jznhem2tn9.cloudfront.net/ItemRelatedFiles/11167/stinger_spot_gobo_wheel.pdf">メーカ製品サイト</a>からゴボテクスチャを作成しました。</li><li>デフォルトのゴボテクスチャは520×520ですが、サイズは1:1で使用できるようです。コンテンツフォルダの任意のフォルダに追加します。</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Pk-HajV7NhgQn6Tw" /><figcaption>作成したゴボのpngファイル</figcaption></figure><p><strong>2．ゴボテーブルの編集</strong></p><ul><li>Engine/Plugins/DMX_Fixtures/LightFixtures/EffectTableフォルダにあるGoboWheel_Tableをコピーします。</li><li>名前をGoboWheel_Table_Stingerに変更し任意のフォルダに保存します。</li><li>GoboWheel_Table_Stingerを開き編集します。今回はStingerSpotの9chで設定します。製品マニュアル（<a href="https://www.soundhouse.co.jp/download/adj/stingerspot_v101.pdf?srsltid=AfmBOooP5_07cmNCDM_IagiIxdoy_WwAXuyZ4Bhf02FXemJso9usOWcj">日</a>・<a href="https://d295jznhem2tn9.cloudfront.net/ItemRelatedFiles/11167/ADJ%20Stinger%20Spot%20-%20User%20Manual.pdf">英</a>）のDMXチャートの通り、ValueとFixturesをテーブルに登録します。※今回はSHAKEはなし、固定のSWAPと、Rotationのみ入力しています。</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fsx0Ta19Y-Yw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dsx0Ta19Y-Yw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fsx0Ta19Y-Yw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c147f6a2e284542a7798a35c289a6729/href">https://medium.com/media/c147f6a2e284542a7798a35c289a6729/href</a></iframe><p><strong>3．ゴボディスクの作成：ツールを使用してディスクを作成</strong></p><ul><li>Engine/Plugins/DMX_Fixtures/LightFixtures/Toolsを開きます。</li><li>BakeDiskTexturesにカーソルを合わせて右クリックメニューを開きウィジェットを実行します。</li><li>作成したEffectTableをコンテンツブラウザ上で選択し、『Pick』を押します。Disk作成先を指定し『CreateGoboDisk』を押します。指定したフォルダにCleanDiskとFrestedDiskが作成されます。</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FEmsezgDJWXM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DEmsezgDJWXM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FEmsezgDJWXM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/851df0e462699a9a7888249b051f8a2c/href">https://medium.com/media/851df0e462699a9a7888249b051f8a2c/href</a></iframe><p><strong>4．DMX Gobo Wheelの設定変更</strong></p><ul><li>アウトライナーでBP_MovingHeadStingerを選択し、詳細/GoboWheel_Componentで、『ブループリントで編集』を開きます。</li><li>GoboWheel_Componentを選択し、DMX Gobo Wheelの詳細設定で、Effect Table、Clean Disk、Frosted Diskの項目に作成した各ファイルを適用します。</li></ul><p>※アウトライナー上で適用すると、GamePlay中は適用されますが、シミュレーション停止時はデフォルトDiskが適用されるため、ブループリントのコンポーネントを編集しました。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQgfpuujn50E%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQgfpuujn50E&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQgfpuujn50E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ec54f3909fee7cf3e64ab5bb244b40e/href">https://medium.com/media/6ec54f3909fee7cf3e64ab5bb244b40e/href</a></iframe><h4>カラーホイールの変更手順</h4><p><strong>1．カラーホイールテーブルの編集</strong></p><ul><li>Engine/Plugins/DMX_Fixtures/LightFixtures/EffectTableフォルダにあるColorWheel_Tableをコピーします。</li><li>名前をColorWheel_Table_Stingerに変更し、任意のフォルダに保存します。</li><li>ColorWheel_Table_Stingerを開いて編集します。StingerSpotの9ch設定にします。製品マニュアル（<a href="https://www.soundhouse.co.jp/download/adj/stingerspot_v101.pdf?srsltid=AfmBOooP5_07cmNCDM_IagiIxdoy_WwAXuyZ4Bhf02FXemJso9usOWcj">日</a>・<a href="https://d295jznhem2tn9.cloudfront.net/ItemRelatedFiles/11167/ADJ%20Stinger%20Spot%20-%20User%20Manual.pdf">英</a>）のDMXチャートの通り、ValueとFixturesをテーブルに登録し保存します。※今回は固定のSWAPのみにしています。</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FCRheA5XzI9Y%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DCRheA5XzI9Y&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FCRheA5XzI9Y%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa85e1d4ec35fcff3892eb501fcab3b0/href">https://medium.com/media/aa85e1d4ec35fcff3892eb501fcab3b0/href</a></iframe><p><strong>２．カラーディスクの作成：ツールにバグあり？</strong></p><ul><li>GoboWheelと同様にToolsでColorWheelDiskを作成すると、UE5.3.2ではクラッシュします。UE5.1ではDiskテクスチャが一応作成されるのでバージョンのバグかと思われます。</li><li>ペイントツールなどでColorDisk(.png)を作成します。</li><li>任意のコンテンツフォルダにカラーディスクにするpngを追加し、ダブルクリックして詳細を開きます。</li><li>圧縮設定をVectorDisplacementmap(RGBA8)に変更して保存します。圧縮設定を変更しないとクラッシュが続きました。</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*G2RtA2Q0Zn_nsEp0DuYL8A.jpeg" /><figcaption>テクスチャの圧縮設定を変更する</figcaption></figure><p><strong>３．DMX Color Wheelの設定変更</strong></p><ul><li>アウトライナーでBP_MovingHeadStingerを選択し、詳細/ColorWheel_Componentで、『ブループリントで編集』を開きます。</li><li>ColorWheel_Componentを選択し、DMX Color Wheelの詳細設定で、Effect Table、Color Diskの項目に作成した各ファイルを適用します。</li><li>ColorArrayを『非表示』から『表示』に変更しておくと配色設定を確認しやすくなります。（非表示のままでもOKです）</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F6bu2V15Qk0E%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D6bu2V15Qk0E&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d259ca768647fe7f91573fe515df00c/href">https://medium.com/media/2d259ca768647fe7f91573fe515df00c/href</a></iframe><h4>手順完了</h4><p>BP_MovingHeadのゴボホイールとカラーホイールを実機同様に変更完了です。概要にある完成イメージのように連動出来ました。</p><p>その他に調整が必要な項目は、モーター動作速度、色合わせ、ゴボ角度、光収束感などがあります。</p><p>これらは実機灯体が設置された状態で調整していくのが望ましいです。どのパラメータで調整できるか今後確認したいです。</p><h4>試行錯誤を振り返り</h4><p>初めてムービングライトの電源を入れた&amp;Unreal Engineも正直わからないところからスタートしたので試行錯誤でした。例えば以下のような点でつまづきました。</p><p>・Componentのプレイと停止時の挙動の違い</p><p>・ColorWheel関連、テクスチャの圧縮設定で起こるクラッシュ</p><p>・Diskの作成方法（最終的にToolsがあることに気が付いた）</p><p>以上でBP_MovingHeadを利用したカスタマイズの紹介は終わりです。</p><p>ありがとうございました。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb3f3219db88" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/unreal-engine-dmx-fixtures-bb3f3219db88">Unreal Engine DMX Fixtures</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Architecture, MessagePipe, and VContainer by Creating a Game Requested by My Own Daughter]]></title>
            <link>https://medium.com/kadinche-engineering/learning-architecture-messagepipe-and-vcontainer-by-creating-a-game-requested-by-my-own-daughter-8ee8303a718?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/8ee8303a718</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[message-broker]]></category>
            <dc:creator><![CDATA[Ripandy Adha]]></dc:creator>
            <pubDate>Wed, 19 May 2021 06:26:35 GMT</pubDate>
            <atom:updated>2021-05-21T04:38:30.940Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is this all about?</h3><p>One day, my (almost) 3 years old daughter requested me to create a game. After a while, I found out that a messaging pipeline (Pub/Sub) library called <a href="https://github.com/Cysharp/MessagePipe">MessagePipe</a> has been released. Then, there’s Dependency Injection library called <a href="https://github.com/hadashiA/VContainer">VContainer</a> that I’ve been curious about. While I’m also on a Journey to find a good-enough architecture for Unity, I take this chance to do it all together.</p><p>The game itself is a simple number guessing game named Tebak Angka (Indonesian for “number guessing”). Given a number, pick the correct number from selection of numbers. As a game itself, it should be easy to be made. However, my main focus here is to try an architecture concept while also learn MessagePipe and VContainer.</p><p>Github project url : <a href="https://github.com/ripandy/TebakAngka">https://github.com/ripandy/TebakAngka</a><br>Playable url : <a href="https://ripandy.github.io/TebakAngka/">https://ripandy.github.io/TebakAngka/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*_0NkxB7RoWaZtZTc_iI1Pg.png" /><figcaption>Question is given by voice. Choose the correct answer!</figcaption></figure><h3>Architecture</h3><p>I’ve been learning Clean Architecture for a while now. I once mistakenly thought that the Clean Architecture as a framework, and I learned the hard way that it is not. That mistake made me detest Clean Architecture. As I’ve tried other Architectures, Design Patterns, Frameworks, etc., I realized that Clean Architecture is actually a concept and never a framework.</p><p>As for my understanding, Clean Architecture emphasize on independency from other frameworks, tools, or library that might be broken at any given time. However, nowadays it is really hard to not dependent to other library as it is actually very helpful to development in general. So, in my understanding, it is OK to hand pick few of the most useful framework or library. This time, it is MessagePipe and VContainer. Anything else, should be designed to be replaceable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dMRScNv3KYXI7-3e6CduaA.png" /><figcaption>Simple class diagram design. To be honest, I’m not sure about the name.</figcaption></figure><p>To begin, above are the (simply designed) class diagram for this project. I tried to follow the Clean Architecture concept. I tried to use layers of Domain, Presentation, and View. I also add MessagePipe layer as a bridge between Domain and presentation layer. Now let’s discuss on each of the layer.</p><h3>Domain Layer</h3><p>This layer contains the business logic of the application. This layer makes the application very specific and different from other application. For this project, this layer made it clear that this is a number guessing game.</p><p>This layer actually has two sub-layers: Game Model and Game State. Game Model only contains data while Game State contains no data but processes data from Game Model. In Clean Architecture’s definition this would be equivalent to Entity and Use Case layer respectively.</p><p>The Game State represents the flow of the game. Game starts with level generation state where the question and answer set is generated along with level progression and difficulty. Next, the game progresses into user input state where the app waits for the answer from the user. Finally, the game check for the user’s answer. Game state flow is managed by using a Game State Engine.</p><p>The logic of the game is clear enough. Generate question and answer, wait for answer, check for answer. At this point, It could be said that the game is actually completed. However, it is still a logic only, a very boring game without anything displayed and without anything interactive. There’s no implementation nor mentioning of how to display the numbers, how are the animation, or how the user will submit their answer. These are outside the business logic scope and will be handled in the presentation and/or view layer.</p><p>Below are the implementation of the domain layers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85744082575f514b412c3c4536e9d752/href">https://medium.com/media/85744082575f514b412c3c4536e9d752/href</a></iframe><h3>Presentation Layer</h3><p>This layer will handle information from Domain Layer then forward it to the View layer. If a conversion of information is necessary, it will also be handled in this layer.</p><p>According to Clean Architecture, Ideally you should use Interface to communicate with the View Layer. However, I decided that it is OK to reference directly to Unity’s classes as this is an actual Unity Projects. The reason being I had no intention to made this project convertible outside Unity, so why made the code complex by adding unnecessary Interfaces. I tried to follow the <a href="https://en.wikipedia.org/wiki/KISS_principle">KISS principle</a> here.</p><p>The idea of presentation layer is to present the domain layer to the user. In this case, I’d like to let the user know about the question and the available numbers. Then wait for the answer from the user. After answer had been submitted, present to the user whether the answer is correct or wrong.</p><p>In Clean Architecture term, Presentation layer is equivalent to the Interface Adapter layer. Referring to Clean Architecture, I add sub-layers in Presentation Layer: Presenter and Controller. Presenter manages outflow data to view objects such as animation, visibility, effects, etc. On the other hand Controller manages inflow or input data such as button press event.</p><p>Below are the implementation of the presentation layers. Note that I did not attach all the codes since it would be too complex to do so.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5cb5b4ae43ce9d4c5d29e1d7f0729dcd/href">https://medium.com/media/5cb5b4ae43ce9d4c5d29e1d7f0729dcd/href</a></iframe><h3>View Layer</h3><p>The class diagram made it looks like the View/Unity part smaller. In reality however, many parts are happening there, such as animation, audio source, particles, scene management, etc. This layer is all about Unity basics. Components, Classes that derived from MonoBehavior, UI, etc. would categorized to this layer. This separation between logical and design/UX could be helpful when working on a team with designer, who would not want to touch any of programming part.</p><p>The main idea of this layer is the visible or interactable part of the application. Personally, the characteristic of the View layer would be when left alone it can has very little to none correlation to the whole app. For example, a number in this app would mean nothing alone, but had a meaning of a choice in this specific app. Who knows maybe i want to use it in another app as a score display.</p><p>Below are the sample implementation of the view layers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5768a0c110b16bac28d2e9e8bf411d0b/href">https://medium.com/media/5768a0c110b16bac28d2e9e8bf411d0b/href</a></iframe><h3>Design Pattern</h3><p>Architecture is not a framework, nor it is a Design Pattern. Architecture is how to structure a project. Within a project architecture it is possible to use more than one design pattern. This is where I made my biggest mistake on learning Clean Architecture. Since I’ve thought an architecture as a framework, every single part of the project must follow certain rules or design pattern. And that is definitely not good. Use an appropriate design pattern wherever necessary.</p><p>In this project, I used <a href="https://gameprogrammingpatterns.com/state.html">The State Pattern</a> on Domain Layer. Basically, State limits any process within the scope of the state. Any other process will have to wait the state to change. I separated the gameplay into states. The states then flow from generating level, waiting user input, checking result, then start over from generating level.</p><p>Though implicitly, I also used The MVP pattern on Presentation layer. To be precise, the Presenter are controller class and the presenter class itself, the View are Unity’s Objects and classes derived from MonoBehavior, while the Model are value received from MessagePipe via subscription into IAsyncSubscriber.</p><h3>MessagePipe</h3><p>MessagePipe are used as a bridge between domain layer and presentation layer. In this project I use IAsyncPublisher and IAsyncSubscriberpair so that Game State can (a)wait for the Presentation and View layer as a mark when the current state is finished.</p><p>The reference in the actual class are only the interface. The actual implementation of the interface are within the MessagePipe library and are injected using a Dependency Injection technique. In this project the Dependency Injection library are VContainer.</p><p>I don’t do anything specific on the MessagePipe part other than made reference to the interface and handle its injection, but it has quite an impact to the actual project.</p><h3>VContainer</h3><p>Dependency Injection library that is lightweight and quite powerful. I’ve used other DI library for Unity before, but I personally prefer VContainer out of simplicity.</p><p>What VContainer do is basically hold references to the classes used in the project, then inject them to the classes that need it. This is very helpful as managing references by our own would be quite a chore.</p><p>Below are the sample implementation of the VContainer class in this project.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa0168b5290b128ee22179d8775e1efa/href">https://medium.com/media/fa0168b5290b128ee22179d8775e1efa/href</a></iframe><h3>Acknowledgement</h3><p>I understand that I’m far from perfect. There’s a lot that I don’t understand and I’d continue learning. Few points that I still have doubts are below :</p><ul><li>The architecture in this project made reference primarily to Clean Architecture, but I’m not sure as to call it Clean Architecture as It might also had reference to DDD, and others. But one thing for sure that it is a Layered Architecture.</li><li>It is hard to decide whether CardView and ResultView should be considered a View Layer or Presentation Layer. Personally, I think they have a similar role.</li><li>I Personally think that the DI part can be separated either by Game State (Use Case) or Presenter, instead of one big DI of GameplayLifetimeScope.</li><li>The project in this writing are simple. In a larger project, there might be difficulties on separation of layer, roles, etc. This doesn’t guarantee a perfect layering example for other projects. But I personally think that this is “good enough”.</li></ul><h3>Conclusion</h3><ul><li>Clean Architecture is never a framework, it is a concept. Don’t make the same mistake.</li><li>It is OK to depend on few hand picked framework or library. In this case MessagePipe and VContainer.</li><li>It is OK to use any suitable Design Patterns in any part of the layer. In this project I used <a href="https://gameprogrammingpatterns.com/state.html">The State Pattern</a> on Domain layer.</li><li>This project use a layered architecture and has a Domain Layer, Presentation Layer, View Layer.</li><li>Domain Layer handles business logic and defines the project as a specific application.</li><li>Presentation Layer forwards and translates information from Domain Layer to View layer.</li><li>View Layer handles the visible, hearable, and interactable part of the application.</li><li>MessagePipe is a Pub/Sub Messaging Pipeline library that useful as a bridge between Domain Layer and Presentation Layer in this project.</li><li>VContainer is a Dependency Injection library that is lightweight and quite powerful.</li></ul><p>Thanks for reading! Any constructive feedback is highly appreciated!</p><h3>References</h3><p><a href="https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html">https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html</a></p><p><a href="https://www.freecodecamp.org/news/a-quick-introduction-to-clean-architecture-990c014448d2/">https://www.freecodecamp.org/news/a-quick-introduction-to-clean-architecture-990c014448d2/</a></p><p><a href="https://github.com/Cysharp/MessagePipe">https://github.com/Cysharp/MessagePipe</a></p><p><a href="https://github.com/hadashiA/VContainer">https://github.com/hadashiA/VContainer</a></p><p><a href="https://gameprogrammingpatterns.com/state.html">https://gameprogrammingpatterns.com/state.html</a></p><p><a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter">https://en.wikipedia.org/wiki/Model–view–presenter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ee8303a718" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/learning-architecture-messagepipe-and-vcontainer-by-creating-a-game-requested-by-my-own-daughter-8ee8303a718">Learning Architecture, MessagePipe, and VContainer by Creating a Game Requested by My Own Daughter</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reality Captureでの穴埋め例]]></title>
            <link>https://medium.com/kadinche-engineering/reality-capture%E3%81%A7%E3%81%AE%E7%A9%B4%E5%9F%8B%E3%82%81%E4%BE%8B-8b0e59abcd3c?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/8b0e59abcd3c</guid>
            <category><![CDATA[reality-capture]]></category>
            <category><![CDATA[photogrammetry]]></category>
            <category><![CDATA[clipping-box]]></category>
            <category><![CDATA[フォトグラメトリ]]></category>
            <dc:creator><![CDATA[kalin go]]></dc:creator>
            <pubDate>Wed, 14 Apr 2021 04:31:07 GMT</pubDate>
            <atom:updated>2021-04-14T04:31:07.228Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A0zuDt8Z2oh4kbY2gdV8IQ.jpeg" /></figure><p>撮影した写真に薄い素材や光の反射があると、フォトグラメトリでは穴があきやすいです。</p><p>穴埋めや凹凸の修正が必要な場合は、主にBlenderを使用していますがReality Captureでの穴埋めも便利なので使用することが多いです。</p><p>穴埋め編集の際、その存在に気が付いて便利だったツールの一つが<strong>クリッピングボックス</strong>です。</p><h4>便利なクリッピングボックス</h4><p>シーンタブのツール内にあります。指定したボックス内のみに表示範囲を絞ることが出来ます。</p><p>モデルの三角面数が多くPCでの表示能力が足りない場合でも、クリッピングボックスを使用することで点群だけでなく、ソリッドもSweetも表示できます。</p><p>穴埋め編集では、重なりがあり、部分的に選択するのが難しい場所に使用しています。</p><h4>クリッピングボックスを利用した穴埋め編集</h4><p>では、クリッピングボックスを利用した穴埋め編集の例を紹介します。対象の箇所は、日本家屋の屋根瓦にあいた小さな穴です。家の壁や縁側が下方にあるため部分選択をしづらい箇所です。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GaiksI9Z3XYwJQLVYQqFeg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*82BbU2sALfJRlBikNV4new.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mVbnPGQPHThGQVN3zVqxXQ.jpeg" /><figcaption>通常全体を表示していると意図していない部分まで選択される</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*vBFCFS7YVrJDPPPr_TO0qA.jpeg" /></figure><p>シーンタブにあるクリッピングボックスで対象の穴の周囲のみ表示します。表示されている部分のみ選択が可能です。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lNiIA7sHLT5lsjFZgVbD8g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*urVvQbxIU4YsKlnQZh2YWQ.jpeg" /><figcaption>クリッピングボックスで編集したい箇所のみ表示する</figcaption></figure><h4>穴の周囲を選択して削除</h4><p>再構築タブのツール（なげなわなど）で選択 → 選択をフィルターで削除 →クリーンモデル(*1)で穴埋め の順で行います。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HGtJU8q_IDx0XfH8XUOGEg.jpeg" /></figure><p>テクスチャは他の穴や凹凸などモデル全体のメッシュを整えてから再計算します。</p><p>下記の動画では、分かりやすいようにクリーンモデルで穴埋め後すぐにテクスチャ再計算結果を表示しています。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhYsIQIWrxF4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhYsIQIWrxF4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FhYsIQIWrxF4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d206aa22650acbf42c25e939dc4a47c6/href">https://medium.com/media/d206aa22650acbf42c25e939dc4a47c6/href</a></iframe><p>＊1 クリーンモデルは、モデル全体のチェックを行い自動修復するツールです。穴を閉じるツールが別途ありますが、今回はクリーンモデルを使用しました。</p><p>β版とはいえ日本語対応されてReality Captureの機能について分かりやすくなりました。ツールや設定を使い分けて編集時間を楽しみたいです。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b0e59abcd3c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/reality-capture%E3%81%A7%E3%81%AE%E7%A9%B4%E5%9F%8B%E3%82%81%E4%BE%8B-8b0e59abcd3c">Reality Captureでの穴埋め例</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sony ELF-SR1の環境構築と実機でサンプルを動かすまで]]></title>
            <link>https://medium.com/kadinche-engineering/sony-elf-sr1%E3%81%AE%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89%E3%81%A8%E5%AE%9F%E6%A9%9F%E3%81%A7%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%92%E5%8B%95%E3%81%8B%E3%81%99%E3%81%BE%E3%81%A7-448799631451?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/448799631451</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[elf-sr1]]></category>
            <dc:creator><![CDATA[Yotaro Hashimoto]]></dc:creator>
            <pubDate>Wed, 13 Jan 2021 09:05:12 GMT</pubDate>
            <atom:updated>2021-01-15T01:50:19.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwueEwe9uuNOen96cSLUGA.jpeg" /><figcaption>ELF-SR1一式</figcaption></figure><p>この記事では Unity でELF-SR1の開発を行う際の 環境構築とサンプルシーンのビルドまでを行います。</p><h3>目次</h3><ol><li>初めに</li><li>動作環境の紹介</li><li>PC上のセットアップ</li><li>unity上の操作（ビルドまで）</li><li>自作プロジェクトの紹介</li><li>終わりに</li></ol><h3>1. 初めに</h3><p>筆者は人生で一度も記事を書いたことがないど素人なので拙い部分が存在するかと思いますが暖かい目で見守って頂けると幸いです。</p><h3>2. 動作環境の紹介</h3><h4><strong>推奨PCスペック</strong></h4><p>・OS：Windows 10 (64-bit)</p><p>・CPU：AMD Ryzen 5 3600X以上 (6 Core以上)</p><p>・GPU：GeForce RTX2060以上</p><p>・Memory：8GB以上</p><p>・Storage：SSDを推奨</p><h4><strong>対応環境</strong></h4><p>・Unity 2018.4, 2019.4, 2020.1</p><p>・Unreal Engine 4.24, 4.25</p><h4>今回は以下のPCスペックと環境でビルドを行いました。</h4><h4>PCスペック</h4><p>・OS：Windows 10 (64-bit)</p><p>・CPU：Intel Core-i7 10750H</p><p>・GPU：GeForce RTX 2070 super</p><p>・Memory：16GB</p><p>・Storage：SSD</p><h4>動作環境</h4><p>・Unity2019.4.15f1</p><p>・Visual Studio 2019</p><p>ちなみにWindows上でしか動かないです（泣）Bootcampを使用したMacで動くかどうかはまだ不明です。そのうちやります。スペック次第ですが望み薄です。</p><h3>3. PC上のセットアップ</h3><p>やることをすごくざっくり説明すると</p><ol><li>画面の設定</li><li>必要な物をダウンロード＆インストール</li><li>ちゃんとELF-SR1が機能しているかの確認</li></ol><p>です。</p><p>以下詳しい説明と画像です。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0dX1HtcQj3WXDUPlZuyu4g.png" /><figcaption>画像１</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8AcmLnDnL4ZpNwmZbmBnCg.jpeg" /><figcaption>画像2</figcaption></figure><p>①ELF-SR1をWindows PCと接続した状態でディスプレイの設定を行います。画像２のようにELF-SR1の画面サイズを１００％、解像度を3840ｘ2160、画面の向きを横に変更します。その後マルチディスプレイの設定を「表示画面を拡張する」に変更します。</p><p>※ 今回はELF-SR1を横にして使用しますが縦でコンテンツを制作することも可能です。縦て展示などする場合は画面の向きを縦に変更してください。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qbhs2t0vPzD-tWvEu8U5Rw.png" /><figcaption>画像３</figcaption></figure><p>② <a href="https://www.sony.net/Products/Developer-Spatial-Reality-display/jp/develop/Setup/DownloadInfo.html">https://www.sony.net/Products/Developer-Spatial-Reality-display/jp/develop/Setup/DownloadInfo.html</a> から開発に必要なプラグインとドライバーをダウンロードします。</p><blockquote><strong><em>以下内容物の説明です。読まなくても大丈夫です。</em></strong></blockquote><blockquote><em>SR Display Runtime Installer には以下の２つのソフトウェアが含まれています。</em></blockquote><blockquote><em>・SR Display Runtime libraries &amp; device drivers</em></blockquote><blockquote><em>・SR Display Settings application</em></blockquote><blockquote><em>SR Display Runtime libraries &amp; device driversはunity上でビルドする際に必要なライブラリとELF-SR1用のドライバーです。インストールすることでELF-SR1で開発を行うことができるようになります。</em></blockquote><blockquote><em>SR Display Settings applicationはSR Displayの設定値の調整や高速ビジョンセンサーがユーザの顔を認識できているか確認することができるアプリです。</em></blockquote><blockquote><em>SR Display Plugin for Unity は Unityで開発を行う際に必要なものを詰め込んだzipファイルのようなものです。4. Unity上の操作で使用します</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/0*9P0crq1bgEpLeyfL.png" /><figcaption>画像４ ELF-SR1のビジョンセンサーのステータスバー</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*usD_MR3uzkZnsEKnYnnu0Q.png" /><figcaption>画像５ カメラのキャプチャ画像ウィンドウ</figcaption></figure><p>③ WindowsボタンからSR Display Settingsを起動し、動作確認を行います。自分の顔に赤枠が表示されて入れば確認完了です。</p><blockquote><strong><em>以下各ボタンなどの説明です。</em></strong></blockquote><blockquote><em>ステータスバーのCamera Gain settingではカメラ光量を調整することが可能です。 自分の顔がきちんと見える光量に調整してみましょう。Auto Exposureにチェックをいれると自動で調節してくれます。</em></blockquote><blockquote><em>Crosstalk Correctionはノイズなどを修正してくれるシステムです。Application Cotrolledを選択するとunity側の設定がCrosstalk Correctionに反映されます。 offはCrosstalk Correctionがない状態になります。</em></blockquote><h3>4. Unity上の操作</h3><p>新規プロジェクトを作る→プロジェクトの設定をする→サンプルシーンをビルド の３ステップでやっていきます。</p><h4>ステップ１ 新規プロジェクトの作成</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lReC4Xn8QzFT3N9U_fu_g.png" /><figcaption>画像６</figcaption></figure><p>プロジェクト名は何でも大丈夫です。全角文字やスペースはよく悪さをするのでできるだけ半角文字を使用しましょう。保存先も自由に決めて大丈夫です。決めたら作成ボタンをクリックします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gX1TGkzDg-4nZDoHceKC4g.png" /><figcaption>画像７</figcaption></figure><p>プロジェクトの作成に成功し、シーンが展開されたらとりあえずツールバーのF<strong>ile</strong>→S<strong>ave</strong>で保存しましょう。</p><h4>ステップ２ プロジェクトの設定をする</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v7sbLQMiF1NNYau7mXPilg.png" /><figcaption>画像８</figcaption></figure><p><strong>Save</strong>ができたら３．PC上のセットアップの際にダウンロードしたSR Display Plugin for Unity を作成したシーンにインポートします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/0*d1K-zJxetm01veBH.png" /><figcaption>画像９</figcaption></figure><p>SR Display UnityPluginは<strong>Windows x86_64</strong>アーキテクチャのみ対応しているので設定が違うとインポートの際に画像９のように警告がでます。<strong>ok</strong>を押すと自動で設定を変更してくれます。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nwqfWEF8EErx2bEYJ_U0iw.png" /><figcaption>画像１０</figcaption></figure><p>ELF-SR1用にプロジェクトの設定を変える必要があるのでツールバーのE<strong>dit</strong>→P<strong>roject Setting</strong>を開きましょう。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yVHVg2XrshSY0O7z.png" /><figcaption>画像１１</figcaption></figure><p><strong>Quality</strong>を選び、その後画面下部の<strong>VSync Count</strong>がEvery V Blankになっていると思うので赤枠のようにDon’t Syncに変更しましょう。</p><p>これでunityプロジェクトの設定は完了です。 次は実際にシーンをビルドしてディスプレイ上で動いているところを見てみましょう。</p><h4>ステップ３ サンプルシーンをビルド</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N7RS4fInOu9MCWyvO-UKhw.png" /><figcaption>画像１２</figcaption></figure><p>画像11のように<strong>Project</strong>ウィンドウから<strong>Asset</strong>欄を開きSRDisplayUnityPlugin →Samplesy→0_SRDSampleHome→Scenes→SRDisplaySampleHomeを開きましょう。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5AhO4bX0wzdHvrVTTGIQw.png" /><figcaption>画像１３</figcaption></figure><p>ツールバーの<strong>File</strong>→<strong>Build setting</strong>を開きましょう。Scenes In Buildに6種類のシーンが追加されていること、PlatformがPC Mac &amp; Linux Standaloneになっていることを確認してたら<strong>Build and Go </strong>をクリックしましょう。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0ON7cAGjsZqImsVHLJyXw.png" /><figcaption>画像１４ 人間の目に合わせているのでカメラをむけると高確率で歪みます(泣) 写真上手く撮れる用に精進します。</figcaption></figure><p>Buildすると画像１４のような画面が出てきます。数字の１〜５を押すことで色々なサンプルが体験できます。</p><h3>5. 自作プロジェクトの紹介</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooStJyZKrIH5wow-dKjgLQ.png" /><figcaption>画像１５ ELF-SR1を用いた地球しか見えないプラネタリウム</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*18vwxv3bcVEUUexp1BPgFQ.png" /><figcaption>画像１６ hierarchyとInspector</figcaption></figure><p>SRDisplayBoxの壁に合わせて内側にquadを配置し、quadのテクスチャーを変更することことで画像16のように背景を作ることができます。またleap motion などのガジェットと合わせることで活用の幅が広がるのでぜひ色々試してみてください。</p><h3>6.終わりに</h3><p>お疲れさまでした！<br>最後まで読んでいただきありがとうございます。 今回は公式が出しているドキュメントを見ながら制作しました。 少しでも参考なれば嬉しいです。</p><p><a href="https://www.sony.net/Products/Developer-Spatial-Reality-display/jp/develop/Overview.html">Sony Global - SPATIAL REALITY DISPLAY | Overview</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=448799631451" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/sony-elf-sr1%E3%81%AE%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89%E3%81%A8%E5%AE%9F%E6%A9%9F%E3%81%A7%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%92%E5%8B%95%E3%81%8B%E3%81%99%E3%81%BE%E3%81%A7-448799631451">Sony ELF-SR1の環境構築と実機でサンプルを動かすまで</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unity Androidプラグインの手間を軽減する管理方法]]></title>
            <link>https://medium.com/kadinche-engineering/unity-android-plugin-building-82820a4ece45?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/82820a4ece45</guid>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[Mitsuhiro Koga]]></dc:creator>
            <pubDate>Tue, 30 Jun 2020 11:45:46 GMT</pubDate>
            <atom:updated>2020-07-01T05:41:38.773Z</atom:updated>
            <content:encoded><![CDATA[<h3>はじめに</h3><p>UnityでAndroidプラグインを作るとUnityプロジェクトとAndroidプロジェクトそれぞれで開発しますがAndroidプラグインが依存するライブラリを探したりaarやjarをUnityプロジェクトに取り込むのは煩雑です。その手間をGradleの機能を駆使して簡単に管理する方法を紹介します。</p><h3>課題と方針</h3><ul><li>UnityプロジェクトとAndroidプロジェクトで整合が取れたaarおよびjarを管理するのが面倒</li><li>Androidプラグインが依存するライブラリを管理するのが面倒</li><li>Unityプロジェクト側からaar/jarのバージョンが分かりにくい</li></ul><p>以上の課題を解決するためにAndroidプラグインをMavenローカルリポジトリとして出力してUnityプロジェクトではGradleのdependenciesでライブラリおよびバージョン指定します。</p><p>以降ではカラフルなトーストを表示する <a href="https://github.com/GrenderG/Toasty">Toasty </a>に依存したAndroidプラグインを参考にUnityとAndroidプロジェクトの設定を解説します。</p><p>サンプルプロジェクトは <a href="https://github.com/kadinche/UnityAndroidToasty">UnityAndroidToasty </a>に置きましたので参考にしてください。特に重要な設定変更を行ったコミットメッセージは✨で始めています。</p><h4>プロジェクトのフォルダ構成</h4><p>Unityプロジェクト(UnityAndroidToasty)とAndroidプロジェクト(ToastyWrapper)の2つを並べて、Unityプロジェクトの中にMavenローカルリポジトリ(m2repository)を配置します。</p><pre>- UnityAndroidToasty<br>  - m2repository<br>- ToastyWrapper</pre><h4>Androidプロジェクトの設定</h4><p>Androidプロジェクトのプラグイン用モジュールに配置したbuild.gradleに以下の内容を追加します。</p><pre>group = &#39;com.kadinche.example&#39; // モジュールのライブラリ名を設定<br>version = &#39;0.0.1&#39; // モジュールのバージョンを設定<br><br>afterEvaluate { // Mavenローカルリポジトリを出力するための設定<br>    publishing {<br>        publications {<br>            // Set for all build variant<br>            android.libraryVariants.all { variant -&gt;<br>                &quot;maven${variant.name.capitalize()}Aar&quot;(MavenPublication) {<br>                    from components.findByName(&quot;${variant.name}&quot;)<br>                    if (&quot;${variant.name}&quot; != &quot;release&quot;) {<br>                        version = &quot;${version}-${variant.name}&quot;<br>                    }<br>                }<br>            }<br>        }<br>        repositories {<br>            maven {<br>                // Androidプロジェクトからm2repositoryへの相対パスを設定<br>                url &quot;${rootProject.projectDir}/../UnityAndroidToasty/m2repository&quot;<br>            }<br>        }<br>    }<br>}</pre><p>次にGradleで以下のタスクを実行するとm2repositoryフォルダにMavenローカルリポジトリが出力されます。</p><pre>cd ToastyWrapper<br>./gradlew clean build publish</pre><p>また、Android Studioで以下のようにタスクを定義して実行しても同じようにMavenローカルリポジトリに出力できます。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-VTvGnWN6atZnz_rpDEkMQ.png" /></figure><p>Mavenローカルリポジトリにはリリース用とデバッグ用の2種類のライブラリが出力されて、依存ライブラリは*.pomファイルに定義されています。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/0*LwgpgEJTYfLK_3oV" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/0*zMtfaKesH96vFTMB" /></figure><h4>Unityプロジェクトの設定</h4><p>UnityでAndroidプラットフォームのProject Settingsを開き、Publishing SettingsのCustom Main Gradle Templateをチェックします。するとAssets/Plugins/Android/mainTemplate.gradleが生成されます。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/0*2Kqz8N_gkZely33I" /></figure><p>生成したmainTemplate.gradleに以下の内容を追加します。dependenciesのdebugImplementationはUnityのBuild SettingsでDevelopment Buildをチェックした時に使われ、releaseImplementationはチェックを外した時に使われます。ここで指定する名前はAndroidプラグインのbuild.gradleに追加したgroupとversionの間にモジュール名を連結したものです。</p><pre>// ここから追加 (Mavenローカルリポジトリと追加のMavenリポジトリ参照用)<br>([rootProject] + (rootProject.subprojects as List)).each { project -&gt;<br>    project.repositories {<br>        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace(&quot;\\\\&quot;, &quot;/&quot;)<br>        maven {<br>            url (unityProjectPath + &quot;/m2repository&quot;)<br>        }<br>        maven {<br>            url &quot;&lt;https://jitpack.io&gt;&quot;<br>        }<br>    }<br>}<br>// ここまで追加<br><br>dependencies {<br>    implementation fileTree(dir: &#39;libs&#39;, include: [&#39;*.jar&#39;])<br>// ここから追加 (dependenciesにAndroidプロジェクトのライブラリを追加)<br>    debugImplementation &#39;com.kadinche.example:toastywrapper:0.0.1-debug&#39;<br>    releaseImplementation &#39;com.kadinche.example:toastywrapper:0.0.1&#39;<br>// ここまで追加<br>**DEPS**}</pre><p>最後にUnityからAndroid向けにビルドすればGradleのdependenciesのおかげでAndroidプラグインが依存するライブラリを配置しなくても自動的にダウンロードされて取り込まれてapkが生成されます。</p><h4>Androidプラグインの仕様が変わる時の対処</h4><p>Androidプロジェクトのbuild.gradleのversionを増やして、UnityプロジェクトのmainTemplate.gradleのdependenciesも同様のバージョンに変更します。これでAndroidプラグインの開発を先行しておきUnity側が追い付いたらmainTemplate.gradleのバージョンを書き換えるだけで済みます。</p><h4>m2repositoryフォルダの配置場所について</h4><p>Unityから使うaarおよびjarはAssets/Plugins/Androidなどに配置しておくとビルド時に自動的に収集されるのですがこれまでに解説した方法だとリリース用とデバッグ用の2つのライブラリがあるのでクラスが重複してビルドエラーになってしまいます。またライブラリの取り込みはmainTemplate.gradleに設定しているのでm2repositoryフォルダはUnityプロジェクトの外側に配置しています。</p><h3>おわりに</h3><p>AndroidプラグインをUnityに取り込む手間を軽減する方法を解説しました。サンプルプロジェクトではToastyを組み込みましたが一度設定してしまえば他のライブラリもbuild.gradleのdependenciesに追加するだけで簡単に取り込む事ができます。</p><h3>参考リンク</h3><ul><li><a href="https://docs.gradle.org/current/userguide/publishing_maven.html">Maven Publish Plugin</a></li><li><a href="https://docs.unity3d.com/ja/current/Manual/android-gradle-overview.html">Android の Gradle — Unity マニュアル</a></li><li><a href="http://blog.eppz.eu/unity-android-plugin-tutorial-1/">Unity Android plugin tutorial (1/3) Fundamentals</a></li><li><a href="https://github.com/GrenderG/Toasty">Toasty</a></li><li><a href="https://github.com/kadinche/UnityAndroidToasty">UnityAndroidToasty</a></li></ul><h3>採用のお願い</h3><p>私の所属するカディンチェ株式会社では、積極的にUnityエンジニア、画像処理系エンジニア等の採用を行っております。募集については、コーポレートサイトのリクルートからご確認いただけます。</p><p>また、VRメタバースアプリを始めとするVR/ARアプリの開発を行っていますので、お問い合わせはお気軽にどうぞ。</p><p><a href="https://www.wantedly.com/companies/kadinche/projects">カディンチェ株式会社の採用/求人一覧 - Wantedly</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82820a4ece45" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/unity-android-plugin-building-82820a4ece45">Unity Androidプラグインの手間を軽減する管理方法</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unityゲーム設計についての、2つの考え方]]></title>
            <link>https://medium.com/kadinche-engineering/unity%E3%82%B2%E3%83%BC%E3%83%A0%E8%A8%AD%E8%A8%88%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE-2%E3%81%A4%E3%81%AE%E8%80%83%E3%81%88%E6%96%B9-59d76eac2a10?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/59d76eac2a10</guid>
            <category><![CDATA[vr]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[ar]]></category>
            <dc:creator><![CDATA[Takashi Miwa]]></dc:creator>
            <pubDate>Wed, 13 May 2020 05:51:21 GMT</pubDate>
            <atom:updated>2020-05-13T10:13:36.575Z</atom:updated>
            <content:encoded><![CDATA[<h3>はじめに</h3><p>Unityのゲームアーキテクチャについての対照的な2つの素晴らしい講演について、注釈をつけて解説する。</p><p>どちらの講演も、日本語のブログがUnity公式から出ているので、それと講演動画、ソースコードを参照して、私が咀嚼した備忘録的な内容となっている。理解の助けとなれば嬉しい。</p><h3>1. Scriptable Objectを活用した設計</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FraQ3iHhE_Kk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DraQ3iHhE_Kk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FraQ3iHhE_Kk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0654589bbd3c3b225bab918160d4095c/href">https://medium.com/media/0654589bbd3c3b225bab918160d4095c/href</a></iframe><ul><li><a href="https://forpro.unity3d.jp/unity_pro_tips/2019/07/27/57/">ゲーム構築を劇的にスマートにする Scriptable Objectの 3つの活用方法 - Unity for Pro</a></li><li><a href="https://github.com/roboryantron/Unite2017">roboryantron/Unite2017</a></li></ul><h4>概要</h4><p>シングルトンパターンのデメリットから、Scriptable Objectの活用術を4つ紹介している。</p><h4><strong>Variable</strong></h4><p>floatなど型を直接クラス内で使う代わりに、このScriptable Objectを使用すれば、エディター上で独立した変数アセットとして扱うことができる。</p><p>例えば、同じプレーヤーHPを2つの別のクラスで使う際も、このScriptable Objectをエディター上で生成し、参照をつけてやれば、2つのクラスは互いに疎結合となる。</p><p>また、ReferenceというScriptable Objectも紹介されており、これは上記のVariableに変数か、定数かについての表現を追加したものである。</p><h4>Event</h4><p>イベントとイベントリスナーで構成され、前者がScriptable Objectとなる。</p><p>イベントごとにイベントリスナーが複数個紐づけられ、イベントのRaiseメソッドが呼ばれると、紐づいたイベントリスナー群によって、さまざまなメソッドが発火するというシンプルな仕組みだ。</p><p>これもイベントがScriptable Objectであるため、UnityEventに参照を入れ、Raiseを呼び出したりと、エディター上での見通しが良くなるし、それぞれが疎結合となる。</p><p>UnityEventはとても使い勝手がいいが、そのまま使うとシーン上のオブジェクトを直接参照に入れなくてはならず、オブジェクト同士が密結合になってしまう。</p><h4>Set</h4><p>セットは生成されたゲームオブジェクトをトラッキングすることにもってこいのScriptable Objectだ。</p><p>ゲームオブジェクトをセットに設定すると、そのゲームオブジェクト群を一つのScriptable Objectとして扱える。そうすると例えば、ある親ゲームオブジェクトに子ゲームオブジェクト群の参照を持たせるなどの見通しの悪い事態が起こりにくい。</p><h4>Element</h4><p>最後に、エレメントだ。これはEnumをより進化させたScriptable Objectと捉えたら良いと思う。</p><p>Enumはコード上で変更しなくてはならず、削除や順序を変えるのが難しい。また、追加のデータを加えることはできない。</p><p>こうした問題を解決するのが、エレメントである。といっても中身はとてもシンプルで、他のScriptable Objectのリストだ。</p><p>例えば、他のゲームオブジェクトと衝突した際に、そのオブジェクトに紐づくエレメントを参照すれば、そのゲームオブジェクトのEnum的な情報を引っ張ってこれる。さらにScriptable Objectなので、順序の変更などはエディタ上で柔軟に可能だ。</p><h4>まとめ</h4><p>以上がこの講演の概要だと思う。基本的な方針としてUnityエディターに何が起こっているか把握させ、最大限利用するためのTips集だと理解した。</p><h3>2. C#クラスを活用した設計</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1le4vScG3gk%3Fstart%3D1919%26feature%3Doembed%26start%3D1919&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1le4vScG3gk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1le4vScG3gk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/413c4530e2a5a6977acbc27d95c8d9f8/href">https://medium.com/media/413c4530e2a5a6977acbc27d95c8d9f8/href</a></iframe><ul><li><a href="https://forpro.unity3d.jp/unity_pro_tips/2019/10/30/288/">プロジェクトが大規模化してもコードを整然とした状態に保つコツ - Unity for Pro</a></li><li><a href="https://github.com/Kalmalyzer/Pong">Kalmalyzer/Pong</a></li></ul><h4>概要</h4><p>こちらの講演の方が、前述の講演より幅広い内容を扱っている。さらに、後半のTipsについては、上記のブログを読めば十分理解できると思うので、より理解が難しい前半の設計の方に焦点を当てたい。</p><h4>設計の方針</h4><p>この講演と、前述の講演の最大の違いはUnityエディターにどれくらい事象を把握させるかだ。</p><p>つまり、前述の講演では、Scriptable Objectを最大限活用し、エディター上で様々な作業が完結するようにしている。</p><p>一方で、この講演では、Scriptable Objectは使用するものの、あくまでデータを保持するものとし、積極的にエディター外、つまりMonoBehaviourを使用しないC#クラスに処理を分割しようとしている。そのメリットについては後述する。</p><p>そのうえで、講演者は「単一責任の原則」に従い、以下の5つにクラスを分割しようと試みている。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/0*7E8N_y4IZCPt0A9O.jpg" /></figure><h4>Input</h4><p>名前の通り、入力を扱うクラスである。ロジックやシミュレーションなどからは独立したクラスとなっていることが好ましい。</p><h4>Simulation</h4><p>シミュレーションは、この講演では物理計算を行う際に、その計算を置くクラスとして紹介されている。しかし、より汎用的には様々な計算をする際に、その処理を外に出すくらいに考えても良いと思う。</p><p>ロジックから使用されるが、シミュレーションはロジックの内容を知らないことが多い。</p><h4>Logic</h4><p>ロジックは汎用的ゲームロジックを表す。上記のインプットやシミュレーションを使用し、一つのロジックを構成する。</p><h4>Presentation</h4><p>プレゼンテーションはUIを司り、ロジックやシミュレーションを参照し、UIを更新する。</p><h4>MonoBehaviour</h4><p>上記の全てをラップして、それぞれのC#クラスのインスタンス生成や、UpdateなどのUnityイベントでの発火を行ったりする。</p><h4>その他</h4><p>講演での例では、GameとGameLogicというクラスが、BallなどのMonoBehaviourクラスについての全体的な調整を行っている。</p><p>よって、BallなどのMonoBehaviourクラスは、自身についての上記5種類のクラスしか知らず、他のPaddleなどのMonoBehaviourクラスについては知らない構造となっている。</p><h3>2つの設計の対照性について</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*I9yxeEiKkwnlH-ieTCMT7A.png" /></figure><p>上記2つの講演では、MonoBehaviourを多用し、Unityエディターに何が起こっているか把握させるか、MonoBehaviourを使わないC#クラスを使い、積極的にUnity外に実装を出していくかで対象的である。2つの考え方のメリットを確認する。</p><h4>MonoBehaviourクラス多用のメリット</h4><p>エディター上で様々な作業を完結させることができる。よって、デザイナーなどに優しい実装が可能だ。さらに実行時の値の変更などシーン上の様々な変更を可視化することができる。</p><p>コンポーネント指向の実装もゲームオブジェクトに追加していくだけなので、スクリプト上で行うよりも楽に表現できる。</p><h4>MonoBehaviourを使わないC#クラス多用のメリット</h4><p>MonoBehaviourに制限されないため、より幅広いC#の機能や、.Netの機能を使用することが可能だ。さらにUnityへの依存度を下げることで、他のライブラリへの移植も容易になる。</p><p>また、スクリプトから実装が追いやすく、プログラマとしては開発しやすい。例えば、どのScriptable Objectがどこの参照に入っているのかをエディター上で追うのはなかなか骨が折れる。さらに、定数か変数かなどもエディター上より表現しやすい。</p><h3>まとめ</h3><p>Unityエディターの使用方法が対照的な2つのゲーム設計を見てきた。チームの特性に合わせた設計方針を採用するとメリットを享受できると考える。</p><h3>採用のお願い</h3><p>私の所属するカディンチェ株式会社では、積極的にUnityエンジニア、画像処理系エンジニア等の採用を行っております。募集については、コーポレートサイトのリクルートからご確認いただけます。</p><p>また、VRメタバースアプリを始めとするVR/ARアプリの開発を行っていますので、お問い合わせはお気軽にどうぞ。</p><p><a href="https://www.kadinche.com/">Kadinche Corporation: VR AR MR Deep Learning</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59d76eac2a10" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/unity%E3%82%B2%E3%83%BC%E3%83%A0%E8%A8%AD%E8%A8%88%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE-2%E3%81%A4%E3%81%AE%E8%80%83%E3%81%88%E6%96%B9-59d76eac2a10">Unityゲーム設計についての、2つの考え方</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure Kinect DK の開発環境構築から KinectFusion のサンプルを動かすまで]]></title>
            <link>https://medium.com/kadinche-engineering/azure-kinect-dk-%E3%81%AE%E9%96%8B%E7%99%BA%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89%E3%81%8B%E3%82%89-kinectfusion-%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%92%E5%8B%95%E3%81%8B%E3%81%99%E3%81%BE%E3%81%A7-cd7d550994fe?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/cd7d550994fe</guid>
            <category><![CDATA[virtual-reality]]></category>
            <category><![CDATA[mesh]]></category>
            <category><![CDATA[kinect]]></category>
            <category><![CDATA[point-cloud]]></category>
            <dc:creator><![CDATA[Nikaera]]></dc:creator>
            <pubDate>Fri, 08 May 2020 10:49:34 GMT</pubDate>
            <atom:updated>2020-05-14T08:12:33.876Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*do8bWHlOTxFc_mj7IDkzww.png" /><figcaption>KinectFusion サンプルの動作確認中の人 👤</figcaption></figure><h3>はじめに</h3><p>Kadinche では以前から <a href="https://www.kadinche.com/service/depth-livestreaming/">デプスセンサを活用した開発</a> に取り組んでおり、最近開発用のデプスセンサとして Azure Kinect DK を調達しました 💪</p><p>開発環境のセットアップがてら Microsoft 社が GitHub で公開している <a href="https://github.com/microsoft/Azure-Kinect-Samples/tree/master/opencv-kinfu-samples">KinectFusion のサンプル</a> を動かしてみたので、手順について記事として残しておきます 📝</p><h3>動作環境</h3><ul><li>Windows 10 Pro (1903)</li><li>Visual Studio 2019 (16.5.4)</li><li>Azure Kinect DK (1.6.108079014)</li><li>Azure Kinect SDK 1.4.0</li><li>CMake 3.17.2</li><li>OpenCV 4.1.0</li><li>OpenCV Contrib 4.1.0</li><li>VTK 8.2.0</li></ul><h3>Visual Studio 2019 のインストール</h3><p>まずは Visual Studio 2019 のインストールから進めていきます 💪</p><ol><li>公式サイトから <a href="https://visualstudio.microsoft.com/ja/downloads/">Visual Studio 2019 のインストーラ</a> をダウンロードします。今回は個人で営利目的以外で使用するためコミュニティを利用しました。詳細なライセンス条項については <a href="https://visualstudio.microsoft.com/ja/license-terms/mlt031819/">こちら</a> をご確認ください。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M9EDDknRiyovl_lGXu3MMw.png" /><figcaption>用途に応じて適切なインストーラをダウンロードする</figcaption></figure><p>2. インストーラーのダウンロードが完了したら、インストーラーを起動して、<strong><em>使用可能</em></strong>タブから Visual Studio 2019 のインストールボタンをクリックします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*12k-w_PDrI76GQvjUAQkmw.png" /><figcaption>使用可能タブをクリックして Visual Studio 2019 のインストールボタンをクリックする</figcaption></figure><p>3. インストールボタンをクリックすると、ワークロードの追加画面に遷移するので、開発に必要なものを追加します。今回は C++ のプロジェクトを動かすため <strong><em>C++によるデスクトップ開発 </em></strong>を追加します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3kZ4P-mhdf_0qjFR3xzsA.png" /><figcaption>画像のオプションにチェックが入ってることを確認次第、インストールボタンをクリックする</figcaption></figure><p>ワークロードを含む全てのインストールが無事完了したら次に進みます 🏃</p><h3>Azure Kinect DK のセットアップ</h3><p>次に Azure Kinect DK のセットアップを進めていきます 📝</p><p>1. 公式サイトで <a href="https://docs.microsoft.com/ja-jp/azure/Kinect-dk/sensor-sdk-download">Azure Kinect SDK のインストーラ</a> をダウンロードします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*feqJG-w9auMUQNetxikUPg.png" /></figure><p>2. インストーラーのダウンロードが完了したら、インストーラーを起動して、手順に従って PC に Azure Kinect SDK をインストールします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*uedkytYlI70oSbld7eOMMg.png" /><figcaption>インストーラを起動したらダイアログの手順に従い SDK をインストールする</figcaption></figure><p>3. インストールが完了したら <strong>C:\Program Files\Azure Kinect SDK v1.4.0 </strong>に Azure Kinect SDK のフォルダが存在することを確認します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9AohX2woE6KsLls93Oudg.png" /><figcaption>今回はバージョン 1.4.0 をインストールしたので Azure Kinect SDK v1.4.0 フォルダが生成されている</figcaption></figure><p>4. Azure Kinect DK の<a href="https://docs.microsoft.com/ja-jp/azure/Kinect-dk/update-device-firmware#update-device-firmware">ファームウェアのアップデート</a>を行うため、<strong>PC に Azure Kinect DK を接続してから、</strong>Windows PowerShell を起動して下記のコマンドを実行します。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/26b3768c464ada19639a9d35e7ed2333/href">https://medium.com/media/26b3768c464ada19639a9d35e7ed2333/href</a></iframe><p>5. ファームウェアのアップデートが完了したら、<a href="https://docs.microsoft.com/ja-jp/azure/Kinect-dk/azure-kinect-viewer">Azure Kinect Viewer</a> で正常に Azure Kinect DK が動作しているか確認してみます。<br>Azure Kinect Viewer は <strong>C:\Program Files\Azure Kinect SDK v1.4.0\tools\k4aviewer.exe </strong>に存在します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tGiuBSE-fK3xF-cKr5DfHg.png" /><figcaption>1. エクスプローラーから C:\Program Files\Azure Kinect SDK v1.4.0\tools 内の k4aviewer を開く</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOK0qAJx9hpbuR1eHTnXBg.png" /><figcaption>2. 左上に表示される <strong>Open Device</strong> ボタンをクリックし、左下に表示される <strong>Start</strong> ボタンをクリックして動作確認する。</figcaption></figure><h3>KinectFusion のサンプルの環境構築</h3><p>KinectFusion のサンプルを動かすためには <a href="https://github.com/microsoft/Azure-Kinect-Samples/blob/master/opencv-kinfu-samples/README.md">GitHub の README</a> に記載がある通り、下記のライブラリが必要になります 🔽</p><ul><li>VTK 8.2.0</li><li>OpenCV 4.1.0</li><li>OpenCV Contrib 4.1.0</li></ul><h4>CMake のインストール</h4><p>まずはビルドツールである CMake のインストールから行います🔨</p><ol><li><a href="https://cmake.org/download/">公式サイトのダウンロードページ</a> から<a href="https://github.com/Kitware/CMake/releases/download/v3.17.2/cmake-3.17.2-win64-x64.msi">インストーラー</a>をダウンロードします。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HcjeIH20QkEkfnVXnZvdrA.png" /></figure><p>2. インストーラーのダウンロードが完了したら、インストーラーを起動して、手順に従って PC に CMake をインストールします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*fJKeuRT5h4Pyzy11da7HXQ.png" /><figcaption>インストーラーを起動したら後はダイアログの手順に従い CMake をインストールする</figcaption></figure><h4>VTK をビルドする</h4><p>まずは VTK のビルドから開始していきます✋</p><ol><li><a href="https://vtk.org/download/">公式サイトのダウンロードページ</a> から <a href="https://www.vtk.org/files/release/8.2/VTK-8.2.0.zip">VTK 8.2.0</a> のソースコードをダウンロードします。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xmkf8gj-jSP_LZtNGImT9A.png" /><figcaption>ページをスクロールして 8.2.0 のソースコードをリンクからダウンロードする</figcaption></figure><p>2. ダウンロードしたファイルを解凍して D ドライブに展開します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jUysg23_W1IrEu48fA2hvQ.png" /><figcaption>D ドライブに VTK-8.2.0.zip を展開する</figcaption></figure><p>3. CMake を起動して、<em>Where is the source code</em> の項目には <strong>D:/VTK-8.2.0/VTK-8.2.0 </strong>を、<em>Where to build the binaries</em> の項目には <strong>D:/VTK-8.2.0/build </strong>を入力します。入力が完了次第、<strong><em>Configure</em></strong><em> </em>ボタンをクリックします。<br>※D:/VTK-8.2.0/build フォルダについては、あらかじめ作成しておく必要があります。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hmvQSYE8MvSBWbseY_t1qg.png" /><figcaption>1. D:/VTK-8.2.0 に build フォルダを作成する</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*qKW0It_xZznzUg_vUGp-JQ.png" /><figcaption>2. CMake を起動して必要な情報を入力して Configure ボタンをクリックする</figcaption></figure><p>4. ダイアログが表示されるので <em>Specify the generator for this project </em>には <strong>Visual Studio 16 2019</strong> を設定し、<em>Optional platform for generator </em>には <strong>x64</strong><em> </em>と入力し、<strong><em>Finish</em></strong><em> </em>ボタンをクリックして、Configure を実行します。</p><p>5. CMake の 4項目に値を明示的に指定してから <strong><em>Generate</em></strong> ボタンをクリックします。</p><ul><li>CMAKE_CONFIGURATION_TYPES (ビルドタイプの指定): Release のみ</li><li>CMAKE_CXX_MP_FLAG (並列コンパイルの有効化): チェックを入れる</li><li>CMAKE_CXX_MP_NUM_PROCESSORS (PC に搭載されているコア数): 4</li><li>CMAKE_INSTALL_PREFIX (ビルドの出力先): D:/VTK-8.2.0/install</li></ul><p>※ D:/VTK-8.2.0/install フォルダについては、あらかじめ作成しておく必要があります。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-pdQWhW1AwGIt0l4ocnsBA.png" /><figcaption>1. D:/VTK-8.2.0 に install フォルダを作成する</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*zGL80MlFPqlN5QBprEnvEg.png" /><figcaption>2. 各項目に適切な設定値を入力して Generate ボタンをクリックする</figcaption></figure><p>6. 無事に Generate が完了したら、<strong><em>Open Project</em></strong><em> </em>ボタンをクリックして生成されたソリューションファイルを Visual Studio 2019 で開きます。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*m4ISvujHiG8SgnJ6cU0GcA.png" /></figure><p>7. Visual Studio 2019 で無事開けたら INSTALL プロジェクトをビルドして VTK をインストールします。<br>※<strong><em>Open Project</em></strong> ボタンで無事にプロジェクトを開けなかった場合は、<br>D:/VTK-8.2.0/build/VTK.sln を直接開くと正常に開けるようです</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qzM8wuE181sJ2adwkv4qgA.png" /></figure><p>8. ビルドが正常に通っていれば、<strong>D:/VTK-8.2.0/install</strong> 内に成果物が生成されています。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5XMc6cN3u6_tyRVMaJJMQ.png" /><figcaption>事前に作成していた install フォルダ内に成果物が存在することが確認出来るはず</figcaption></figure><h4>OpenCV + OpenCV Contrib をビルドする</h4><p>次に OpenCV + OpenCV Contrib をビルドします。</p><ol><li><a href="https://opencv.org/releases">公式サイトのダウンロードページ</a>から <a href="https://github.com/opencv/opencv/archive/4.1.0.zip">OpenCV 4.1.0</a> のソースコードをダウンロードします。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kt8TZ7x2727EIwNFcGHS8w.png" /><figcaption>ページ送りして 4.1.0 の項目を見つけたら Sources ボタンをクリックする</figcaption></figure><p>2.<a href="https://github.com/opencv/opencv_contrib/releases/tag/4.1.0"> GitHub のリリースページ</a> から <a href="https://github.com/opencv/opencv_contrib/archive/4.1.0.zip">OpenCV Contrib 4.1.0</a> のソースコードをダウンロードします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXr2aivyNLWoVeVGfW6bcw.png" /></figure><p>3. ダウンロードしたファイル群を解凍して D ドライブに展開します。</p><ul><li>OpenCV 4.1.0 の展開先: D:\opencv-4.1.0\opencv-4.1.0</li><li>OpenCV Contrib 4.1.0 の展開先: D:\opencv_contrib-4.1.0\opencv_contrib-4.1.0</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2unF-GjnGUNNEtVuw2IuAQ.png" /><figcaption>OpenCV 4.1.0 が D ドライブに展開されている様子</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hL35s3zlyLbOmGileWYig.png" /><figcaption>OpenCV Contrib 4.1.0 が D ドライブに展開されている様子</figcaption></figure><p>4. CMake を起動して、<em>Where is the source code</em> の項目には <strong>D:/opencv-4.1.0/opencv-4.1.0 </strong>を、<em>Where to build the binaries</em> の項目には <strong>D:/opencv-4.1.0/build </strong>を入力します。入力が完了次第、<em>Configure </em>ボタンをクリックます。<br>※D:/opencv-4.1.0/build フォルダについては、あらかじめ作成しておく必要があります</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*Yo-K7q9avvAXsCqL-Kg7xA.png" /></figure><p>5. ダイアログが表示されるので <em>Specify the generator for this project </em>には <strong>Visual Studio 16 2019</strong> を設定し、<em>Optional platform for generator </em>には <strong>x64</strong><em> </em>と入力し、<em>Finish </em>ボタンをクリックして、Configure を実行します。</p><p>6. CMake の 6項目に値を明示的に指定してから <em>Generate</em> ボタンをクリックします。</p><ul><li>CMAKE_CONFIGURATION_TYPES (ビルドタイプの指定): Release のみ</li><li>CMAKE_INSTALL_PREFIX (ビルドの出力先): D:/opencv-4.1.0/install</li><li>OPENCV_ENABLE_NONFREE (著作権で保護された機能の有効化): チェックを入れる</li><li>OPENCV_EXTRA_MODULES_PATH (OpenCV Contrib モジュールへのパス): D:/opencv_contrib-4.1.0/opencv_contrib-4.1.0/modules</li><li>WITH_VTK (opencv_viz モジュールを作成するか): チェックを入れる</li><li>VTK_DIR (VTK 8.2.0 モジュールへのパス): D:/VTK-8.2.0/install/lib/cmake/vtk-8.2</li></ul><p>※D:/opencv-4.1.0/install フォルダについては、あらかじめ作成しておく必要があります</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*j7rNaYJj21HWrPgF6YD51w.png" /></figure><p>7. 無事に Generate が完了したら、<strong><em>Open Project</em></strong><em> </em>ボタンをクリックして生成されたソリューションファイルを Visual Studio 2019 で開きます。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*vR6XrLsy01Uc6gO1eL1P-w.png" /></figure><p>8. Visual Studio 2019 で無事開けたら INSTALL プロジェクトをビルドして OpenCVをインストールします。<br>※<strong><em>Open Project</em></strong> ボタンで無事にプロジェクトを開けなかった場合は、<br>D:/opencv-4.1.0/build/OpenCV.sln を直接開くと正常に開けるようです</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RE7a8Tx2KzOS8Fnz5VLu5Q.png" /></figure><p>9. ビルドが正常に通っていれば、<strong>D:/opencv-4.1.0/install </strong>内に成果物が生成されています。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*07IVu70WxCwwSaa6go8Z0g.png" /><figcaption>事前に作成していた install フォルダ内に成果物が存在することが確認出来るはず</figcaption></figure><h4>KinectFusion のサンプルをビルドする</h4><p>ここまで来たら KinectFusion のサンプルをダウンロードして動かすのに必要ないくつかの作業を行いビルドすることが可能です☺️</p><ol><li>GitHub にある <a href="https://github.com/microsoft/Azure-Kinect-Samples">Azure-Kinect-Samples</a> リポジトリをクローン or ダウンロードします。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rtPB9PkDck5e1MHaAM2olA.png" /></figure><p>2. ダウンロードしたファイルを展開して、展開先のフォルダに存在する opencv-kinfu-samples フォルダ内に必要なフォルダをコピペします。</p><ul><li>D:\opencv-4.1.0\install\include を<br>opencv-kinfu-samples\extern\opencv-4.1.0\include へコピペします</li><li>D:\opencv_contrib-4.1.0\opencv_contrib-4.1.0\modules\rgbd\include を<br>opencv-kinfu-samples\extern\opencv_contrib-4.1.0\modules\rgbd\include へコピペします</li><li>D:\opencv_contrib-4.1.0\opencv_contrib-4.1.0\modules\viz\include を<br>opencv-kinfu-samples\extern\opencv_contrib-4.1.0\modules\viz\include へコピペします</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wbnu9DCxY6GM7ZHup_qDBw.png" /><figcaption>opencv-kinfu-samples\extern フォルダに必要な include フォルダ群をコピペする</figcaption></figure><p>3. opencv-kinfu-samples フォルダ内に <strong>extern\lib\Release</strong> フォルダを作成して、ビルドに必要なファイルをコピペします。</p><ul><li>opencv_calib3d410.lib</li><li>opencv_core410.lib</li><li>opencv_highgui410.lib</li><li>opencv_imgproc410.lib</li><li>opencv_rgbd410.lib</li><li>opencv_viz410.lib</li></ul><p>※上記 6つの lib ファイルは D:\opencv-4.1.0\install\x64\vc16\lib フォルダ内に全て存在する</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DZhvdYeMsya7aKHCaTY8aw.png" /><figcaption>D:\opencv-4.1.0\install\x64\vc16\lib フォルダ内からビルドに必要なファイル群をコピーして、opencv-kinfu-samples\extern\lib\Release フォルダに貼り付ける</figcaption></figure><p>4. opencv-kinfu-samples フォルダ内の kinfu_example.vcxproj ファイルを下記で上書きします。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa5137c4f3bcd1e42845463adde46654/href">https://medium.com/media/aa5137c4f3bcd1e42845463adde46654/href</a></iframe><p>5. opencv-kinfu-samples フォルダ内の kinfu_example.sln<em> </em>ファイルを Visual Studio 2019 で開き、main.cpp ファイルを下記で上書きします。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2e3bbf90a963ff6df0897a889d27cc8/href">https://medium.com/media/f2e3bbf90a963ff6df0897a889d27cc8/href</a></iframe><p>6. main.cpp ファイルの上書き後、ビルドタイプを Release に変更した後、ソリューションをビルドして kinfu_example の実行ファイルを生成します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gD2LeVdDoIgr1kOOtSRhZA.png" /></figure><p>7. 正常にビルドが完了していれば、<strong>opencv-kinfu-samples\x64\Release</strong><em> </em>フォルダ内に kinfu_example.exe ファイルが生成されていることが確認出来るはずです。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lgE2h7PpyDIC7lJxDHy0MQ.png" /><figcaption><em>opencv-kinfu-samples\x64\Release </em>フォルダ内に kinfu_example.exe ファイルが生成されている</figcaption></figure><p>8. <strong>opencv-kinfu-samples\x64\Release</strong><em> </em>フォルダ内にコマンド実行時に必要になる dll ファイルをコピペします。</p><ul><li>D:\opencv-4.1.0\install\x64\vc16\bin フォルダ内にある全ての dll ファイル</li><li>D:\VTK-8.2.0\install\bin フォルダ内にある全ての dll ファイル</li></ul><p>※本来は必要な dll ファイルだけをコピペすれば良いのですが、<br>選択する手間を省くため全ての dll ファイルをコピペすることにしました</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oh_KA9T4Ys38FR2e5LTAsw.png" /><figcaption>OpenCV 及び VTK の全ての dll ファイルを<em>opencv-kinfu-samples\x64\Release </em>フォルダ内にコピペする</figcaption></figure><p>9. <strong>PC に Azure Kinect DK を接続してから、</strong>Windows PowerShell を起動して下記のコマンドを実行します。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd13cd7176bf75e2b173eca579243717/href">https://medium.com/media/cd13cd7176bf75e2b173eca579243717/href</a></iframe><blockquote>コマンド実行時に OpenCL error CL_OUT_OF_RESOURCES (-5) during call: clEnqueueNDRangeKernel(‘fillPtsNrm’, dims=3, globalsize=512x512x512, localsize=8x8x16) sync=trueというエラーが発生したら main.cpp 456行目の setUseOptimized(true); を setUseOptimized(false); にして再度ビルド実行してみてください</blockquote><p>10. 実行した結果、下記のようなウィンドウが開けば無事にコマンド実行出来ています 🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*YHrF3cUcXABK9umINABxlg.png" /><figcaption>Azure Kinect DK で取得した点群が KinectFusion によりメッシュ化されている様子が確認できる</figcaption></figure><h3>おわりに</h3><p>お疲れ様でした 🏝 今回は Azure Kinect DK のセットアップがてら Microsoft 社が公開している KinectFusion のサンプルを動かしてみました 👍もし実際の挙動を確認してみたいという方がいれば是非お試しください！ 🙌</p><p>KinectFusion で点群をもとに複雑な形状が綺麗にメッシュ化されていく様子は見ていて楽しいです✨</p><h3>参考リンク</h3><ul><li><a href="https://docs.microsoft.com/ja-jp/azure/Kinect-dk/sensor-sdk-download">Azure Kinect Sensor SDK download</a></li><li><a href="https://github.com/microsoft/Azure-Kinect-Samples/tree/master/opencv-kinfu-samples">Azure Kinect — OpenCV KinectFusion Sample</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd7d550994fe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/azure-kinect-dk-%E3%81%AE%E9%96%8B%E7%99%BA%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89%E3%81%8B%E3%82%89-kinectfusion-%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%92%E5%8B%95%E3%81%8B%E3%81%99%E3%81%BE%E3%81%A7-cd7d550994fe">Azure Kinect DK の開発環境構築から KinectFusion のサンプルを動かすまで</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[フォトグラメトリによる動物舎3Dモデル制作]]></title>
            <link>https://medium.com/kadinche-engineering/%E3%83%95%E3%82%A9%E3%83%88%E3%82%B0%E3%83%A9%E3%83%A1%E3%83%88%E3%83%AA%E3%81%AB%E3%82%88%E3%82%8B%E5%8B%95%E7%89%A9%E8%88%8E3d%E3%83%A2%E3%83%87%E3%83%AB%E5%88%B6%E4%BD%9C-5741de54feb3?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/5741de54feb3</guid>
            <category><![CDATA[reality-capture]]></category>
            <category><![CDATA[virtual-reality]]></category>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[blender]]></category>
            <category><![CDATA[photogrammetry]]></category>
            <dc:creator><![CDATA[kalin go]]></dc:creator>
            <pubDate>Wed, 22 Apr 2020 07:52:02 GMT</pubDate>
            <atom:updated>2020-04-22T07:52:02.601Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJTwv5EfVPbEhrx18_iJ2g.png" /><figcaption>動物舎3DモデルをUnityに取込みVRコンテンツに利用</figcaption></figure><p>フォトグラメトリは、適切な対象物や場所の選別、撮影条件、ソフトウェア処理性能、モデルデータの軽量化などの点で制約条件が多いものの、実在する建物や空間の3Dモデル制作に有用な手法です。ゲーム業界、建築業界をはじめ、歴史的建造物、考古学的な現物資料の3Dモデルアーカイブで、学術・教育分野での活用も注目されています。</p><p>私たちは、東山動植物公園（愛知県名古屋市.日本）撮影許可のもと、一般通路からの手持ちカメラによる写真撮影を行い、フォトグラメトリで動物舎の3Dモデルを制作しました。</p><p>この記事では各工程の概要を記載します。動物園のような広い範囲を対象とするフォトグラメトリは初めてで、つまずきも多くありましたので、気づいた点などご紹介します。（もっといい方法あるよ～とか、とても嬉しいです）</p><p>なお、本記事の成果物は名古屋大学 工学部/工学研究科 河口研究室様にご発注頂き、名古屋市東山動植物園様の園内を撮影させて頂いたものです。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsketchfab.com%2Fmodels%2F4efaf7f8e32243dca2ecd144146a0f0d%2Fembed&amp;display_name=Sketchfab&amp;url=https%3A%2F%2Fsketchfab.com%2F3d-models%2Fpolar-bears-house-4efaf7f8e32243dca2ecd144146a0f0d&amp;image=https%3A%2F%2Fmedia.sketchfab.com%2Fmodels%2F4efaf7f8e32243dca2ecd144146a0f0d%2Fthumbnails%2F79b86458356c401ca3e7f02043ccc59f%2Fa80e4b544ff14c81a4a0d6a9b08bd165.jpeg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=sketchfab" width="640" height="360" frameborder="0" scrolling="no"><a href="https://medium.com/media/a3d935cd63ff734136d000e5bcdcdc4d/href">https://medium.com/media/a3d935cd63ff734136d000e5bcdcdc4d/href</a></iframe><p>今回は動物舎3DモデルをUnityに取込みVRコンテンツに利用する目的でしたので、『1つのfbxは10万ポリゴン未満にする』『テクスチャは4K×4枚のjpgにしてデータサイズを抑える』この2点をルールにモデル制作を進めました。（品質の低下を最小限に抑えながらデータサイズを最小限に抑えることは重要です。『10万ポリゴン未満』にはまだまだ改善の余地があります。）</p><p>主な制作フローは、1. 撮影、2. フォトグラメトリソフトでの処理、3. モデル修正です。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4B8hoB_8o7XPoGbn" /><figcaption>フォトグラメトリによる3Dモデル制作フロー</figcaption></figure><p>１．撮影</p><p>フォトグラメトリの撮影は、3Dモデルで見せたいところは全部撮る必要があり、対象をなるべく360度ぐるっと一周するような形で複数の角度から写真を撮ります。ディテールを出したい部分については、遠め、中間、近めと徐々に寄っていく撮り方をします。また上空からの写真も撮影できると好ましいです。</p><p>今回は動物にストレスをかけないよう、一般の来園者通路から動物舎の周囲を撮影し、 ドローンや一脚等を使う高い位置からの撮影は行いませんでした。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v7nOjaTOYnw9GohSjr9iVg.jpeg" /><figcaption>通路からアシカプールの周囲を撮影</figcaption></figure><p>撮影時に気を付けている点は、</p><p>・パンフォーカスでボケる部分がないようにする（ぼけはエラーの原因）</p><p>・かげや動くものが入らないようにする</p><p>・全体がわかるような遠景を撮る</p><p>・隣り合う写真は60～80％が被るよう意識しつつも撮りすぎない（多ければ多いほど良きが基本っぽいです。今回は諸々のデータ容量を考慮してなるべく枚数少なく撮影するようにチャレンジしました）</p><p>・アライメントが繋がるように撮る</p><p>です。</p><p>龍 lileaさんの記事を参考にしております：<a href="https://www.excite.co.jp/news/article/MoguraVR_photogrammetry-digital-archive-1/">フォトグラメトリで「銭洗弁天VR」が出来るまで（第1回：撮影編）</a></p><p>動物舎の撮影は2つの機材・セッティングで撮影しました。撮影日の状況や機材設定は以下の通りです。</p><p>天候：曇り時々晴れ</p><p>撮影時間：1月の10時半～16時半（冬なので15時頃から夕陽射す）</p><p>撮影機材・設定：</p><p>カメラ① Canon EOS 5D、焦点距離24㎜、F値 9～11</p><p>カメラ② Sony α7R IV、16㎜～20㎜、 F値 9～13</p><p>（一部レンズを変更し50㎜、70㎜も使用）</p><p>撮影枚数は動物舎の広さや構造によりばらつきました。ほぼ目線高さからの撮影のみなので撮影枚数は少ないのですが、例えばゴリラ・チンパンジー舎は1,481枚、アジアゾウ舎は575枚、ホッキョクグマ舎は344枚、インドサイ舎は108枚撮影しました。構造が複雑な動物舎は外観、内側観覧通路に分けて撮影したので1000枚超えました。</p><p>２．フォトグラメトリソフトウェア処理</p><p>フォトグラメトリソフトウェアはReality Captureを使用しました。</p><p>２．１ 前処理</p><p>撮影した写真データをそのまま使用しても問題ありませんが、フォトグラメトリソフトウェアで、より正しいカメラ位置推定、メッシュ、テクスチャ結果を得るのに、Exifタグの削除やLightRoomなどの画像処理ソフトで露出、色収差、ノイズの調整等の前処理を行うことが推奨されています。</p><p>今回は、空（そら）が多く映っているエリアの場合、色調整により空のごみポリゴンが増えたため、撮ったままのjpgを使用して進めたりもしました。</p><p>２．２ Reality Captureでモデル作成</p><p>Reality CaptureはヘルプやCommunity Q&amp;Aを見れば多くのノウハウが記載されています。＠jyouryuusuiさんの<a href="https://qiita.com/jyouryuusui/items/8a6d6ed4a8150b7dcee8">RealityCaptureクイックスタートで始めるフォトグラメトリ</a>は、Reality Captureヘルプウィンドウの日本語説明をされており参考になります。基本的な手順は、写真を読み込み、Workflowに沿って処理をします。</p><p>『1つのfbxは10万ポリゴン未満にする』『テクスチャは4K×4枚のjpgにしてデータサイズを抑える』の2点をルールに、トライ&amp;エラーを繰り返し最終的に以下の手順で進めました。</p><p>①アライメント、コンポーネント作成：複数に分かれる場合はマージやControl pointsを使い、良さそうなコンポーネントにする。 最初からコンポーネントが分かれると予想が付くものはアライメント作成から別プロジェクトで作成する。</p><p>②再構成領域の設定：モデル化に必要な領域に絞ることでモデル計算時間を短縮。</p><p>③モデル作成：設定値デフォルトのままNormal Detailで作成。</p><p>④ポリゴン数を減らす：Reality CaptureのFilter Selection、Simplifyツールを使用。Filter Selectionで不要なポリゴンを選択削除する。次にSimplifyツールで頂点数とポリゴン数を少しずつ減らしていく。</p><p>⑤ テクスチャ生成：概ね綺麗なモデル（3,000万ポリゴン程度）になったら、一度Smoothingツールを使い、その後テクスチャーの生成を行う。ポリゴンや頂点数が多いほどテクスチャーは詳細に作られるので、あとで更にポリゴン数を減らしたモデルにこのテクスチャーをリテクスチャリングするため。</p><p>⑥ポリゴン数10万ポリゴン未満にする。再度Smoothingツールを使ってモデルの表面を滑らかにする。⑤で作成しておいたテクスチャを、最終モデルにReTexturingツールで適用する。</p><p>⑦モデル書き出し：.objと.jpg形式で書き出す。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4UteZ8Ay_AxOLKa7yUKX5Q.png" /><figcaption>Reality Captureでのフォトグラメトリ</figcaption></figure><p>２．３ 事例アジアゾウ舎のモデル制作</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LfE42y6kv_yAIuVs" /><figcaption>アジアゾウ舎の点群データ（右奥が傾いている）</figcaption></figure><p>撮影した579枚のjpgファイルを読み込み、アライメントを作成したところ、右奥の地面の角度がずれたComponentが作成されました。右奥のComponent と それ以外のComponentをそれぞれ書き出し、 新しいプロジェクトにComponentを読み込んでアライメントを行いましたがうまくマージされなかったため、Control Pointsを追加してアライメント作成・マージ出来ました。575枚の写真のComponentに対して再構成領域を設定し、Triangle count 2億9,933万ポリゴン / Vertex count 1億5,000万点のモデルが出来たのでこれをベースにポリゴンリダクションをしました。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MuZbIPlcjAPwYBLQMvJa9A.jpeg" /><figcaption>修正後のアジアゾウ舎の点群データ</figcaption></figure><p>約3億のポリゴンを10万に減らすと丸い塊になります。これを避けるため、まずSelection Toolで、不要な領域や板ポリゴンに置き換えてもよさそうな地面などを選択し、Filter Selectionで削除しました。次にSimplify Toolを使用しました。Simplify Toolは、3種類の方法が用意されており、①指定のポリゴン数未満にするabsolute、②元のポリゴン数の指定パーセンテージ未満にするrelative、③absoluteとrelativeの両方法で最大値を結果にするMaximum of absolute and relativeがあります。Simplify ツールは選択範囲のみに処理することもできるので、ディテールを残したい部分を残すこともできます。はじめの生成ポリゴン数が大きい場合は、複数回に分けてSimplifyして最終的に10万ポリゴン未満にしていく方が仕上がりが綺麗でした。</p><p>また、アジアゾウ舎全体で10万ポリゴン未満にすると、どうしてもモデルが荒くなってしまうので、最終的に7分割してからポリゴンを減らしました。（もっといい切り方があると思うのですが）再構成領域の設定で7回エリアを切り出すというという分割方法をとりました。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XS72_0XNjsgY51De" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CPrjoz5ncQ8BkiT1" /><figcaption>エリアを7分割して処理</figcaption></figure><p>3．モデル修正</p><p>Blender 2.8を使用しました。Blenderでは、Reality Captureでは削除しにくかった不要なポリゴンを削除し、歪曲してしまっている部分の修正などを行います。最後に.fbx形式で書き出します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*dnu3YGIjWNgs4UI-eXjMpg.png" /><figcaption>Blenderでのモデル修正</figcaption></figure><p>ポリゴン数の削除をBlenderで行い、その後Reality Captureに戻して再度テクスチャ生成することも可能です。注意が必要なのは、Reality Captureでは三角ポリゴンに揃える事、ファイル（.obj.rcinfo）に保持されるポリゴンIDとの整合性が取れないものはobjファイル自体が読み込みエラーになる点です。（マージや分割するとReality Captureに戻せないっぽい）</p><p>以上でフォトグラメトリによる動物舎3Dモデル制作フローの紹介は終わりです。</p><p>引続きフォトグラメトリのトライ&amp;エラーで制作効率ノウハウを積んでいき記載していきます。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5741de54feb3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/%E3%83%95%E3%82%A9%E3%83%88%E3%82%B0%E3%83%A9%E3%83%A1%E3%83%88%E3%83%AA%E3%81%AB%E3%82%88%E3%82%8B%E5%8B%95%E7%89%A9%E8%88%8E3d%E3%83%A2%E3%83%87%E3%83%AB%E5%88%B6%E4%BD%9C-5741de54feb3">フォトグラメトリによる動物舎3Dモデル制作</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HoloLens 2 の環境構築をして実機で動かす]]></title>
            <link>https://medium.com/kadinche-engineering/hololens-2-%E3%81%AE%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89%E3%82%92%E3%81%97%E3%81%A6%E5%AE%9F%E6%A9%9F%E3%81%A7%E5%8B%95%E3%81%8B%E3%81%99-7a15bfe5e088?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/7a15bfe5e088</guid>
            <category><![CDATA[hololens]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[hololens-2]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[mixed-reality]]></category>
            <dc:creator><![CDATA[Motoki]]></dc:creator>
            <pubDate>Wed, 08 Apr 2020 09:45:40 GMT</pubDate>
            <atom:updated>2020-04-08T09:45:40.414Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PuoN44jdz_7yzFOhoRozeA.jpeg" /><figcaption>HoloLens 2 開封時の様子</figcaption></figure><p>今回は HoloLens 2 を使って新規に Unity で開発を行う際の環境構築とテストシーンのビルドまでを行いたいと思います。</p><p>Microsoft が推奨している <a href="https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/GettingStartedWithTheMRTK.html">MRTK (MixedReality ToolKit) </a>を使用させていただきました。<br>これは MR デバイスで行うことのできる操作をまとめたパッケージです。MR デバイスだけでなく、OpenVR ヘッドセットの開発にも使用することができます。</p><h3>動作環境</h3><ul><li>Unity 2018.4.x , <strong>2019.2.x </strong>以降<br>モジュール：UWP モジュール</li><li>Visual Studio 2019（16.2）以降<br>ワークロード：C++によるデスクトップ開発、ユニバーサル Windows プラットフォーム (UWP) の開発</li><li>Windows 10 SDK 10.0.18362.0 以降</li></ul><p>今回は、以下の環境でビルドを行いました。</p><ul><li>Unity 2019.2.21f1</li><li>Visual Studio 2019 (16.5.2)</li></ul><p>さっそく環境構築に移っていこうと思います。</p><h3>デバイスを開発者モードにする</h3><p>HoloLens 2の開発には、Windows、HoloLens 2 ともに開発者モードである必要があります。</p><p><strong>Windows</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OC1nUnu0qWIlD_FNY5LeSA.png" /></figure><ol><li>「設定」から「更新とセキュリティ」を選び、開発者向けの機能を使う選択肢から「開発者モード」を選択します。</li><li>オンにするか聞かれるので「はい」を選ぶと、開発者モード用のパッケージがダウンロードされ、開発者モードになります。</li></ol><p><strong>HoloLens 2</strong></p><ol><li>HoloLens 2 にも同様のアプリがあり、「設定」から「更新とセキュリティ」を選び、開発者向けの機能を使う選択肢から「開発者モード」を選択します。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OBGMx-1o02qvBIJLCgOnGw.jpeg" /></figure><p>2. こちらもオンにするか聞かれるので、「はい」を選択すると、開発者モードになります。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9PWlYlbLmSyyoH_PyKiRsg.jpeg" /></figure><h3>Unityの環境構築</h3><p>Unity で HoloLens 2 の開発を行うための環境を整えます。</p><ol><li>UWP モジュールを追加した Unity でプロジェクトを作成します。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QzqFnIXwgEb3l4zxtX6Cjw.png" /><figcaption>適当なプロジェクト名を付けて作成</figcaption></figure><p>UWP モジュールが入っていない場合は追加します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srrAAvWTZym18kZZQr5_Hw.png" /><figcaption>モジュールを加える</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*0XEvGKm97Y2ekOM4HobTJA.png" /><figcaption>Universal Windows Platform Build Support を選択して実行</figcaption></figure><p>2. プロジェクトが立ち上がったら、File → BuildSettings で TargetPlatform を UWP に SwitchPlatformします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*yTIQqthAEjpQzltklEN9OA.png" /><figcaption>Universal Windows Platform に Unity のロゴがついていることを確認する</figcaption></figure><p>3. ウインドウ左下の PlayerSettings を開き、XR Settings でVirtual Reality Support を有効にし、SDK に WindowsMixedReality を設定します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8DFtOz4WMWxgCLHT7Uu5ag.png" /><figcaption>Virtual Reality SDKs 右下の＋を押して、SDKを追加する。</figcaption></figure><p>4. MRTK では TMP が使われているシーンがあるため、Window → TextMeshPro → Import TMP Essential Resources よりインポートしておく。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*2QMI-NSGcjYgW4cBf8sjbg.png" /></figure><p>5. <a href="https://github.com/Microsoft/MixedRealityToolkit-Unity/releases">MRTK のリリースページ</a>より、「Microsoft.MixedReality.Toolkit.Unity.Foundation.2.3.0.unitypackage」をダウンロードします。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*O_gb1dQKXGvMNdJqkI7XZw.png" /></figure><p>ダウンロードしたパッケージを読み込みます。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*J27ZX6eWix5GE101on_uOQ.png" /></figure><p>6. MRTK の設定を出す。Config MRTK の設定を適用する。</p><p>このとき、<a href="https://docs.microsoft.com/ja-jp/windows/mixed-reality/mrlearning-base-ch1#configure-the-unity-project-for-the-mixed-reality-toolkit">MSBuild for Unity のチェックは一度外します。</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*kFgaTBhI5mrBr4XYXV0TJg.png" /></figure><p>7. 新しいシーンを作成して、MixedRealityToolKit タブから、”Add to Scene and Configuration” を押します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*hNb_S5JyRHW-3AuiRLWjuQ.png" /></figure><p>8. Hierarchy ウインドウで Create → 3DObject → Cube を生成し、Inspector から position を（0,0,1）に設定します。</p><p>Ctrl + Shift + S で任意の場所にシーンを保存します。</p><p>9. Hierarchy ウインドウにある MixedRealityToolKit を選択し、Inspector ウインドウの MixedRealityToolKit(Script) の、「DefaultHololens2ConfigurationProfile」にプロファイルを変更します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9IsdPibHGyE0tzBw3IpSg.png" /></figure><p>10. File → BuildSettings → Add Scene を行い、任意の場所に Build<br>( App というディレクトリを作成し、App 内に Build しました。)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*IB9QoZrC2AMNSUS3SoKg_g.png" /></figure><h3>Visual Studio での操作</h3><p>さて、Unity でビルドして生成された Visual Studio のプロジェクトを開き、ビルドしたものを実機で動作確認していきます。</p><p>有線でインストールを行う方法と無線でインストールを行う方法の二通りがありますが、今回は無線でインストールを行います。</p><ol><li>ビルドしたディレクトリに生成された .sln ファイルをダブルクリックして、Visual Studio を開きます。<br>この時、コンポーネントが不足していた場合、ダイアログに従って追加を行います。</li><li>構成を「Release」、アーキテクチャを「ARM」または「ARM64」、インストールターゲットデバイスのドロップダウンを開き、「プロパティ」を開きます。<br>この時、「Il2CppOutPutProject」が選択されていた場合、” [プロジェクト名] ( Universal Windows ) “ を右クリックし、スタートアッププロジェクトに設定を押します。</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O7g0d7Mujy1qPxWFZEQfOQ.png" /></figure><p>3. 「構成のプロパティ」→「デバッグ」→ コンピュータ名を Hololens 2 の IP アドレスを入力します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J1GxpEVeSaCRUD8VdHWedg.png" /></figure><p>HoloLens 2 の IP アドレスは設定アプリの「ネットワークとインターネット」→ 現在つながっているネットワークの「詳細オプション」をタップするとみることができます。<br>（<em>※この手順は有線接続を行っている場合は不要です。</em>）</p><p>入力が終わったら、適用してウインドウを閉じます。</p><p>4. 「デバッグ」→「デバッグなしで開始」でデバッグインストールが開始されます。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*6kLW_tVBMceoGb9g2x4JOA.png" /></figure><p>5. 初回のみデバイスのペアリングが必要なため、PIN の入力が必要になります。</p><p>設定アプリ → 更新とセキュリティ→ 開発者向け → デバイスのペアリング → ペアリングで PIN を生成して、 Visual Studio で求められたら入力します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dlepRgdufCTVlsO9lgu-cA.jpeg" /><figcaption>ペアリングを押すと PIN が生成される</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*O0UlDnq5cW9kEyBD-EnqEA.png" /></figure><p>6. ペアリングに成功するとアプリのインストールが続行されます。</p><p>7. インストールされたアプリを実行すると、目の前に巨大なバーチャル Cube が出現します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fbQaX5YZZInpobmH2mWipA.jpeg" /></figure><p><strong>デバイスにインストールだけ行いたい場合</strong></p><p>「ビルド」→「ソリューションのビルド」でビルドを行い、「ソリューションの配置」でインストールを行います。</p><h3>まとめ</h3><p>お疲れさまでした！<br>公式のチュートリアルがとても丁寧で、あまりつまづくことなく環境構築を行うことができました。少しでも参考になると幸いです。</p><p><strong>参考</strong></p><ul><li><a href="https://docs.microsoft.com/ja-jp/windows/mixed-reality/mrlearning-base">公式チュートリアル</a></li><li><a href="https://docs.microsoft.com/ja-jp/windows/mixed-reality/install-the-tools">インストールが必要なツール一覧</a></li><li><a href="https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/MRTK_PackageContents.html">MixedReality ToolKit</a></li><li><a href="https://docs.microsoft.com/ja-jp/windows/mixed-reality/using-visual-studio#enabling-developer-mode">開発者モードに設定するまで</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a15bfe5e088" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/hololens-2-%E3%81%AE%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89%E3%82%92%E3%81%97%E3%81%A6%E5%AE%9F%E6%A9%9F%E3%81%A7%E5%8B%95%E3%81%8B%E3%81%99-7a15bfe5e088">HoloLens 2 の環境構築をして実機で動かす</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VR/ARで使いたいUnity対応マルチプレイゲーム用BaaSを比較する]]></title>
            <link>https://medium.com/kadinche-engineering/unity%E5%AF%BE%E5%BF%9C%E3%83%9E%E3%83%AB%E3%83%81%E3%83%97%E3%83%AC%E3%82%A4%E7%94%A8baas-1c5d1861c335?source=rss----210dae76dd12---4</link>
            <guid isPermaLink="false">https://medium.com/p/1c5d1861c335</guid>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[vr]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Takashi Miwa]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 13:10:34 GMT</pubDate>
            <atom:updated>2020-04-28T07:51:44.802Z</atom:updated>
            <content:encoded><![CDATA[<h3>はじめに</h3><p>VRアプリを開発していて、マルチプレイゲーム用BaaSのざっくりとした一覧がほしいなと思ったので作成した。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vZ3E2kfcMCCvz_eBTZGVw.png" /></figure><h3>Photon</h3><p>主にインゲームで使用されるリアルタイムなデータのやり取りや、音声のやり取り（Photon Voice）が可能。また、Unity SDKも充実している。<a href="https://github.com/svermeulen/Extenject/releases">Extenject</a>との共存に最初は苦労したが、慣れれば問題ない。</p><p>価格は以下。</p><p><a href="https://www.photonengine.com/ja-JP/PUN/pricing">Photon PUN One-timeプラン価格 | Photon Engine</a></p><p>基本的には、Photon Cloudというクラウドサービスを利用する形になるが、Photon Serverというオンプレミス用のサービスもあり、カスタムも可能。VRChatはPhotonをカスタムして使っているらしい。</p><p>ちなみに最大接続数は8人位までは普通にできるよとのことだ。</p><p><a href="https://doc.photonengine.com/ja-jp/pun/v2/troubleshooting/faq#u4t07j4l2z41yo2k">What Is The Maximum Number Of Players Supported By Photon Rooms?</a></p><h3>GameSparks</h3><p>AWSが提供する統合的なゲームBaaS。Photonのようなリアルタイム通信も用意されている。</p><p><a href="https://docs.gamesparks.com/documentation/gamesparks-real-time/">GameSparks Real-Time - GameSparks Learn</a></p><p>しかし、それよりもアウトゲーム、つまりユーザー認証やアイテム管理などが充実しているし、それ用に使うことが多いだろう。</p><p>UnitySDKはあるが、2018年から更新されておらず、中身を少し書き換えないと現在のUnityバージョンでは使用できない。ただ、動作にはそれほど問題は感じなかった。</p><p>価格は以下。</p><p><a href="https://www.gamesparks.com/pricing/">Pricing |</a></p><h3>Amazon GameLift</h3><p>同じくAmazonが提供するサービス。上記のサービスと違って、基本的にはホスティングサービスとなる。つまり、サーバーサイド開発の上、このサービス上に載せれば、スケーリングなどを問題なく行ってくれる。モニタリングなども充実しているのも嬉しい。</p><p>詳しい特徴は以下。</p><p><a href="https://aws.amazon.com/jp/gamelift/features/">特徴 - Amazon GameLift | AWS</a></p><p>ゲームマッチングについてのみ、他のサービスのようにプリセットで利用できるものをFlexMatchという形で用意している。</p><p>元々別会社サービスであったGameSparksよりも、他のAWSサービスとよくインテグレートされている印象だ。</p><p>価格は以下。</p><p><a href="https://aws.amazon.com/jp/gamelift/pricing/">料金 - Amazon GameLift | AWS</a></p><h3>Microsoft Azure PlayFab</h3><p>主にはアウトゲーム用で、リアルタイムの通信はUniyt用にはサポートしていない。PubSubやPlayFab Partyがあるが、前者は2018年よりプライベートプレビューのままで、後者はC++などでUnity用のSDKがない。</p><p>ただ、頻繁に更新があり、機能も幅広い。例えば、Photonのアドオンを組み込むとユーザー認証などを行った上で、ネットワークに参加できたり、ルームイベントのフックができたりする。また、GameLiftのように自作したサーバーアプリのホスティングをすることもできる。</p><p>価格は以下。</p><p><a href="https://azure.microsoft.com/ja-jp/services/playfab/#pricing">PlayFab | Microsoft Azure</a></p><h3>Steamworks</h3><p>Steam Store出品用ではあるが、インゲームアウトゲームどちらも揃える幅広い機能を使える。ゲームで必要なバックエンドはほぼこれを使用すれば揃うように思う。さらに無料で使用できる。</p><p>機能の全体像は以下。</p><p><a href="https://partner.steamgames.com/doc/features">Features (Steamworks Documentation)</a></p><h3>Oculus Platform SDK</h3><p>今まで、Oculusのアプリを開発してきて、一度もなぜか俎上に上がらなかったSDK。ただ、インゲームアウトゲームどちらの機能も一通り揃えていて、無料である。</p><p>ボイスなどは個別のユーザーIDで直接繋ぐなど、なかなか実装すると難儀そうだなと感じる部分もある。そこはこのSDKではなく、他のソリューションを使ってくれということだろう。</p><p>機能の全体像は以下。</p><p><a href="https://developer.oculus.com/platform/?locale=ja_JP">Oculus Developer Center | Platform Development</a></p><h3>Vivox</h3><p>Unityに買収されたテキストチャットとボイスチャットを提供するサービス。PUBGでも使用されているのだから、かなりの安定度なのだろう。</p><p>少し実装した感じは、あまり問題を感じなかった。Photon Voiceと比べると空間音響にするのが若干手間がかかった。</p><p>また、SDKをダウンロードするには、デベロッパー登録が必要で、即時の返答ではないので、作業開始まで少し時間がかかる。</p><p>価格は問い合わせが必要。</p><p><a href="https://www.vivox.com/pricing">Vivox - Communication is Critical</a></p><h3>モノビット</h3><p>国産のBaaS。Photonと同種で、データのリアルタイム通信が可能である。国産のVRサービスに使用されている事例も聞いた。UDPもサポートしていて、低遅延。</p><p>Photonとの比較などを特に行っていないが、次のサービスでは少し触ってみようかなと思っている。</p><p>価格は以下。</p><p><a href="http://www.monobitengine.com/mun/#price">Monobit Unity Networking 2.0 (MUN) - モノビットエンジン公式サイト</a></p><h3>Agora.io</h3><p>ビデオチャットのバックエンドサービスなので、これはゲーム用ではないが、ゲームも用途の一例として紹介されているので、記載する。他のソリューションとの違いは、なんといってもリアルタイムなビデオチャット機能だろう。</p><p>WebRTCを使用しているので、低遅延で音声、動画のやり取りができる。UnitySDKも公開されているので、導入も問題なく行えるだろう。</p><p>価格は以下。</p><p><a href="https://www.agora.io/en/pricing/">Agora.io Pricing - Agora.io</a></p><h3>まとめ</h3><p>以上が、主なBaaSである。もっとこれ以外もあるよということがあれば、教えてほしい。また、自分でサーバーサイドの実装やホスティングを行うならば、以下のフレームワークやアセットが役立つと思うので、雑多になるが記載しておく。（インターネットが使用できないケースにも使える）</p><h3>Unityリアルタイム通信アセット</h3><p><a href="https://assetstore.unity.com/packages/tools/network/mirror-129321?locale=ja-JP">Mirror</a>はUnityのデータ通信アセットとして使用できる。</p><p><a href="https://assetstore.unity.com/packages/tools/integration/dissonance-for-mirror-networking-143290">Dissonance </a>は上記のMirrorで音声のやり取りをする際のアセット。</p><p><a href="https://github.com/Cysharp/MagicOnion/releases">MagicOnion</a>はデータのやり取りや音声のやりとりに便利。</p><h3>最後に（採用のお願い）</h3><p>私の所属するカディンチェ株式会社では、積極的にUnityエンジニア、画像処理系エンジニア等の採用を行っております。募集については、コーポレートサイトのリクルートからご確認いただけます。</p><p>また、VRメタバースアプリを始めとするVR/ARアプリの開発を行っていますので、お問い合わせはお気軽にどうぞ。</p><p><a href="https://www.kadinche.com/">Kadinche Corporation: VR AR MR Deep Learning</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c5d1861c335" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kadinche-engineering/unity%E5%AF%BE%E5%BF%9C%E3%83%9E%E3%83%AB%E3%83%81%E3%83%97%E3%83%AC%E3%82%A4%E7%94%A8baas-1c5d1861c335">VR/ARで使いたいUnity対応マルチプレイゲーム用BaaSを比較する</a> was originally published in <a href="https://medium.com/kadinche-engineering">Kadinche Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>