Placeholder Image

字幕列表 影片播放

由 AI 自動生成
  • Hi XR developers, today we're going to talk about a new tool from Meta which is called the Mixed Reality Utility Kit or MRUK for short.

    嗨,XR 開發者們,今天我們要討論的是來自 Meta 的一款新工具,它被稱為混合現實實用工具包(Mixed Reality Utility Kit),簡稱 MRUK。

  • Before, when we wanted to test features like the Scene API or Anchors, we always had to build an APK and test it on our device.

    以前,當我們想測試場景 API 或主播等功能時,總是需要製作 APK 並在自己的設備上進行測試。

  • MRUK now allows us to directly test everything in the editor when we use the Quest link.

    現在,當我們使用 Quest 鏈接時,MRUK 允許我們直接測試編輯器中的所有內容。

  • It even comes with room prefabs which allows us to test different rooms to better fit our application to different room sizes of our users.

    它甚至配備了房間預製板,讓我們可以測試不同的房間,使我們的應用程序更好地適應用戶不同的房間大小。

  • Trust me, this is a really great tool to develop mixed reality experience and I hope you're as excited as I am.

    相信我,這是開發混合現實體驗的絕佳工具,希望你和我一樣興奮。

  • If you like this type of videos and they are helpful to you, please take a second to like and subscribe to this channel.

    如果您喜歡這類視頻,而且它們對您有幫助,請花點時間點贊並訂閱本頻道。

  • It helps me a lot.

    這對我幫助很大。

  • If you'd like to get the source code of each video, please consider subscribing to my Patreon where you can find all the source codes.

    如果你想獲得每個視頻的源代碼,請考慮訂閱我的 Patreon,在那裡你可以找到所有的源代碼。

  • If you have any questions, please join our Discord community.

    如果您有任何問題,請加入我們的 Discord 社區。

  • We are a community of over 200 XR developers at this point and we are happy to help you with any questions.

    目前,我們是一個擁有 200 多名 XR 開發人員的社區,我們很樂意幫助您解決任何問題。

  • And now, let's get started with MRUK.

    現在,讓我們從 MRUK 開始。

  • To begin, let's cover the requirements for using the MRUK.

    首先,讓我們介紹一下使用 MRUK 的要求。

  • To use MRUK with Unity and MetaQuest, ensure you have Unity 2021.3.30 or newer and a Quest 2, Pro or 3 with firmware version 60 or newer.

    要將 MRUK 與 Unity 和 MetaQuest 結合使用,請確保您使用的是 Unity 2021.3.30 或更新版本,以及固件版本為 60 或更新版本的 Quest 2、Pro 或 3。

  • For PC, use Quest link but remember the passthrough image is headset only and set up your room scan before connecting.

    對於電腦,請使用 Quest 鏈接,但請記住直通影像僅限耳麥,並在連接前設置房間掃描。

  • On Mac, you will have to build and deploy an APK.

    在 Mac 上,您需要構建和部署 APK。

  • Keep in mind that you do not need an OVR Scene Manager in your scene, MRUK serves as a replacement for it.

    請記住,您不需要在場景中使用 OVR 場景管理器,MRUK 可以替代它。

  • Lastly, it is advised to familiarize yourself with Meta's Scene API first.

    最後,建議先熟悉 Meta 的場景 API。

  • With that out of the way, let's set up a new Unity project.

    說完這些,讓我們建立一個新的 Unity 項目。

  • We first want to install the meta-xr-sdk from the Package Manager.

    我們首先要從套裝軟體管理器中安裝 meta-xr-sdk。

  • You can simply install it by its name, which is com.meta.xr.sdk.all.

    您只需根據其名稱(即 com.meta.xr.sdk.all)進行安裝即可。

  • Next, we install the Mixed Reality Toolkit from our Package Manager by typing com.meta.xr.mrutilitykit.

    接下來,我們在套裝軟體管理器中輸入 com.meta.xr.mrutilitykit 安裝混合現實工具包。

  • After installing MRUK, also make sure to install the samples which we will look at in a second.

    安裝 MRUK 後,還需確保安裝樣本,我們稍後將詳細介紹。

  • Let's make sure we create a new room scan inside our MetaQuest.

    讓我們確保在 MetaQuest 中創建一個新的房間掃描。

  • The more accurate the scan, the better will be our experience later.

    掃描越準確,我們以後的體驗就越好。

  • Take your time to walk around your room and look at your surfaces from different angles.

    花點時間在房間裡轉轉,從不同角度看看你的房間表面。

  • Also, take enough time to add new anchors for your furniture and add the correct labels such as table, couch, or bed.

    此外,還要花足夠的時間為傢俱添加新的固定裝置,並添加正確的標籤,如桌子、沙發或床。

  • Now, in order to later test any of our scenes, let's set up our project with the Project Setup Tool from Meta.

    現在,為了稍後測試我們的任何場景,讓我們使用 Meta 的項目設置工具來設置我們的項目。

  • Just apply all the suggested changes, which will set up everything for us, even our XR plugin for testing the scene directly on our device.

    只需應用所有建議的更改,就能為我們設置好一切,甚至包括直接在設備上測試場景的 XR 插件。

  • Do this for both Windows and Android, and lastly, switch the platform to Android in the Build Settings, in case you want to deploy the app to your headset later.

    對 Windows 和 Android 都要這樣做,最後,在 "構建設置 "中將平臺切換為 Android,以防以後要將應用部署到耳機上。

  • We are now finally ready to test out some of the samples and examine the components and functions that come with the Utility Kit.

    現在,我們終於可以測試一些樣品,檢查實用工具包的組件和功能了。

  • Firstly, let's just look at the MRUK base scene.

    首先,讓我們來看看 MRUK 基地的情況。

  • We can see that we have a regular OVR camera rig with the Tracking Origin Mode set to Stage.

    我們可以看到,我們有一個普通的 OVR 攝影機裝備,追蹤起源模式設置為舞臺。

  • Under Quest Features, we can see that we don't need to support Spatial Anchors, Scene Understanding, and Passthrough like we normally have to if we don't use the Utility Kit.

    在 "任務功能 "下,我們可以看到,如果不使用實用工具包,就不需要像通常那樣支持 "空間錨點"、"場景理解 "和 "穿透"。

  • However, we still require an OVR Passthrough layer to actually be able to start our experience in Passthrough mode.

    不過,我們仍然需要一個 OVR 穿透層,才能真正以穿透模式啟動我們的體驗。

  • Keep in mind, however, if you would like to build your app to your Quest device, you will still need to enable the Anchors and enable the Scene Support as well as the Passthrough mode.

    但請記住,如果您想在 Quest 設備上構建應用程序,您仍然需要啟用錨點、場景支持和直通模式。

  • Let's now look at our MRUK prefab that contains the main component MRUK, which is a singleton and therefore should only exist once within our scene.

    現在讓我們看看包含主要組件 MRUK 的 MRUK prefab,它是一個單例,是以在場景中只存在一次。

  • Firstly, we have a Scene Loaded event, which lets us easily execute any public method from here once our scene has loaded.

    首先,我們有一個 "場景加載 "事件,一旦場景加載完成,我們就可以在這裡輕鬆執行任何公共方法。

  • Now, keep in mind, you don't have to use this component to reference all your methods.

    現在,請記住,你不必使用這個組件來引用你的所有方法。

  • The Utility Kit also comes with a MRUK Start component, which you can find on Effect Mesh, GameObject for example.

    實用工具包中還有一個 MRUK 啟動組件,您可以在效果網格、GameObject 中找到它。

  • This component is not different to the MRUK, but simply exists for drag and drop ease of use, so you don't have to use the event on the MRUK component to reference all your methods that you want to execute when your scene has loaded.

    該組件與 MRUK 並無不同,只是為了便於拖放使用而存在,是以您不必使用 MRUK 組件上的事件來引用您希望在場景加載後執行的所有方法。

  • Now, let's look at the main component in detail.

    現在,讓我們來詳細瞭解一下主要組件。

  • The first checkbox we enable is called World Lock.

    我們啟用的第一個複選框名為 "世界鎖定"。

  • World Locking is a new feature that makes it easier for developers to keep the virtual world in sync with the real world.

    世界鎖定是一項新功能,可讓開發人員更輕鬆地保持虛擬世界與現實世界同步。

  • Previously, the recommended method to keep the real and virtual world in sync was to ensure that every piece of virtual content is attached to an anchor.

    以前,保持現實世界和虛擬世界同步的推薦方法是確保每段虛擬內容都與錨點相連。

  • This meant that nothing could be considered static and would need to cope with being moved by small amounts every frame.

    這就意味著沒有任何東西是靜止的,需要應對每幀的微小移動。

  • This can lead to a number of issues with networking, physics, rendering, etc.

    這會導致網絡、物理、渲染等方面的一系列問題。

  • So, we definitely want to keep this box checked.

    是以,我們一定要選中這個複選框。

  • Next, we look at the scene settings.

    接下來,我們看看場景設置。

  • Our data source can either be a room prefab which is provided to us by the utility kit already, or it can be the scene model that we have created inside our headset already.

    我們的數據源可以是由實用工具包提供的房間預製件,也可以是我們已經在頭顯內部創建的場景模型。

  • There is a third option called Device with Prefab Fallback, which means if we haven't set up a room scan inside our quest home, our application will make use of the room prefabs that the utility kit provided to us.

    第三個選項叫做 "帶預製件回退的設備",這意味著如果我們沒有在任務住宅內設置房間掃描,我們的應用程序將使用實用工具包提供給我們的房間預製件。

  • This is not only beneficial for when we cannot scan our own room, but also if we want to test our app in a variety of rooms that could be similar to our end-users' rooms.

    這不僅有利於我們掃描自己的房間,還有利於我們在各種可能與最終用戶房間相似的房間中測試應用程序。

  • Next, we have a room index and a list of room prefabs that can be loaded.

    接下來,我們有一個房間索引和一個可以加載的房間預製件列表。

  • Setting the room index to minus one means that a random room prefab will be loaded.

    將房間索引設置為負 1 意味著將加載一個隨機的房間預製板。

  • Setting the index to the number zero means the first room prefab will be loaded every time and so on.

    將索引設置為 0 意味著每次都會加載第一個房間預製件,以此類推。

  • The list below comes already prefilled with some room prefabs.

    下面的列表中已經預裝了一些房間預製件。

  • If we play the scene two different times, you will be able to see that, in the editor Unity, we'll randomly load two different rooms.

    如果我們播放兩個不同的場景,就可以看到在編輯器 Unity 中,我們會隨機加載兩個不同的房間。

  • Next, there is the Load Scene on Startup checkbox.

    接下來是 "啟動時加載場景 "複選框。

  • When enabled, the scene is automatically loaded if it exists, and the scene loaded event is fired with no other action.

    啟用後,如果場景存在,就會自動加載,並且場景加載事件會被觸發,而無需其他操作。

  • When false, you can manually control scene initialization behavior.

    為假時,可以手動控制場景初始化行為。

  • Lastly, we can specify the width of a seating area within our scene model.

    最後,我們可以在場景模型中指定座位區的寬度。

  • This means, if we have set up an anchor with the Couch label, and it has at least the width specified on our MRUK component, it can be queried from code, so for example, we could call tryGetClosestSeatPose, which returns the closest seat pose on any couch objects.

    這意味著,如果我們用沙發標籤設置了一個錨點,並且它的寬度至少達到了 MRUK 組件上指定的寬度,那麼就可以通過代碼對其進行查詢,例如,我們可以調用 tryGetClosestSeatPose,它可以返回任何沙發對象上最接近的座位姿勢。

  • Or we could also call getSeatPoses, which simply returns all seat poses in the room.

    或者,我們也可以調用 getSeatPoses,它可以簡單地返回房間裡所有的座位姿勢。

  • It will return zero if there are no couch objects in the scene.

    如果場景中沒有沙發對象,它將返回 0。

  • Let's now look at the Effect Mesh component.

    現在讓我們來看看效果網格組件。

  • This component allows us to easily render our scene models in a different material, which we can assign under Mesh Material.

    通過該組件,我們可以輕鬆地用不同的材質渲染場景模型,我們可以在網格材質下指定材質。

  • It also allows us to enable colliders, which will let us interact with physics in our scene like bouncing objects off our models.

    它還允許我們啟用碰撞器,這將使我們能夠與場景中的物理進行交互,比如將物體從模型上彈起。

  • We can also allow the casting of shadows on our surfaces, which lets us see the shadow of other objects when they are moving within our scene.

    我們還可以允許在表面投射陰影,這樣當其他物體在場景中移動時,我們就能看到它們的陰影。

  • Lastly, we can decide which labels to apply this scene effect to.

    最後,我們可以決定將此場景效果應用於哪些標籤。

  • For example, just floors and walls, or all the objects in our scene.

    例如,只有地板和牆壁,或者場景中的所有物體。

  • I will leave a link in the description that explains the other properties on this component, which we won't look at in more detail in this video.

    我將在說明中留下一個鏈接,解釋該組件的其他屬性,在本視頻中我們將不再詳細介紹。

  • Lastly, let's look at the RoomGuardian GameObject.

    最後,讓我們來看看 RoomGuardian GameObject。

  • It contains the Effect Mesh and MRUKStart component like on the Effect Mesh GameObject.

    它包含效果網格和 MRUKStart 組件,就像效果網格遊戲對象一樣。

  • But this time, we also have a RoomGuardian component, where we can set a distance.

    不過,這次我們還有一個 "房間守護者"(RoomGuardian)組件,可以設置距離。

  • This is the distance from which the guardian should be activated, from when the player moves within that distance.

    這是當玩家在該距離內移動時,守護者應該被激活的距離。

  • On the SceneLoaded event, we call the GetEffectMesh material from the RoomGuardian component.

    在 SceneLoaded 事件中,我們調用了 RoomGuardian 組件中的 GetEffectMesh 材質。

  • This method will find the mesh from our Effect Mesh and fade the guardian material depending on our distance to the guardian.

    此方法將從我們的效果網格中找到網格,並根據我們與守護者的距離來淡化守護者材質。

  • We can see that right here in the code as well.

    我們在代碼中也可以看到這一點。

  • Let's take a look in our editor.

    讓我們用編輯器看一看。

  • You can see the guardian being simulated very accurately, as if we are wearing our headset right now, and we would walk towards a boundary.

    你可以看到監護人被非常精確地模擬出來,就好像我們現在戴著耳機,走向一個邊界。

  • You can play around with the distance and figure out which distance is best for your game.

    您可以隨意調整距離,找出最適合您比賽的距離。

  • The last thing we want to look at in this basic scene is the SceneDebugger component.

    在這個基本場景中,我們最後要看的是場景調試器(SceneDebugger)組件。

  • This component offers us a menu with a variety of tools for getting anchor and surface information.

    該組件為我們提供了一個菜單,其中包含多種獲取錨點和表面資訊的工具。

  • It also allows us to shoot a projectile into our space, if we enable the collision on our Effect Mesh.

    如果我們在 "效果網格 "上啟用了碰撞功能,它還可以將彈丸射入我們的空間。

  • Let's press play and see what kind of functions are open and available to us from the MRUK Singleton class that comes with the Mixed Reality Utility Kit.

    讓我們按下播放鍵,看看混合現實實用工具套件附帶的 MRUK Singleton 類為我們開放了哪些功能。

  • We can get the KeyWall, which is the longest wall in the room that has no other room corners behind it.

    我們可以得到 KeyWall,它是房間裡最長的一面牆,後面沒有其他房間的角落。

  • Or we can request the largest available surface, or the closest surface position, which can be great for placing content in our own app.

    或者,我們可以請求最大的可用表面或最近的表面位置,這對我們在自己的應用程序中放置內容非常有用。

  • We can also query the closest seat position, or visualize where our raycast is hitting the model, for example to get a better understanding of how users are interacting with our app.

    例如,我們還可以查詢最近的座位位置,或可視化我們的光線投射擊中模型的位置,從而更好地瞭解用戶如何與我們的應用進行交互。

  • Now let's look at some code, and for that we open the SceneDebugger script.

    現在讓我們來看看一些代碼,為此我們打開場景調試器腳本。

  • I want to show you how easy it is to query all this information yourself, and create your own unique gameplay with it.

    我想告訴你,自己查詢所有這些資訊,並利用這些資訊創建自己獨特的遊戲是多麼容易。

  • We can use three main classes, MRUK, MRUKRoom, and MRUKAnchor.

    我們可以使用三個主要類:MRUK、MRUKRoom 和 MRUKAnchor。

  • They all come with a bunch of methods that provide us with a lot of information about our room.

    它們都有很多方法,可以為我們提供有關房間的大量資訊。

  • I will leave a link in the description to all of these methods.

    我會在說明中留下所有這些方法的鏈接。

  • Now, let's just quickly look at how Meta has used some of those methods for the debugging functionality.

    現在,讓我們快速看看 Meta 是如何將其中一些方法用於調試功能的。

  • Let's check line 156, for example.

    例如,讓我們檢查第 156 行。

  • As you can see, the GetKeyWallDebugger method is supposed to retrieve the KeyWall, and apply the debug visuals to it.

    如你所見,GetKeyWallDebugger 方法應該是檢索 KeyWall 並將調試視覺效果應用到它。

  • To get the KeyWall from our room model, we can simply use the MRUK singleton, by calling MRUK.instance.

    要從房間模型中獲取 KeyWall,我們只需調用 MRUK.instance 即可。

  • Then we need to get the current room, and get the KeyWall from it, by calling GetCurrentRoom.GetKeyWall.

    然後,我們需要獲取當前房間,並通過調用 GetCurrentRoom.GetKeyWall 獲取其中的 KeyWall。

  • Also, as you can see, our KeyWall has the type MRUKAnchor.

    此外,正如您所看到的,我們的 KeyWall 具有 MRUKAnchor 類型。

  • Let's also take a look at another method.

    讓我們再看看另一種方法。

  • In line 197, we can see that we are doing the exact same thing.

    在第 197 行中,我們可以看到,我們正在做著完全相同的事情。

  • We declare another local MRUKAnchor variable, and get the largest available surface by calling the MRUK.instance, and then getting the current room we are in.

    我們聲明另一個在地 MRUKAnchor 變量,並通過調用 MRUK.instance 獲得最大的可用表面,然後獲取我們當前所在的房間。

  • We can then simply call the FindLargestSurface method, and provide it with the surface type parameter, so it knows which surface we are looking for.

    然後,我們只需調用 FindLargestSurface 方法,並向它提供曲面類型參數,這樣它就知道我們要找的是哪個曲面了。

  • Meta really made it super easy for us to query a bunch of scene data.

    Meta 為我們查詢大量場景數據提供了極大的便利。

  • But let's look at a few more samples to cover all the most important features of this amazing utility kit.

    不過,我們還是要多看幾個樣本,以瞭解這款神奇工具包的所有重要功能。

  • We open the FindFloorZone scene and open the FindFloorZone module, because the next component we take a look at is the FindSpawnPositions.

    我們打開 FindFloorZone 場景並打開 FindFloorZone 模塊,因為我們要查看的下一個組件是 FindSpawnPositions。

  • This is an excellent tool for when we have our own prefabs, let's say a model of a small building for an architecture application, and we want to check where we are able to place it without overlapping with our furniture.

    當我們有了自己的預製件(比如建築應用程序中的小型建築模型),並希望檢查可以在哪些位置放置預製件而不會與傢俱重疊時,這是一個非常好的工具。

  • So, we would reference our prefab in the SpawnPrefab field, and depending on the size of it, it will then decide on where and how often it can be placed on our surface.

    是以,我們將在 SpawnPrefab 資料欄中引用我們的預製件,然後根據預製件的大小,決定在我們的表面上放置預製件的位置和頻率。

  • If we look at this FloorSpot prefab for example, we can see it is 2 units long and wide, so it will only fit in places of that size or bigger.

    以 FloorSpot 預製構件為例,我們可以看到它有 2 個單元的長寬,是以只能安裝在這個尺寸或更大的地方。

  • We can set the amount of prefabs we want to place, as well as the number of times to attempt spawning or moving an object before giving up.

    我們可以設置想要放置的預製件數量,以及在放棄之前嘗試生成或移動物體的次數。

  • We can also specify where on the surface we would like to spawn the objects, and for which kinds of labels, for example, just on the floor.

    我們還可以指定在物體表面的哪個位置生成物體,以及生成哪類標籤,例如,只在地板上生成。

  • If CheckOverlap is enabled, then the SpawnPosition will check colliders to make sure there is no overlap.

    如果啟用了 "CheckOverlap(檢查重疊)",那麼 SpawnPosition 將檢查碰撞器,確保沒有重疊。

  • We lastly call the StartSpawn method from the FindSpawnPositions on the SceneLoaded event.

    最後,我們通過場景加載事件中的 FindSpawnPositions 調用 StartSpawn 方法。

  • Let's give this scene a try.

    讓我們試一試這個場景。

  • We can see now how the different prefabs of different sizes are being spawned onto our floor surfaces.

    現在我們可以看到不同大小的預製件是如何生成到地板表面的。

  • Great guys!

    好樣的

  • There's one very cool component left before we close off this video that I want to show you, and that's the AnchorPrefabSpawner.

    在本視頻結束之前,我還想向大家展示一個很酷的組件,那就是 AnchorPrefabSpawner。

  • Let's open the virtual home scene and look at the FurnitureSpawner.

    讓我們打開虛擬家庭場景,看看 FurnitureSpawner。

  • The AnchorPrefabSpawner allows us to effectively replace existing anchors, such as beds and tables, with virtual objects, or in other words prefabs, that we prepared beforehand.

    通過 AnchorPrefabSpawner,我們可以用事先準備好的虛擬物體(也就是預製件)有效地替換現有的錨點,如床和桌子。

  • So, if we open up the prefabs to spawn and then open one of the elements, we can see that we first specify the label of the anchor that we want to replace, in this case, the walls.

    是以,如果我們打開預製件,然後打開其中一個元素,我們可以看到,我們首先指定了要替換的錨點的標籤,在本例中就是牆壁。

  • And after that, we assign the prefab that our walls should be replaced with.

    之後,我們指定了牆壁應該更換的預製板。

  • Let's give this last scene a try and see our room with those walls we added as prefabs.

    讓我們嘗試一下最後一個場景,看看我們的房間裡有了這些作為預製件添加的牆壁。

  • We can see that our real room turned into a completely virtual room.

    我們可以看到,我們的真實房間變成了一個完全虛擬的房間。

  • This allows us to modify our users' rooms in the style of our game, which opens up a huge variety of gameplay.

    這樣,我們就可以按照我們的遊戲風格來修改用戶的房間,從而開闢出多種多樣的遊戲玩法。

  • And I can't wait to see what all of you are building with the Mixed Reality Utility Kit.

    我迫不及待地想看看你們都用混合現實實用工具包做了些什麼。

  • Alright guys, and that's it for this video.

    好了,各位,本視頻就到這裡。

  • I hope you learned a lot about MRUK today, and if you're enjoying this content, please take a second to like and subscribe to this channel, consider subscribing to my Patreon if you want to get all the source codes of each tutorial, and we are happy to welcome you in our Discord community, and feel free to join if you have any questions.

    我希望你今天能學到很多關於 MRUK 的知識,如果你喜歡這些內容,請花點時間喜歡並訂閱這個頻道,如果你想得到每個教程的所有源代碼,可以考慮訂閱我的 Patreon,我們很高興歡迎你加入我們的 Discord 社區,如果你有任何問題,歡迎隨時加入。

  • Thank you so much for watching, and see you in the next one.

    感謝您的收看,下期節目再見。

  • Microsoft Mechanics www.microsoft.com

    微軟機械 www.microsoft.com

Hi XR developers, today we're going to talk about a new tool from Meta which is called the Mixed Reality Utility Kit or MRUK for short.

嗨,XR 開發者們,今天我們要討論的是來自 Meta 的一款新工具,它被稱為混合現實實用工具包(Mixed Reality Utility Kit),簡稱 MRUK。

字幕與單字
由 AI 自動生成

單字即點即查 點擊單字可以查詢單字解釋

B1 中級 中文 美國腔

混合現實實用工具包:使用 Meta XR SDK 構建空間感知應用程序 (Mixed Reality Utility Kit: Build spatially-aware apps with Meta XR SDK)

  • 0 0
    鄭博涵 發佈於 2024 年 11 月 27 日
影片單字