包含5節(jié)視頻教程
本系列包含Unity3D介紹、Unity3D導(dǎo)出人物、Unity3D導(dǎo)出場景、Unity3D導(dǎo)出動作、游戲測試最終完成一個簡單的游戲。是一套非常完整的Unity3D游戲制作教程。
![]()
|
![]() Lights will bring personality and flavor to your game. You use lights to illuminate the scenes and objects to create the perfect visual mood. Lights can be used to simulate the sun, burning match light, flashlights, gun-fire, or explosions, just to name a few. 燈光將給你游戲帶來個性和味道。你用燈光來照亮場景和對象 以至創(chuàng)造了完美視覺的氣氛。燈光可以用來模擬太陽,燃燒的火柴,手電筒,槍火光,或爆炸,等等等等,在此就不一一列舉。
There are three types of lights in Unity 在Unity中有三種類型的燈:
Lights can also cast Shadows. Shadows are a Pro-only feature. Shadow properties can be adjusted on a per-light basis. 燈光也可以投射陰影。陰影是專業(yè)版的功能。陰影屬性可以在每一個燈光的基礎(chǔ)上進(jìn)行調(diào)整。 Properties 屬性
Details 細(xì)節(jié)There are three basic light types in Unity. Each type can be customized to fit your needs. 在Unity中光有三種基本類型。各類型可以定制,以滿足您的需要。 You can create a texture that contains an alpha channel and assign it to the Cookie variable of the light. The Cookie will be projected from the light. The Cookie's alpha mask modulates the light amount, creating light and dark spots on surfaces. They are a great way af adding lots of complexity or atmosphere to a scene. 你可以創(chuàng)建一個包含alpha通道的紋理,并將其賦予光線的Cookie變量。Cookie會被光線投影。cookie的Alpha遮罩調(diào)節(jié)光量,可以在表面產(chǎn)生亮點和黑點。他們是往場景加入大量復(fù)雜的東西或氣氛的一種很好的方法。 All built-in shaders in Unity seamlessly work with any type of light. VertexLit shaders cannot display Cookies or Shadows, however. Unity里所有的內(nèi)置的著色器(built-in shaders)全都可用于任何類型的燈光。然而,VertexLit 著色器不能顯示Cookies或者陰影。 In Unity Pro with a build target of webplayer or standalone, all Lights can optionally cast Shadows. This is done by selecting either Hard Shadows or Soft Shadows for the Shadow Type property of each individual Light. For more information about shadows, please read the Shadows page. 在Unity專業(yè)版,編譯目標(biāo)為網(wǎng)頁版或單機(jī)版,所有的燈光可以選擇性地投射陰影(Shadows)。這是通過選擇每個燈光陰影類型( Shadow Type)屬性為"硬陰影或軟陰影來完成的。更多關(guān)于陰影的信息,請閱讀陰影(Shadows )頁。 Point Lights 點光源Point lights shine out from a point in all directions. They are the most common lights in computer games - typically used for explosions, light bulbs, etc. They have an average cost on the graphics processor (though point light shadows are the most expensive). 點光源光線在某一點從各個方向發(fā)射。它們是電腦游戲中最常用的燈光——通常用于爆炸、燈泡、等。他們有一個圖形處理器的平均成本(雖然點光源陰影是最昂貴的---最耗費(fèi)資源的)。
Point lights can have cookies - Cubemap texture with alpha channel. This Cubemap gets projected out in all directions. 點光源可以有cookies – 帶有 alpha通道的立方圖(Cubemap )紋理。立方圖 (Cubemap)可在各個方向得出投影。
Spot Lights 聚光燈Spot lights only shine in one direction, in a cone. They are perfect for flashlights, car headlights or lamp posts. They are the most expensive on the graphics processor. 聚光燈只在一個方向上,在一個圓錐體范圍發(fā)射光線。它們用作手電筒真是完美,汽車的車頭燈或者燈柱。它們在圖形處理器上是最耗費(fèi)資源的。
Spot lights can also have cookies - a texture projected down the cone of the light. This is good for creating an effect of light shining through the window. It is very important that the texture is black at the edges, has Border Mipmaps option on and its wrapping mode is set to Clamp. For more info on this, see Textures. 聚光燈同樣也可以帶有cookies - 這可以很好地創(chuàng)建光芒透過窗戶的效果。紋理的邊緣是黑色的,打開邊框多層紋理(Border Mipmaps )選項和它的循環(huán)模式(wrapping mode)設(shè)置為強(qiáng)制拉伸(Clamp),這是非常重要的。想要得到更多關(guān)于這方面的信息,參見紋理(Textures.)
Directional Lights 方向光源Directional lights are used mainly in outdoor scenes for sun & moonlight. The light affect all surfaces of objects in your scene. They are the least expensive on the graphics processor. Shadows from directional lights (for platforms that support shadows) are explained in depth on this page. 方向光主要用于模擬在室外場景的陽光與月光。方向光影響你的場景中的對象的所有表面。 他們在圖形處理器中是最不耗費(fèi)資源的。方向光產(chǎn)生的陰影(因為平臺支持陰影)標(biāo)識著在此頁(this page)上的深度。
When directional light has a cookie, it is projected down the center of the light's Z axis. The size of the cookie is controlled with Cookie Size property. Set the cookie texture's wrapping mode to Repeat in the Inspector. 當(dāng)平行光有一個cookie,它是預(yù)測光的Z軸的中心。cookie大小由cookie的大小(Cookie Size)屬性控制。在檢視面板設(shè)置cookie貼圖的循環(huán)模式(wrapping mode)為重復(fù)(Repeat)
A cookie is a great way to add some quick detail to large outdoor scenes. You can even slide the light slowly over the scene to give the impression of moving clouds. Cookie是在大型戶外場景中快速添加細(xì)節(jié)的好方法。你甚至可以將的燈光在場景中慢慢移動,給人的感覺就像云在動。 Performance considerations 性能考慮Lights can be rendered in one of two methods: vertex lighting and pixel lighting. Vertex lighting only calculates the lighting at the vertices of the game models and interpolates the lighting over the surfaces of the models. Pixel lights are calculated at every screen pixel, and hence are much more expensive. Some older graphics cards only support vertex lighting. 燈光有兩種渲染方式:頂點(vertex )光照和像素(pixel )光照。頂點光照只計算游戲模型的頂點照明和通過插值計算得出模型表面所有光線。燈光在屏幕每一個像素計算,因此很奢侈(耗費(fèi)資源)。一些舊的顯卡只支持頂點光照。 While pixel lighting is slower to render, it does allow some effects that are not possible with vertex lighting. Normal-mapping, light cookies and realtime shadows are only rendered for pixel lights. Spotlight shapes and Point light highlights are much better when rendered in pixel mode as well. The three light types above would look like this when rendered in vertex light mode: 像素光照渲染得慢,但它能夠?qū)崿F(xiàn)一些頂點光照不能實現(xiàn)的效果。正規(guī)映射(Normal-mapping),燈光cookies(light cookies) 和實時陰影(realtime shadows)只能由像素光照渲染。在像素光照模式下,聚光燈的形狀和點光源亮點效果更好。當(dāng)在頂點光照模式下渲染,以上三種光照類型的效果就像這樣:
Lights have a big impact on rendering speed - therefore a tradeoff has to be made betwen lighting quality and game speed. Since pixel lights are much more expensive than vertex lights, Unity will only render the brightest lights at per-pixel quality. The actual number of pixel lights can be set in the Quality Settings for webplayer and standalone build targets. 燈光有對渲染速度有非常大的影響——因此必須權(quán)衡前后照明質(zhì)量和游戲速度。由于像素光照比頂點光照奢侈得多(更耗費(fèi)資源),Unity將只在最亮的光逐個像素渲染。網(wǎng)頁版(webplayer)和單機(jī)版(standalone)編譯目標(biāo)中,像素?zé)舻膶嶋H數(shù)量可以質(zhì)量設(shè)置( Quality Settings )進(jìn)行設(shè)置。 You can explicitly control if a light should be rendered as a vertex or pixel light using the Render Mode property. By default Unity will classify the light automatically based on how much the object is affected by the light. 光線以頂點光照或像素光照模式渲染。你可以通過渲染模式屬性(Render Mode property)顯式控制。默認(rèn)情況下,Unity根據(jù)對象受到光影響的多少自動對光進(jìn)行歸類。 The actual lights that are rendered as pixel lights are determined on an object-by-object case. This means: 實際燈光被渲染在object-by-object的情況下確定作為像素光渲染。這句話的意思是:
See Optimizing Graphics performance on Desktop, iOS or Android page for more information. 在 臺式機(jī)(Desktop),iOS 或Android 頁面參見優(yōu)化圖形性能(Optimizing Graphics performance),獲取更多信息。 Creating CookiesFor more information on creating cookies, please see the tutorial on how to create a Spot light cookie. 創(chuàng)建的Cookie的更多信息,請參閱關(guān)于如何創(chuàng)建一個射燈cookie的教程( tutorial on how to create a Spot light cookie) Hints 提示
贊0 踩0 |
未知用戶
2005-2025 朱峰社區(qū) 版權(quán)所有 遼ICP備2021001865號-1
2005-2025 ZhuFeng Community All Rights Reserved
VIP