游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

光照设计基础:在游戏中使用对比手法

发布时间:2013-07-22 15:40:53 Tags:,,,,

作者:Steve Theodore

上个月,我们开始讨论游戏中的使用和滥用光照问题。光照是我们巧妙操纵玩家情绪的最强大的工具。这个月,我们将通过分析对比在光照设计中的作用,以完成对光照设计的探讨。

对比

在上一篇文章(《Let There Be Light: Colored Light》2005年3月)中,我在评论场景和活动中提到光照的颜色选择。如果说有色光照只是作为一种暗示或提点,那么对比就是赤裸裸的声明和通知。

毕竟,对比也是我们的感知方式。我们知道球体和圆板的区别就是因为我们看到曲面的阴影形状。没有高光和阴影的对比,单纯的颜色太抽象了。颜色可以唤起情绪,但没有阴影,颜色就无法表现有形的物品。因此,在给场景打光照时,我们在使用对比时所拥有的自由并不如在调整颜色时的多。

在戏剧和电影光照中,对比被表示为主-辅率,即主光源与辅光源的相对亮度。主光源就是光的主要来源,如太阳、月亮或房间里的光。辅光源是次要光的来源,与主光源相差90度,通常用于过渡主体的主要形态。高主-辅率产生强烈的对比,通常暗示着紧张或戏剧性。相反地,低主-辅率的光照充足,色调更均匀。主-辅率与总体亮度是不同的。高亮度下的场景在总体上比低亮度下的场景更暗。在传统的电影拍摄中,设计光照对比的严谨几乎上升到科学的程度。即使游戏与电影是相当不同的媒体,但在设计游戏的光照组合时借鉴后者累积了一百年的经验仍是一个良好的开端。

主-辅率的选择通常取决于既定的惯例。例如,电视剧和访谈节目通常使用的主-辅率是2:1或3:1。这么低的不会产生压抑的基调,而是让人感到舒适、愉快。无独有偶,低对比光照也可以使演员的皮肤状态显得更好、更有精神。然而,戏剧演出通常在4:1的主-辅率下拍摄,以便形成强烈的明暗对比,增加演出的戏剧性紧张感。这种光照还能突出演员的面部轮廓,使观众更容易读懂演员的表情。超过7:1或8:1的率通常运用在恐怖片和动作片中。悲剧片或风格化的动作场面甚至可能采用高达20:1的主-辅率。

主-辅率的传统用法虽然可以作为游戏光照设计的参考,但并没有(也不应该)提供准确的数值。真实世界的光照绝对比我们粗糙的数字近似值更加微妙和复杂。在后者中,我们不必担心不必要的反光或阴影,并且我们可以选择是否让光有间隔地衰退。但即使你不能指望数字,你仍然需要注意那些惯例对受众反应的影响。你确实可以反其道而行,但如果你没有明确的理由,最好不要违反那些惯例。

光塑造空间

主-辅率并不能说明所有可能的光照情况。电影光照的标准专注于塑造演员的外表,但游戏光照基本上强调的是定义空间,而不是突出角色。制作特殊的场景时必须特别谨慎。缺少某些电影内的线索,如氛围效果、景深等,玩家可能很难理解不熟悉的场景。最明智的做法通常是用适中的对比度(不超过3:1)来做实验。远低于这个值,玩家将很难感知空间的3D轮廓(游戏邦注:但具有非常强烈的色彩对比度的卡通风格场景是例外)。另一方面,在古典的悲剧风格电影中,太高的比对度往往会彻底分解场景,从而把它变成光影的抽象图形。

室外光

当场景受绝对控制时,特别是采用人照光的封闭空间,你可以根据游戏所需的戏剧性设置你的对比度,从而产生或扩散画面张力。然而,室外光照就更麻烦了。

