包含5節(jié)視頻教程
本系列包含Unity3D介紹、Unity3D導(dǎo)出人物、Unity3D導(dǎo)出場景、Unity3D導(dǎo)出動作、游戲測試最終完成一個簡單的游戲。是一套非常完整的Unity3D游戲制作教程。
|
紋理使你的網(wǎng)格、粒子、和界面更生動!它們是你覆蓋或環(huán)繞著對象的圖片或電影文件。由于它們是如此的重要,它們有很多的屬性。如果你是第一次閱讀這一點,跳到細(xì)節(jié),當(dāng)你需要一個參考時返回到實際設(shè)置。 The shaders you use for your objects put specific requirements on which textures you need, but the basic principle is that you can put any image file inside your project. If it meets the size requirements (specified below), it will get imported and optimized for game use. This extends to multi-layer Photoshop or TIFF files - they are flattened on import, so there is no size penalty for your game. 用于對象的著色器可以指定所需要的紋理,但基本原則是可以放置項目中任何圖像文件。如果它符合尺寸要求(見以下說明),它將會被導(dǎo)入并優(yōu)化。對于多層Photoshop文件或TIFF文件——它們在導(dǎo)入過程中被塌陷合并,所以對于游戲沒有不利影響。 Properties 屬性The Texture Inspector looks a bit different from most others: 紋理檢視視圖看起來與其它大多數(shù)有點不同: The top section contains a few settings, and the bottom part contains the Texture Importer and the texture preview. 頂部包含幾個設(shè)置,底部包含了紋理導(dǎo)入器和紋理預(yù)覽。
Texture Importer 紋理導(dǎo)入器Textures all come from image files in your Project Folder. How they are imported is specified by the Texture Importer. You change these by selecting the file texture in the Project View and modifying the Texture Importer in the Inspector. 紋理素材都來自于你的項目文件夾的圖像文件。它們?nèi)绾螌?dǎo)入是由紋理導(dǎo)入器指定的。你通過在項目視圖中選擇紋理文件并且在檢視面板中修改紋理導(dǎo)入器來改變它們。 In Unity 3 we simplified for you all the settings, now you just need to select what are you going to use the texture for and Unity will set default parameters for the type of texture you have selected. Of course if you want to have total control of your texture and do specific tweaks, you can set the Texture Type to Advanced. This will present the full set of options that you have available. 在Unity 3中我們?yōu)槟愫喕怂械脑O(shè)置,現(xiàn)在你只需要選擇你打算使用的紋理,Unity會為你選擇的紋理類型設(shè)置默認(rèn)的參數(shù)。當(dāng)然,如果你想有紋理的完全控制并做具體調(diào)整,你可以設(shè)置紋理類型為高級。這將顯示你可使用的全套選項。
You dont need to set any values in this case, Unity will set all the values for you. 在這種情況下你不需要設(shè)置任何值,Unity會為你設(shè)定所有值。
An interesting way to add a lot of visual detail to your scenes is to use Cookies - greyscale textures you use to control the precise look of in-game lighting. This is fantastic for making moving clouds and giving an impression of dense foliage. The Light page has more info on all this, but the main thing is that for textures to be usable for cookies you just need to set the Texture Type to Cookie. 為你的場景增添很多視覺細(xì)節(jié)的一種有趣方式是使用Cookies——灰階紋理用來控制游戲中照明的精確外觀。這是構(gòu)建移動云層和給人茂密植物印象的一種奇妙方式。光源頁面有這一切更多的信息,主要的是,紋理要為cookie可用,你只需要設(shè)置紋理類型為cookie。
Per-Platform Overrides 按平臺覆蓋When you are building for different platforms, you have to think on the resolution of your textures for the target platform, the size and the quality. With Unity 3 you can override these options and assign specific values depending on the platform you are deploying to. Note that if you don't select any value to override, the Editor will pick the default values when building your project. 當(dāng)你在不同的平臺構(gòu)建(游戲),你必須考慮為目標(biāo)平臺決定你的紋理,尺寸和質(zhì)量。使用Unity3,你可以覆蓋這些選項,并根據(jù)你要部署的平臺指定具體的值。注意,當(dāng)你構(gòu)建項目時,如果你沒有選擇任何值覆蓋,編輯器會選擇默認(rèn)值。
If you have set the Texture Type to Advanced then the Texture Format has different values. 如果你已設(shè)置了紋理類型為高級,則紋理格式會有不同的值。 Desktop
iOS
Android
Unless you're targeting a specific hardware, like Tegra, we'd recommend using ETC1 compression. If needed you could store an external alpha channel and still benefit from lower texture footprint. If you absolutely want to store an alpha channel in a texture, RGBA16 bit is the compression supported by all hardware vendors. 除非你是針對一個特定的硬件,像Tegra,我們建議你使用ETC1壓縮。如果需要可以儲存額外的alpha通道并仍能得到較低的紋理占用空間。如果你一定要儲存alpha通道在紋理中,RGBA16位是所有的硬件??廠商所支持的壓縮。 If your app utilizes an unsupported texture compression, the textures will be uncompressed to RGBA 32 and stored in memory along with the compressed ones. So in this case you lose time decompressing textures and lose memory storing them twice. It may also have a very negative impact on rendering performance. 如果您的應(yīng)用程序采用一個不支持的紋理壓縮,紋理將解壓到RGBA32并連同壓縮的那些儲存在內(nèi)存中。因此,這種情況下將失去解壓紋理時間并消耗內(nèi)存儲存它們兩次,也有可能非常影響渲染性能。 Details 細(xì)節(jié)Supported Formats 支持的格式Unity can read the following file formats: PSD, TIFF, JPG, TGA, PNG, GIF, BMP, IFF, PICT. It should be noted that Unity can import multi-layer PSD & TIFF files just fine. They are flattened automatically on import but the layers are maintained in the assets themselves, so you don't lose any of your work when using these file types natively. This is important as it allows you to just have one copy of your textures that you can use from Photoshop, through your 3D modelling app and into Unity. Unity支持下面的文件格式:PSD, TIFF, JPG, TGA, PNG, GIF, BMP, IFF, PICT。應(yīng)注意,Unity可以導(dǎo)入多層PSD和TIFF文件,在導(dǎo)入時,層將自動被塌陷,因此你不必浪費時間,直接使用源文件類型。這點很重要,允許只有一個紋理拷貝,使用從Photoshop,三維建模程序?qū)氲経nity。 Texture Sizes 紋理大小These sizes are as follows: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 or 2048 pixels. The textures do not have to be square, i.e. width can be different from height. 這些尺寸如下:2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 或 2048像素。紋理可不必是正方形,即寬度和高度可以不同。 It is possible to use other (non power of two) texture sizes with Unity. Non power of two texture sizes work best when used on GUI Textures, however if used on anything else they will be converted to an uncompressed RGBA 32 bit format. That means they will take up more video memory (compared to PVRT(iOS)/DXT(Desktop) compressed textures), will be slower to load and slower to render (if you are on iOS mode). In general you'll use non power of two sizes only for GUI purposes. 可以使用其他非二次方紋理尺寸,當(dāng)用于GUI紋理時,非二次方紋理最好,但是,如果在別的使用,它們將被轉(zhuǎn)換為未壓縮的RGBA32位格式。這意味著它們將使用更多的內(nèi)存(相比PVRT(iOS)/DXT(Desktop)壓縮的紋理),將使較慢加載和和較慢渲染(如果是iOS模式)。一般來說,非二次方的紋理僅用于GUI。 Non power of two texture assets can be scaled up at import time using the Non Power of 2 option in the advanced texture type in the import settings. Unity will scale texture contents as requested, and in the game they will behave just like any other texture, so they can still be compressed and very fast to load. 非二次方紋理資源可以在導(dǎo)入時在導(dǎo)入設(shè)置中高級紋理類型使用Non Power of 2(非二次方)選項設(shè)置縮放。Unity將按需縮放紋理,并在游戲中,它們的行為就像其他紋理一樣,因此他們?nèi)匀豢梢员粔嚎s,加載非?。 UV Mapping(UV貼圖)When mapping a 2D texture onto a 3D model, some sort of wrapping is done. This is called UV mapping and is done in your 3D modelling app. Inside Unity, you can scale and move the texture using Materials. Scaling normal & detail maps is especially useful. 當(dāng)映射一個2D紋理到一個3D模型上,要設(shè)定循環(huán)模式(平鋪方式)。這就是三維建模程序中,被稱為UV貼圖。在Unity,可以使用Materials縮放移動紋理?s放法線和地形細(xì)節(jié)貼圖尤其有用。 Mip Maps 多級紋理Mip Maps are a list of progressively smaller versions of an image, used to optimise performance on real-time 3D engines. Objects that are far away from the camera use the smaller texture versions. Using mip maps uses 33% more memory, but not using them can be a huge performance loss. You should always use mipmaps for in-game textures; the only exceptions are textures that will never be minified (e.g. GUI textures). 多級紋理是逐步縮小圖像版本的一個列表,用來優(yōu)化實時3D引擎的性能。遠(yuǎn)離相機(jī)的物體使用較小的紋理版本。使用多級紋理,將多使用33%以上的內(nèi)存,但不使用它們將有巨大的的性能損失。應(yīng)該為游戲總是使用多級紋理,唯一例外的是,用于不會縮小的紋理(例如GUI紋理)。 Normal Maps 法線貼圖Normal maps are used by normal map shaders to make low-polygon models look as if they contain more detail. Unity uses normal maps encoded as RGB images. You also have the option to generate a normal map from a grayscale height map image. 法線貼圖用于法線貼圖著色器,使低多邊形模型看起來有更多的細(xì)節(jié)。Unity使用的法線貼圖作為RGB圖像編碼,還可以選擇從一個灰度高度圖來生成一個法線貼圖。 Detail Maps 細(xì)節(jié)貼圖If you want to make a terrain, you normally use your main texture to show where there are areas of grass, rocks sand, etc... If your terrain has a decent size, it will end up very blurry. Detail textures hide this fact by fading in small details as your main texture gets up close. 如果想創(chuàng)建一個地形,通常使用主紋理來顯示那些草、巖砂區(qū)域,等等。如果地形非常大,它最終會非常模糊。細(xì)節(jié)紋理隱藏實際的淡出,小細(xì)節(jié)作為更接近的主紋理。 When drawing detail textures, a neutral gray is invisible, white makes the main texture twice as bright and black makes the main texture completely black. 但繪制細(xì)節(jié)紋理,中性灰是不可見的,白色是主紋理兩倍亮,黑色是主紋理完全變黑。 Reflections (Cube Maps) 反射(立方體貼圖)If you want to use texture for reflection maps (e.g. use the Reflective builtin shaders), you need to use Cubemap Textures. 如果你想使用紋理用于反射貼圖(例如使用內(nèi)置的反射著色器),必須使用立方圖紋理。 Anisotropic filtering 各項異性過濾Anisotropic filtering increases texture quality when viewed from a grazing angle, at some expense of rendering cost (the cost is entirely on the graphics card). Increasing anisotropy level is usually a good idea for ground and floor textures. In Quality Settings anisotropic filtering can be forced for all textures or disabled completely. 當(dāng)從掠角(grazing angle)觀看,各向異性過濾提高紋理質(zhì)量,有一些渲染成本消耗(完全是顯卡成本)。為地面和地板紋理,增加各向異性等級通常是一個好主意。在質(zhì)量設(shè)置中各向異性過濾,可以強(qiáng)制用于所有紋理或完全禁用。 贊0 踩0 |
未知用戶
2005-2024 朱峰社區(qū) 版權(quán)所有 遼ICP備2021001865號-1
2005-2024 ZhuFeng Community All Rights Reserved
VIP