The Sun Shafts image effect simulates the radial light scattering (also known as the "god ray" effect) that arises when a very bright light source is partly obscured.
太阳射线图像特效模拟当很亮的光源中一部分被遮挡时所产生的径向光散射效果(也称为"God Ray"效果)。
As with the other image effects, this effect is only available in Unity Pro and you must have the Pro Standard Assets installed before it becomes available
和其他图像特效一样,该特效只能在Unity Pro上进行使用,并且在使用之前必须安装Pro Standard Assets。
Example of the Sun Shafts effect
太阳射线特效例子
Properties 属性
Rely on Z Buffer 依赖Z缓存 | This option can be used when no depth textures are available or they are too expensive to calculate (eg, in forward rendering with a large number of objects). Note that if this option is disabled then Sun Shafts must be the very first image effect applied to the camera. 这个选项在没有深度纹理可用或计算深度纹理非常昂贵时使用(比如,在前向渲染中,使用大量物体模型)。切记,如果该选项被禁止,那么太阳射线特效必须是相机上的首先被处理的图像特效。 |
Resolution 分辨率 | The resolution at which the shafts are generated. Lower resolutions are faster to calculate and create softer results. 产生射线图像的分辨率。较低的分辨率可以带来更快的计算与更柔和的效果。 |
Blend Mode 混合模式 | Chose between the softer Screen mode and the simpler Add mode 在柔和的屏幕模式与简单的添加模式之间进行选取. |
Sun Transform 太阳变换 | The transform of the light source that casts the Sun Shafts. Only the position is significant. 用来投射太阳射线的光源的变换,其中最重要的位置。 |
Center on ... 居中 | Within the editor, position the Sun Transform object at the center of the game view camera. 在编辑时,将太阳变换物体放置于游戏相机的中间。 |
Shafts color 射线颜色 | The tint color of the shafts. 射线的颜色 |
Distance falloff 退化距离 | The degree to which the shafts' brightness diminishes with distance from the Sun Transform object. 亮度随距离太阳变换物体远近的消减程度 |
Blur size 模糊尺寸 | The radius over which pixel colours are combined during blurring. 在模糊时的颜色模糊半径 |
Blur iterations 模糊迭代 | The number of repetitions of the blur operation. More iterations will give smoother blurring but each has a cost in processing time 模糊处理的重复次数。迭代次数越多模糊会更平滑,但每次处理都需要一定的成本 |
Intensity 亮度 | The brightness of the generated shafts 生成射线的亮度. |
Use alpha mask 使用alpha 掩膜 | Defines how much the alpha channel of the color buffer should be used when generating Sun Shafts. This is useful when your skybox has a proper alpha channel that defines a mask (eg, for clouds blocking the sun shafts). 当生成太阳射线时决定使用alpha通道的程度。这在您的天空盒使用合适的alpha通道时会有帮助。(比如,阻挡太阳射线的云彩) |
Blend Modes: Add and Screen 混合模式:添加模式和屏幕模式
Blend modes determine the way that two images will be combined when overlaid. Each pixel from the base image is combined mathematically with the pixel in the corresponding position in the overlay image. Two blend modes are available for Unity image effects, Add and Screen.
混合模式决定了两张图片重叠时的合并方式。基图像的每个像素颜色会与覆盖图像相应位置像素的颜色通过数学公式相结合。在Unity中可用两个混合模式,添加模式和屏幕模式。
Add Mode 添加模式
When the images are blended in Add mode, the values of the color channels (red, green and blue) are simply added together and clamped to the maximum value of 1. The overall effect is that areas of each image that aren't especially bright can easily blend to maximum brightness in the result. The final image tends to lose color and detail and so Add mode is useful when a dazzling "white out" effect is required.
当图像通过添加模式进行混合时,各个颜色通道的值(红色、绿色和蓝色三通道)分别简单的相加在一起,并保证最大值不超过1。每个图像中不是特别明亮的地方在混合后容易接近最大亮度,从而最终图像往往会失去颜色和细节,因此添加模式适合于需要耀眼"白色"效果的场景。
Screen Mode 屏幕模式
Screen mode is so named because it simulates the effect of projecting the two source images onto a white screen simultaneously. Each color channel is combined separately but identically to the others. Firstly, the channel values of the two source pixels are inverted (ie, subtracted from 1). Then, the two inverted values are multiplied together and the result is inverted. The result is brighter than either of the two source pixels but it will be at maximum brightness only if one of the source colors was also. The overall effect is that more color variation and detail from the source images is preserved, leading to a gentler effect than Add mode.
之所以叫屏幕模式是因为它模拟的是同时将两个源图像投射到白色的屏幕而的产生的效果。每个颜色通道分别组合但相互相等。首先,两个源图像的通道值互相“倒置”(即被1减);然后,然后,两个“倒置”值相乘,然后再将结果“倒置”。结果要比两个源像素的亮度高,但其结果也会达到最大亮度当且仅当有一个源图像达到最大亮度。总体效果上比添加模式会保留更多的颜色变化及源图像中的细节。
Hardware support 硬件支持
This effect requires a graphics card with pixel shaders (2.0) or OpenGL ES 2.0. Additionally, depth texture support is required. PC: NVIDIA cards since 2004 (GeForce 6), AMD cards since 2004 (Radeon 9500), Intel cards since 2006 (GMA X3000); Mobile: OpenGL ES 2.0 with depth texture support; Consoles: Xbox 360, PS3.
这个特效需要显卡拥有像素着色器(2.0)或者OpenGL ES 2.0。台式机:2004年以后的NVIDIA显卡(GeForce6),2004年以后的AMD显卡(Radeon 9500),2006年以后的Intel卡(GMA X3000);移动设备:OpenGL ES 2.0;控制台: Xbox 360、 PS3。
All image effects automatically disable themselves when they can not run on end-users graphics card.
所有图像特效如果无法在用户显卡上运行时将会自动被关闭。