大多数开发者都知道在用于游戏中的24比特的颜色空间造成的效果很好,所以大多数人其实不能清楚地看出所有1670种可能的RGB颜色。确实,但这只是一部分原因。我们都知道RGB(255,255,255)是白色。但白纸的白和雪地的白是不同的。从纯物理的角度说,雪可能在阳光下反射光300到400次,远远超过白纸。当然,我们知道我们的显示器和电视屏幕不会像手电筒那么亮,更加比不上太阳(不是坏事,当你回想我们不健康的广告用词来产生花哨的效果时)。如何循环这少少的256级亮度,来表现从昏暗的矿洞到星云闪耀的宇宙这么大范围的场景?

眼见不实?

幸运的是,我们的图像(照片和影片)在这么有限的亮度下也管用,因为我们的眼睛能够重新校准对光影的知觉。在台灯下,我们可以很轻易地看到中度阴影,但白天时就看不到了。类似地,在白天时感觉不到的微光在黑夜里就很容易看清。我们大部分人都能够辨别黑白之间的100到200种阴影。因为白色的扩散和聚拢很密集,所以我们的大脑基本上能够用那一两百种阴影变化来覆盖从暗到明的范围。因为我们的眼睛能够能够感知大范围的强度变化,所以从生理学上说,我们能够通过显示器画面或打印出来的图片想象出“真实的”的情境,即使当它们以非常有限的绝对强度聚集时也一样。

这看似有意思的小事,但事实上,它对于有效地对比度管理是非常重要的。我们的重新校准能力告诉我们,图像中的对比度的分布代表光源的强度。这其实是一个悖论。用强光塑造场景应该意味着,每个表面都反射更多光给眼睛,这样你可能就看不到图像了。不过,我们的生理对比过滤器必须延伸我们有限的视觉色盘,以涵盖强烈的高光和和稍强的环境色。即使按绝对值算,低色调确实更亮,那种增强对强度的大范围扩散的影响也不明显。低色调看起来更暗,即使它们反射得更多。出于明显的理由,我们本能地用对比来代表场景中的光强度。强烈的对比意味意光源密集,而中等色高的平均分布则产生更柔和的光照效果。

contrast_fig1-2b(from gamasutra)

contrast_fig1-2b(from gamasutra)

我们以图1和图2为例。在图1中,明亮的天空和阴暗的房子之间的强烈对比,让我们下意识地以为天空比砖块和石头亮上几百倍。相反地,图2中的同样程度的色调却让我们想到阴天灰蒙蒙的环境光;这种对比太温和了,以至于白灰抹的墙看起来脏乎乎的,但事实上它们几乎上一届图1中的明媚天空具有同样的亮度值。从直方图(图3和图4)中可以看出来,更“明亮”的图片其实使用的暗色更多。

contrast_fig3-4b(from gamasutra)

contrast_fig3-4b(from gamasutra)

对比的复杂作用对美工来说,既是福也是祸。正如这两幅画所表示的,仅通过操纵我们对强度和对比的期待,光照条件就可以变化出无数令人信服的效果。同时,我们倾向于把对比当成强度,这就多少限制了我们调整游戏场景的方式。进而,当为了贴近现实,我们需要构成和情绪冲突产生一些棘手的问题时,我们就面临一些棘手的问题。当设计内景的光照时,你可以采取一些欺骗性手段,使用任何能满足你要求的对比方案。然而,如果你使用自然光,你就放弃了大量的自由—-当然,如果你满足于在大多数游戏中使用永远昏暗的阴天来充当室外光,那就无所谓了。

室外光

室外光的强度变化也让贴图美工感到困扰。想像以下情景:你要求贴图美工制作一个砖块的贴图。自然而然地,你希望它包含所有微妙的小细节,如裂缝、灰泥等。为了包含这些细节,贴图美工使用大部分RGB来画绘制贴图;裂缝接近黑色,灰泥接近白色等。单看贴图,你觉得非常棒。当你在游戏中以中度光渲染墙体材质时,看起来仍然很好。然后你把它用于室外光,一个明显的问题产生了:灰泥与天空中的云一样白,但云本应该比灰泥亮上好几倍才对(见图5)。

contrast_fig5b(from gamasutra)

contrast_fig5b(from gamasutra)

