Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Mulai dari rilis alpha04 library Jetpack XR, ada
update penting tentang cara Anda menyediakan aset lingkungan spasial untuk
performa dan kualitas visual yang optimal. Perubahan ini adalah dampak kompatibilitas
dan memerlukan update aplikasi yang ada yang menetapkan lingkungan spasial.
Untuk menyediakan lingkungan spasial, Anda memerlukan dua komponen utama:
File .glb atau .gltf untuk geometri lingkungan (misalnya, bidang
tanah, objek di sekitar) dan tekstur skybox visual utama yang dilihat pengguna.
File ZIP terpisah yang berisi informasi Image Based Lighting (IBL)
yang dihasilkan dari gambar EXR rentang dinamis tinggi menggunakan alat cmgen. File ZIP
digunakan untuk penghitungan pencahayaan, seperti pantulan pada objek, dan bukan
untuk tekstur skybox visual itu sendiri.
Mengapa pendekatan ini?
Struktur aset yang diperbarui ini memberikan keuntungan berikut:
Ukuran file yang lebih kecil: Dibandingkan dengan metode sebelumnya, seperti menggunakan satu
file skybox HDR beresolusi tinggi untuk informasi tampilan visual dan pencahayaan, pendekatan ini akan mengurangi ukuran file.
Performa yang ditingkatkan: Memisahkan tekstur skybox visual (dibuat dalam glb) dari data IBL (dalam file ZIP) memungkinkan Anda mengoptimalkan setiap komponen secara independen. Hal ini menghasilkan bandwidth baca memori tekstur yang lebih rendah
dan konsumsi daya yang lebih rendah.
Pencahayaan yang dioptimalkan: Menggunakan resource skybox resolusi lebih rendah
khusus untuk peta pencahayaan bermanfaat bagi performa tanpa
memengaruhi hasil visual pencahayaan pada objek secara signifikan.
glb Anda mewakili geometri di sekitar pengguna, dan Anda menyertakan tekstur visual
skybox. Untuk geometri, Anda harus mencoba mempertahankan ukuran file
sebesar atau lebih kecil dari 80 MB.
Untuk melakukannya, ada sejumlah peluang untuk membuat lingkungan Anda lebih
efisien sekaligus mempertahankan kualitas tinggi. Misalnya, kepadatan mesh Anda
harus paling padat di dekat pengguna, dan Anda dapat mengurangi kepadatan untuk
mesh yang lebih jauh dari pengguna.
Jarak pandang: Jarak pandang untuk lingkungan di Android XR adalah 200 m
dari titik pengguna, dan tekstur skybox Anda harus mematuhi
batasan ini. Hal ini memberikan pengalaman yang optimal karena paralaks menjadi
tidak dapat dibedakan pada jarak tersebut.
Tinggi pengguna: Geografi dapat bervariasi, tetapi posisikan pengguna di gundukan dengan
tinggi sekitar 1,5 meter untuk menghindari pemotongan dengan elemen UI yang lebih besar di
aplikasi.
Polycount: Perhatikan polycount dalam file glb Anda, karena polycount yang tinggi dapat menyebabkan konsumsi daya yang tidak perlu. Setiap patch geometri
tidak boleh melebihi 10.000 vertex.
Kompresi KTX: Optimalkan performa GPU file glb dengan
memastikan glb Anda menggunakan mipmap dan tekstur ktx2.
Temukan .tgz yang berisi cmgen versi bawaan untuk platform Anda dan
ekstrak.
Alat bawaan berada di direktori /bin dari file .tgz yang diekstrak.
Aset yang harus disiapkan untuk membuat file .zip untuk IBL:
EXR resolusi rendah yang cocok dengan tekstur skybox Anda
Input tekstur skybox Anda harus berupa file EXR. Meskipun cmgen mendukung
format lain, EXR direkomendasikan karena menyediakan informasi
rentang dinamis tinggi yang penting untuk memberikan IBL berkualitas tinggi.
Menggunakan format lain seperti PNG akan menghasilkan pencahayaan yang kurang presisi.
Gambar sumber (EXR) harus memiliki rasio 2:1 dan dimensi yang merupakan
kelipatan 2. Gunakan EXR yang berukuran 1024x512 piksel. Catatan: Resolusi 1024x512 mungkin tampak terlalu rendah, tetapi ini bermanfaat untuk performa. Untuk IBL, hasil visual bagi pengguna sangat mirip
dengan aset resolusi IBL yang jauh lebih tinggi.
PNG hitam solid
Aset ini juga harus memiliki rasio 2:1. Gunakan ukuran 100x50 piksel.
Ini berfungsi sebagai tekstur yang dioptimalkan untuk menyertai IBL. Pengguna tidak akan
melihatnya, jadi kami memfokuskan aset pada pengoptimalan performa.
Berikut adalah contoh penggunaan cmgen untuk membuat file .zip untuk IBL.
Dalam contoh ini, kita menggunakan file input bernama my_360_skybox_1024_x_512.exr dan
black_skybox.png, dan kita membuat file .zip bernama my_ibl.zip
# Produce black cubemaps for the texture of the IBL asset.
./cmgen--format=rgb32f--size=128--extract=./skybox_ibl./black_skybox.png
# Produce lighting cubemaps and a Spherical Harmonics from EXR
./cmgen--format=rgb32f--size=128--deploy=./skybox_ibl--ibl-ld=.--ibl-samples=1024--extract-blur=0.0--sh-irradiance--sh-shader--sh-output=./skybox_ibl/sh.txt./my_360_skybox_1024_x_512.exr
# Copy all of the black cubemaps into the other folder.
cp-rf./skybox_ibl/black_skybox/*./skybox_ibl/my_360_skybox_1024_x_512
# Rename the directory to reflect that these are old assets.
mv./skybox_ibl/black_skybox./skybox_ibl/black_skybox_old
# Rename the directory to reflect that these are your cubemap assets.
mv./skybox_ibl/my_360_skybox_1024_x_512./skybox_ibl/black_skybox
# Change into the child directory.cd./skybox_ibl
# Zip all of the cubemap and the Spherical Harmonics assets together.
zip-qmy_ibl.zipblack_skybox/*
# Return to the directory you started in.cd..
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 UTC."],[],[],null,["# Optimize environment assets\n\nBeginning with the alpha04 release of the Jetpack XR libraries, there are\nimportant updates to how you should provide spatial environment assets for\noptimal performance and visual quality. These changes are a compatibility impact\nand require updating existing apps that set spatial environments.\n\nTo provide spatial environments, you need two main components:\n\n- A .glb or .gltf file for the environment's geometry (for example, the ground plane, nearby objects) and the primary visual skybox texture that users see.\n- A separate ZIP file containing Image Based Lighting (IBL) information generated from a high dynamic range EXR image using the cmgen tool. The ZIP file is used for lighting calculations, such as reflections on objects, and not for the visual skybox texture itself.\n\nWhy this approach?\n------------------\n\nThis updated asset structure provides these advantages:\n\n- **Smaller file sizes:** Compared to previous methods, such as using a single high-resolution HDR skybox file for both visual display and lighting information, this approach reduces file sizes.\n- **Improved performance:** Separating the visual skybox texture (built into the glb) from the IBL data (in the ZIP file) lets you optimize each component independently. This results in lower texture memory read bandwidth and lower power consumption.\n- **Optimized lighting:** Using a lower resolution skybox resource specifically for the lighting map is beneficial for performance without significantly impacting the visual results of the lighting on objects.\n\nTo learn more about adding a spatial Environment in your app, see our guide on\n[adding environments to your app](/develop/xr/jetpack-xr-sdk/add-environment).\n| **Note:** It's important to provide an IBL asset if your app sets a custom environment, especially if your app has any 3D objects. This is because, if your app provides a glb/glTF but no IBL ZIP file, the 3D objects in the user's environment appear with incorrect lighting (for example, too bright or dim, reflecting objects that the user can't otherwise see).\n\nOptimize your glb\n-----------------\n\nYour glb represents the geometry around the user, and you include the visual\ntexture of your skybox. For your geometry, you should try to maintain file sizes\nat or smaller than 80MB.\n\nTo do this, there are a number of opportunities to make your environment more\nefficient while maintaining high quality. For example, the density of your mesh\nshould be the most dense near the user, and you can decrease the density for\nmeshes that are farther from the user.\n\n- **View distance:** The view distance for environments in Android XR is 200m from the point of the user, and your skybox texture should adhere to this constraint. This provides an optimal experience because parallax becomes indiscernible at that distance.\n- **User height:** Geography can vary, but position the user on a mound at\n around 1.5 meters of height to avoid clipping with larger UI elements in\n apps.\n\n- **Polycount:** Be sensitive to the polycount in your glb files, as a high\n polycount can lead to unnecessary power consumption. Each patch of geometry\n shouldn't exceed 10,000 vertices.\n\n- **KTX compression:** Optimize the GPU performance of your glb file by\n ensuring that your glb uses mipmaps and ktx2 textures.\n\nWhat you'll need to optimize your IBL\n-------------------------------------\n\nDownload the cmgen command line utility:\n\n- You can find the latest release in [the Filament repository](https://github.com/google/filament/releases/).\n- Find the .tgz containing the prebuilt version of cmgen for your platform and extract it.\n- The prebuilt tool is under the /bin directory of the extracted .tgz file.\n\nAssets to prepare to generate the .zip file for IBL:\n\n- A low-resolution EXR that matches your skybox texture\n - Your skybox texture input should be an EXR file. Although cmgen supports other formats, EXRs are recommended because they provide the high dynamic range information that's critical to provide high quality IBL. Using other formats like PNG results in less precise lighting.\n - The source image (EXR) needs to have a 2:1 ratio and dimensions that are a power of 2. Use an EXR that's 1024 x 512 pixels. Note: It may seem that 1024 x 512 is too low of a resolution, but this is beneficial for performance. For IBL, the visual results for the user are very similar to much higher IBL resolution assets.\n- A solid black png\n - This asset must also be a 2:1 ratio. Use a size of 100 x 50 pixels.\n - This serves as an optimized texture to accompany the IBL. Users won't look at this, so we focus the asset on optimizing for performance.\n\nThe following shows an example of using cmgen to create the .zip file for IBL.\nIn this example we use input files named my_360_skybox_1024_x_512.exr and\nblack_skybox.png, and we create a .zip file named my_ibl.zip \n\n # Produce black cubemaps for the texture of the IBL asset.\n ./cmgen --format=rgb32f --size=128 --extract=./skybox_ibl ./black_skybox.png\n\n # Produce lighting cubemaps and a Spherical Harmonics from EXR\n ./cmgen --format=rgb32f --size=128 --deploy=./skybox_ibl --ibl-ld=. --ibl-samples=1024 --extract-blur=0.0 --sh-irradiance --sh-shader --sh-output=./skybox_ibl/sh.txt ./my_360_skybox_1024_x_512.exr\n\n # Copy all of the black cubemaps into the other folder.\n cp -rf ./skybox_ibl/black_skybox/* ./skybox_ibl/my_360_skybox_1024_x_512\n\n # Rename the directory to reflect that these are old assets.\n mv ./skybox_ibl/black_skybox ./skybox_ibl/black_skybox_old\n\n # Rename the directory to reflect that these are your cubemap assets.\n mv ./skybox_ibl/my_360_skybox_1024_x_512 ./skybox_ibl/black_skybox\n\n # Change into the child directory.\n cd ./skybox_ibl\n\n # Zip all of the cubemap and the Spherical Harmonics assets together.\n zip -q my_ibl.zip black_skybox/*\n\n # Return to the directory you started in.\n cd .."]]