unityunity点光源阴影在安卓手机上无效果

笨狗的开发备忘录(7)
Android平台下不显示阴影,
1.把Edit-GraphicsEmulation-NoEmulation勾上,
2.出apk包时最好能把playersetting-GraphicsLevel改为force OpenGL ES 3.0 ,不改部分手机也能有阴影
3.qualitysetting-shadowdistance要合适
4.camera离阴影的物理距离不能太远
5.fast、fastest下没有阴影
6.光源要hardshadow或者softshadow,有些硬件不支持softshadow
7.投射物体材质球要cast shadow,接收物体要receiveshadow勾上
这样就都有阴影了
原帖地址:/forum/read.php?tid=18682
Unity优化规划测试:/zh-cn/articles/how-to-plan-optimizations-with-unity/?utm_&utm_medium=Text%20Link&utm_campaign=GameDev_PRC_Q215_CSDN
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1790次
排名:千里之外
原创:12篇
(1)(1)(2)(2)(3)(2)(1)(1)(1)(4)21710人阅读
Unity3D(156)
网上看到一篇关于灯光的文章,描述的很详细,如下:
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,
lights, gun-fire, or explions, just to name a few.
灯光将给你游戏带来个性和味道。你用灯光来照亮场景和对象 以至创造了完美视觉的气氛。灯光可以用来模拟太阳,燃烧的火柴,手电筒,枪火光,或爆炸,等等等等,在此就不一一列举。
The Light Inspector&灯光检视面板
There are three types of lights in &在Unity中有三种类型的灯:
Point lights shine from a location equally in all directions, like a light bulb.&
点光源从一个位置向四面八方发出光线,就像一盏灯。
Directional lights are placed infinitely far away and affect everything in the scene, like the sun.&
方向光源(平行光) 被放置在无穷远的地方,影响场景的所有物体,就像太阳
Spot lights shine from a point in a direction and only illuminate objects within a cone - like the headlights of a car.&
聚光灯 灯光从一点发出,只在一个方向按照一个锥形物体的范围照射,就像一辆汽车的车头灯。
Lights can also cast Shadows. Shadows are a Pro-only feature. Shadow properties can be adjusted on a per-light basis.
灯光也可以投射阴影。阴影是专业版的功能。阴影属性可以在每一个灯光的基础上进行调整。
Properties 属性
The current type of light object:&灯光对象的当前类型
&&&&Directional&方向光
A light placed infinitely far away. It affects everything in the scene.
灯光放在无穷远处。它影响着在场景里所有物体。
&&&&Point&点光
A light that shines equally in all directions from its location, affecting all objects within its Range.
灯光从它的位置各个方向发出光线,影响其范围内的所有对象。
&&&&Spot&聚光
A light that shines everywhere within a cone defined by Spot Angle and Range. Only objects within this region are affected by the light.
光线在 按照聚光灯的角度和范围所定义的一个圆锥区域 照射所有物体。只有在这个区域内的对象才会受到光线照射。
Range&范围
How far light is emitted from the center of the object. Point/Spot light only.
光从物体的中心发射能到达多远?。只对点光源和聚光灯
Spot Angle&聚光灯角度
Determines the angle of the cone in degrees. Spot light only.
灯光的聚光角度。只用于聚光灯
Color&颜色
The color of the light emitted.&光线的颜色.
Intensity&强度
Brightness of the light. Default value for a Point/Spot light is 1. Default value for a Directional light is 0.5
光线的明亮程度,点光源/聚光灯 默认值是1。方向光源 默认值是0.5
The alpha channel of this texture is used as a mask that determines how bright the light is at different places. If the light is a Spot or a Directional light, this must be a 2D texture. If the light is a Point
light, it must be a Cubemap. 这个纹理的阿尔法(alpha)通道作为一个遮罩,使光线在不同的地方有不同的亮度。如果灯光是聚光灯或方向光,这必须是一个2D纹理。如果灯光是一个点光源,它必须是一个立方图(Cubemap)。
Cookie Size
Scales the projection of a Cookie. Directional light only.
缩放Cookie投影。只用于方向光。
Shadow Type&阴影类型
(Pro only)
No, Hard or Soft shadows that will be cast by this light. Only applicable to desktop build targets. Soft shadows are more expensive.
硬或软的阴影,将是由灯光所投射的。只适用于编译目标程序(PC)。软阴影更为昂贵。(耗)
&&&&Strength&硬度
The darkness of the shadows. Values are between 0 and 1.&阴影的黑暗程度。取值范围是在0和1之间。
&&&&Resolution&分辨率
Detail level of the shadows.&阴影的细节水平。
&&&&Bias&偏移
Offset used when paring the pixel position in light space with the value from the shadow map. When the value is too small the surfaces start to self-shadow themselves (&shadow acne&), when too big - casters are disconnected from receivers (&peter panning&).
用于比较灯光的像素位置与阴影贴图的值比较的偏移量。当值太小,表面会产生self-shadow(&影子痤疮&),-----就是物体的表面会有来自于自身的阴影,物体就像长了痘痘一样。当值太大,光源就会脱离了接收器(&彼得平移&)。
&&&&Softness&柔化
Scales the penumbra region (the offset of blur samples). Directional light only.
缩放半阴影区(模糊样本的偏移量)。只用于方向光
&&&&Softness Fade&柔化淡出
Shadow softness fade based on the distance from the camera. Directional light only.
阴影柔化是根据到相机距离进行淡出的。只用于方向光。
Draw Halo&绘制光晕
If checked, a spherical halo of light will be drawn with a radius equal to Range.
如果勾选此项, 光线带有一定半径范围的球形光晕被绘制。
Flare&耀斑
Optional reference to the Flare that will be rendered at the light's position.
可选的。参考(Flare) , 在光的位置渲染出来。
Render Mode&渲染模式
Importance of this light. This can affect lighting fidelity and performance, see Performance Considerations below. Options include:
这灯光的重要性。这可能会影响照明的保真度和,请参阅下面的性能注意事项。包括:
&&&&Auto&自动
The rendering method is determined at runtime depending on the brightness of nearby lights and current
Settings for desktop build target.
为桌面构建目标渲染的方法是根据附近的灯光的亮度和当前的质量设置( Quality Settings)在运行时确定。
&&&&Important&重要
This light is always rendered at per-pixel quality. Use this for very important effects only (e.g. headlights of a player's car).
灯光是逐个像素渲染。只用在一些非常重要的效果(比如玩家的车的车头灯)。
&&&&Not Important&不重要
This light is always rendered in a faster, vertex/object light mode.
灯光总是以最快的速度渲染。顶点/对象光模式
Culling Mask&消隐遮罩
Use to selectively exclude groups of objects from being a see Layers.
有选择地使组对象不受光的效果影响;请看层(Layers.)。
Lightmap&光照贴图
The Lightmapping mode: RealtimeOnly, Auto or BakedO see the Dual Lightmaps description.
光照贴图的模式:仅灯光实时计算(RealtimeOnly), 自动(Auto) or 仅烘焙( BakedOnly) 请看双光照贴图(Dual Lightmaps )
Details 细节
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.
你可以创建一个包含alpha通道的纹理,并将其赋予光线的Cookie变量。Cookie会被光线投影。cookie的Alpha遮罩调节光量,可以在表面产生亮点和黑点。他们是往场景加入大量复杂的东西或气氛的一种很好的方法。
All&&in Unity seamlessly work
with any type of light. VertexLit shaders cannot display Cookies or Shadows, however.
Unity里所有的内置的着色器(built-in shaders)全都可用于任何类型的灯光。然而,VertexLit 着色器不能显示Cookies或者阴影。
In Unity Pro with a build target of player or standalone, all Lights can optionally cast&. This is done by selecting
either Hard Shadows or Soft Shadows for the Shadow Type property of each inidual Light. For more information about shadows, please read the&&page.
在Unity专业版,编译目标为网页版或单机版,所有的灯光可以选择性地投射阴影(Shadows)。这是通过选择每个灯光阴影类型( Shadow Type)属性为&硬阴影或软阴影来完成的。更多关于阴影的信息,请阅读阴影(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).
点光源光线在某一点从各个方向发射。它们是电脑游戏中最常用的灯光——通常用于爆炸、灯泡、等。他们有一个图形处理器的平均成本(虽然点光源阴影是最昂贵的---最耗费资源的)。
Point Light&点光源
Point lights can have cookies -&&texture with alpha
channel. This Cubemap gets projected out in all directions.
点光源可以有cookies – 带有 alpha通道的立方图(Cubemap )纹理。立方图 (Cubemap)可在各个方向得出投影。
Point Light with a Cookie&带有Cookie的点光源
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.
聚光灯只在一个方向上,在一个圆锥体范围发射光线。它们用作手电筒真是完美,汽车的车头灯或者灯柱。它们在图形处理器上是最耗费资源的。
Spot Light&聚光灯
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
. 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&.
聚光灯同样也可以带有cookies - 这可以很好地创建光芒透过窗户的效果。纹理的边缘是黑色的,打开边框多层纹理(Border Mipmaps )选项和它的循环模式(wrapping mode)设置为强制拉伸(Clamp),这是非常重要的。想要得到更多关于这方面的信息,参见纹理(Textures.)
Spot Light with a Cookie&带有Cookie的聚光灯
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)上的深度。
Directional Light&方向光源
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.
当平行光有一个cookie,它是预测光的Z轴的中心。cookie大小由cookie的大小(Cookie Size)属性控制。在检视面板设置cookie贴图的循环模式(wrapping mode)为重复(Repeat)
Directional Light projecting a cloud-like cookie texture 方向光投影一个云状的cookie纹理
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是在大型户外场景中快速添加细节的好方法。你甚至可以将的灯光在场景中慢慢,给人的感觉就像云在动。
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 )光照。顶点光照只计算游戏模型的顶点照明和通过插值计算得出模型表面所有光线。灯光在屏幕每一个像素计算,因此很奢侈(耗费资源)。一些旧的显卡只支持顶点光照。
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:
像素光照渲染得慢,但它能够实现一些顶点光照不能实现的效果。正规映射(Normal-mapping),灯光cookies(light cookies) 和实时阴影(realtime shadows)只能由像素光照渲染。在像素光照模式下,聚光灯的形状和点光源亮点效果更好。当在顶点光照模式下渲染,以上三种光照类型的效果就像这样:
Point light in Vertex lighting mode.&在顶点光照模式下的点光源
Spot light in Vertex lighting mode.&在顶点光照模式下的聚光灯
Directional light in Vertex lighting mode.&在顶点光照模式下的方向光
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&&for
webplayer and standalone build targets.
灯光有对渲染速度有非常大的影响——因此必须权衡前后照明质量和游戏速度。由于像素光照比顶点光照奢侈得多(更耗费资源),Unity将只在最亮的光逐个像素渲染。网页版(webplayer)和单机版(standalone)编译目标中,像素灯的实际数量可以质量设置( Quality Settings )进行设置。
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)显式控制。默认情况下,Unity根据对象受到光影响的多少自动对光进行归类。
The actual lights that are rendered as pixel lights are determined on an object-by-object case. This means:
实际灯光被渲染在object-by-object的情况下确定作为像素光渲染。这句话的意思是:
Huge objects with bright lights could use all the pixel lights (depending on the quality settings). If the player is far from these, nearby lights will be rendered as vertex lights. Therefore, it is better to split huge objects up in a couple of small ones.&
带有明亮灯光的巨大物体,可以全用像素光照(根据质量设置)。如果玩家非常远,附近的灯光可以用顶点光照模式渲染。因此,巨大的物体应分割成几个小的物体这样更好。
See Optimizing Graphics performance on&,&&or&&page
for more information.
在 台式机(Desktop), 或Android 页面参见图形性能(Optimizing
Graphics performance),获取更多信息。
Creating Cookies
For more information on creating cookies, please see the&.
创建的Cookie的更多信息,请参阅关于如何创建一个射灯cookie的教程( tutorial on how to create a Spot light cookie)
Hints 提示
Spot lights with cookies can be extremely effective for making light coming in from windows.&
带cookies的聚光灯可以很有效的制作出光线从窗户射进来的效果。
Low-intensity point lights are good for providing depth to a scene.&
低强度点光源带来场景深度。
For maximum performance, use a&&shader. This shader
only does per-vertex lighting, giving a much higher throughput on low-end cards.&
为了获得最佳性能,使用VertexLit 着色。这个着色器(shader)只进行顶点光照,在低端卡提供高得多的吞吐量。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:914548次
积分:9952
积分:9952
排名:第1205名
原创:78篇
转载:350篇
评论:72条
(2)(3)(2)(1)(3)(1)(4)(2)(2)(6)(25)(2)(5)(3)(65)(20)(2)(4)(4)(58)(12)(10)(82)(75)(25)(1)(1)(1)(3)(2)(8)(1)游戏发布到安卓手机上出现卡帧现象!
&& & 我开发了一个小游戏,场景很小,在电脑上帧数达到100多,drawCalls在50以下,发布(发布的版本为2.3.3)并安装到安卓手机上后,出现如下问题:
&& & 1、在2年前买的手机上运行流畅,帧数可达30帧,安卓版本为2.3.5。
&& & 2、在新买的手机上运行非常卡,帧数10以下,手机安卓版本为4.4.2(同事手机安装后也一样卡,他的手机也是新买不久,安卓版本为4.4)。
&& & &3、而在新买的手机上运行神庙2等其他由unity3d开发的3D游戏都很流畅。
&& & &这是什么问题,请各位大神帮忙分析一下啊?
要评论请先&或者&
那你更换个较低的 【安卓版本】试下呗
很明显需要优化场景了 &我在IOS上遇到过此类问题 &更换了合适的shader & 我感觉是因为计算精度增加了 计算量也就上上去了 &具体还要看情况 & 调试时候最好把帧率输出到GUI上显示出来
显卡可能不一样 用了特定的shader了吧
谢谢各位,问题解决了,原理是主摄像机上SSAO组件造成的。
楼主能说详细解释下吗,我也出现这种情况了。谢谢
非常改写楼主的分享....
有没有玩足球游戏,EA公司的哟,什么都有IOS版android版pc ps xbox 都有哦~!
:原理是主摄像机上SSAO组件造成的:楼主能说详细点嘛,谢谢
::原理是主摄像机上SSAO组件造成的:楼主能说详细点嘛,谢谢 就是绑上这个组件就会很卡,你的是不是这个原因我就不清楚了。环境光与雾
本文所属图书&>&
本书以实例教学为主线,循序渐进地介绍了Unity在游戏开发方面的不同功能。第1章,由零开始,引导读者熟悉Unity编辑器的各个功能模块,这部分内容对Unity程序员、美工和策划都有帮助。第2~4章是3个不同特色的3D游&&
环境光是Unity提供的一种特殊光源,它没有范围和方向的概念,会整体地改变场景亮度。环境光在场景中是一直存在的,在菜单栏选择【Edit】&【Render Settings】,然后在Inspector窗口调节Ambient Light的颜色即决定了环境光的亮度和颜色。
在这里选中Fog还可以开启雾效功能,通过设置Fog Color改变雾的颜色,设置Fog Density改变雾的强度,如图1-24所示。
雾效功能对性能会造成一定影响,在硬件性能较差的平台要谨慎使用这个功能。
您对本文章有什么意见或着疑问吗?请到您的关注和建议是我们前行的参考和动力&&
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
您的浏览器不支持嵌入式框架,或者当前配置为不显示嵌入式框架。
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'

我要回帖

更多关于 unity 面光源 的文章

 

随机推荐