既要保留原贴图上的细节,又要体现场景的光照,这可不好办。你可以复制两份贴图,使外层更暗。这么做太费内存,且要损失外层的细节,但能让看者感觉到这就是自然光下的场景。但如果贴图内存充足,你也许可以重复使用原贴图,但接受最后图像中的对比会破坏室外光的幻觉的结果。许多线下渲染器(和很少游戏引擎)允许你之后再降低贴图亮度 (或者,如果你特别幸运有后渲染图像灰度校正)来欺骗眼睛的感知行为。因为大多数现代即时引擎的不足,你不得不有所牺牲,要么是内存,要么是光照的逼真度。但如果你已经得到程序员的支持,那么你可以使用一个技巧,即在材料系统中添加一个暗调系数;你可以调整原贴图而不必复制它。尽管这样,基本的问题还是存在:虽然你可以让你的想像力在室内场景中奔跑,但自然的室外光仍是一个要求很高的介质。

光照与情绪

但愿,日新月异的技术可以至少减轻复制自然光照的负担。对于捕捉光的微妙,我们当中少有人能与Vermeer相提并论,甚至更少人拥有能够良好地处理动态光照的游戏引擎。不过,技术仍在进步。在学术圈中,已经产生了一些出色的作品(特别是去年的《蜘蛛侠2》和《黑客帝国:重装上阵》)。同时,Masaki Kawase的基于图像的光照DEMO表明现在可以到达的程度,虽然在控制严格的情况下。但对于我们大部分人,距离我们依赖技术模拟光的真实行为还有很长的路要走。虽然困难,但逼真的光照效果不是不可能实现的。《ICO》证明了,即使是PS2也可以借助精彩的故事来克服光照的复杂问题。毕竟,光照设计的目标不是不带感情地模仿照片,而是在游戏中激发一种情绪,创造一种氛围,把玩家传送到我们为其构建的世界中。(本文为游戏邦/gamerboom.com编译,拒绝任何不保留版权的转载,如需转载请联系:游戏邦

Lighting design fundamentals: using contrast in your game

By Steve Theodore

Last month we started looking at the uses and abuses of lighting for games. It’s worth repeating that lighting is our most powerful tool for subtly manipulating a player’s emotions. This month we’re going to round off the discussion of lighting by going to the dark side, literally, by asking what is the role of contrasts in lighting design?

3, 2, 1 Contrast!

The last column (“Let There Be Light: Colored Light,” March 2005) alluded to the way color choices in lighting can act as a kind of running commentary on the scenes and actions they illuminate. If colored lighting is all about suggestion or implication, contrast is all about bald statements and information.

Contrast, after all, is written right into the way we perceive forms. We know the difference between a sphere and a circular plate because we see gradations of shade on the curved surface. Without that contrast of highlight and shadow, color alone ends up as a set of abstractions. Color can evoke a mood, but without the definition provided by shading, it can’t embody concrete things. For this reason we have a lot less freedom in how we use contrast than how we tweak color when we light scenes.

In theatrical and film lighting, contrast is expressed as the the key-fill ratio, the relative brightness of the key and fill lights. The key light represents the major source of light, such as the sun, moon, or the main room lighting. The fill light, the secondary light source, is positioned about 90 degrees away from the key light and is intended to bring the major forms of the subject into relief. High key-fill ratios produce strong contrasts, which generally suggest tension or drama. Low ratios, on the other hand, produce more even lighting and a gentler distribution of tones. The key-fill ratio is distinct from the overall brightness of the scene. High ratio scenes are typically darker overall than those with lower ratios. In traditional cinematography, contrast in lighting design has been refined to almost scientific rigor. Even though our medium is quite different, the accumulated experience of a hundred years of film and theatrical lighting is an excellent starting point when planning a lighting scheme.

The choice of key-fill ratios is usually governed by well-established conventions. TV comedies and talk shows, for example, typically use a ratio of 2:1 or 3:1. A low ratio like this produces no ominous undertones and creates even, pleasant gradations in tone. Not coincidentally, low contrast lighting also flatters the actors’ complexions, de-emphasizing wrinkles and bulges. Dramatic shows, however, us u ally shoot at a key-fill ratio of around 4:1. This creates stronger shading, injecting some graphic tension into the composition. It also emphasizes the geometry of the actors’ faces, making it easier to read their expressions. Ratios above 7:1 or 8:1 are usually reserved for thrillers and action movies. A brooding film noir shot or a stylish Matrix action scene might go as high as 20:1.

The conventional language of key-fill ratios is a good starting place for planning game lighting, but doesn’t (and shouldn’t) provide precise numbers. Real-world lighting is infinitely more subtle and complex than our crude digital approximation, where we don’t have to worry about unwanted bounce light or shadows, and we can choose whether to let our lights fall off with distance. But even if you can’t rely on the numbers, you do need to be aware of how those conventions will shape the audience’s reactions. You can violate those expectations, but it’s not wise to do so without a clear reason in mind.

Light Defines Space

The list of key-fill ratios doesn’t cover all possible lighting scenarios. The canon of cinematic lighting focuses on modulating the appearance of the actors, but a great deal of game lighting is really about defining spaces rather than spotlighting characters. Oddly shaped or unusually constructed spaces need to be lit with particular care. Lacking some of cinema’s built-in cues, like atmospheric effects, depth of field, and shape-emphasizing radiosity, it can be hard for players to decipher an unfamiliar setting. It’s usually wisest to begin experimenting with a moderate contrast ratio, in the region of 3:1. Go much lower than that and it becomes difficult to perceive the 3D contours of a space (although cartoonish environments with very strong color contrasts are an exception). On the other hand, very high contrast ratios tend to disassemble the scene altogether, reducing it to an abstract pattern of light and darkness in the classic film noir style.

Sunny Side Up

When you have complete control of the scene, especially in enclosed spaces with artificial light, you can base your contrast scheme on the dramatic needs of the game, using the contrast to create or diffuse graphic tension. Lighting for outdoor scenes, however, is a much trickier business.

Most developers know that the 2 4-bit color space used in games is so fine that most people can’t actually see all 16 .7 million possible RGB colors distinctly. That’s true, but it’s only part of the story. We all know that an RGB value of 25 5, 255, 255 means white. But the white of a piece of paper and the white of a snowy field are hardly the same. From the standpoint of pure physics, snow on a sunny day may reflect 300 or 400 times more light than that sheet of paper. Of course, we know our monitors and TV screens aren’t as bright as a kid’s flashlight, much less the sun (not a bad thing, when you recall our unhealthy ad diction to garish sprite effects). How c an we recycle those measly 256 levels of brightness to represent everything from the mines of Moria to the blazing nebulas of distant galaxies?

Doth My Eyes Deceive Me?

Luckily for us, our pictures (and photographs and movies) work within such a limited range because our eyes are programmed to recalibrate their perceptions of light and dark. Mid-tone shadings that would be easily distinguishable under a reading lamp are blanked out in the bright light of day. Faint glimmers of light that would be invisible in daylight are easy to navigate by at night. Most of us are capable of distinguishing between 100 and 200 shades between black and white. As white grows or shrinks in intensity, our brains basically stretch those hundred or so shades to cover the whole range from darkness to lightness. Since our eyes are already doing a great deal to compress the huge range of intensity variations, we’re physiologically primed to accept monitor images or printed pictures as “real” even when they cluster in a very narrow range of absolute intensities.

This might seem like just interesting trivia, but in fact it’s critical for effective contrast management. Our ability to recalibrate teaches us that the distribution of contrast in the image is an indication of the strength of the light source(s). T his is actually something of a paradox. Bathing a scene with intense light ought to mean that every surface is reflecting more back to the eye, and so you might expect the image to wash out. Our biological contrast filter, though, has to stretch our limited visual palette to cover the intense highlights as well as the somewhat elevated ambient colors. Even though the low tones really are brighter in absolute terms, that increase is insignificant against the vastly expanded scale of intensities. Tones in the low end of the scale will seem darker even as they reflect more. For obvious reasons, therefore, we instinctively see contrast as a proxy for the intensity of light in a scene. Sharp contrasts suggest intense light sources while an even distribution of mid-tones implies a softer light.

For a perfect example of this principle, take a look at the two Vermeer paintings in Figures 1 and 2. The sharp contrast between the glaring sky and darkened houses in Figure 1 subliminally reminds us that the sky should really be hundreds of times brighter than the bricks and stones. Conversely, the very level tonal range of Figure 2 recalls the dim, ambient light of an overcast day; the contrasts are so gentle that the whitewashed walls seem dingy, even though they are almost exactly the same luminosity value as the bright sky in the first picture. As you can see from the histograms (Figures 3 and 4), the “brighter” image actually uses far more dark colors.

The complex role of contrast is both a blessing and a curse for artists. As the two paintings demonstrate, it’s possible to suggest enormous variations in light conditions convincingly simply by manipulating our expectations about contrast and intensity. At the same time, our tendency to read contrast as an indication of intensity places some limitations on how much we can tweak it in game scenes. This, in turn, can create some tricky problems when the needs of composition and mood conflict with the demands of realism. When designing lighting for an indoor scene, you can cheat your way to whatever contrast scheme suits your needs. If you invoke natural light, however, you give up a good deal of freedom — unless, of course, you’re content with the perpetual dreary overcast that passes for outdoor lighting in most games.

Take It Outside

The variable intensity of outdoor lighting also places a large strain on texture artists. Imagine the following scenario: You ask a texture artist for a brick texture. Naturally, you want it to contain all sorts of subtle little details, cracks, stains, and so on. In order to include those, the texture artist uses most of the RGB range in painting the texture; the cracks are down near black, the mortar up near white and so on. You look at the texture in isolation, it’s great. You render the texture in the game on a moderately lit interior wall and again, it looks great. Then you try it outdoors and run into an obvious problem: The white in that mortar is as white as the clouds in your skybox, which should be several dozen times brighter (see Figure 5).

There’s no easy way to preserve both the detail in the original texture and the lighting of the scene. You could make two copies of the texture and dim the exterior version. Doing so costs memory and throws away some of the detail data in the dimmed version but retains the subliminal sense of natural light. If texture memory is at a premium, though, you may have to reuse the original version of the texture, accepting that the even contrast in the final image will destroy the illusion of outdoor lighting. Many offline renderers (and a scant handful of game engines) will allow you to apply a post-process darkening to the texture (or, if you’re particularly lucky a post-render gamma correction) that mimics the adaptive behavior of the eye. With most contemporary real-time engines, you’ll have to sacrifice something, either memory or lighting fidelity. A useful trick, if you have support from your coders, is to add a dimming coefficient to the material system; you can tune down the original texture without having to duplicate it. Nevertheless, the basic problem remains: While you can let your imagination run wild in indoor scenes, naturalistic, outdoor lighting is a very demanding medium.

Lighten the Mood

Hopefully, up-and-coming technologies will at least lighten the burden of coping with naturalistic lighting. Few of us can match Vermeer’s eye for the subtleties of light—but even fewer of us have game engines that can handle dynamic over-brightening very well, much less true HDR rendering. Progress is being made, though. Some remarkable work is being done in academia, and in offline rendering (notably last year’s Spider-Man 2 and The Matrix Reloaded). In the meantime, Masaki Kawase’s image-based lighting demo shows how much can be achieved in real time today, albeit under tightly controlled circumstances. For most of us, though, it will be quite some time before we can rely on technology to simulate the real behavior of light. While difficult, immersive lighting is far from impossible. ICO proved that even a PS2 can marshal the intricacies of light in the service of story-telling. The point, after all, isn’t to create a soulless simulation of photons bouncing around, it’s to set a mood, create an atmosphere, and to transport players into the worlds we build for them.(source:gamasutra)


上一篇:

下一篇: