您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 毒游小行家 于 2021-9-16 12:01 编辑
UE4中怎么打光? 文/cg世界
如果你最近因为不知道如何在UE4中实现完美打光,无论下了多少功夫都丝毫找不到突破口,而陷入了深深的emo之中,别灰心,看完这篇文章,拒绝emo,让你轻松走向高光时刻!
这时候不得不提到,在UE4中对光照领域十分有研究的大神Andrew Prince(安德鲁.普林斯),他来自加利福尼亚,2008年毕业于圣莫尼卡的加州艺术学院,踏出校门的一刻,他清晰的知道自己日后的方向,于是毫不犹豫的选择进入游戏行业。
初期,在EA工作,开发一款以“征服世界”主题的第一人称类射击游戏,但因为种种原因,游戏最终未能诞生,但这丝毫没给他带来挫败感,相反他继续深造到Whitemoon Dreams任职,成为首席艺术家,为PSVR提供了 Starblood Arena,同样参与了多款知名游戏的制作,比如《生化奇兵:无限》、《旧共和国星球大战》等。
介绍完大神,接下来就要开始学习些真本事了……
首先你要知道你的作品想要一种什么氛围,那么这里的布光是首要任务,今天作者这个例子里的主要目标是保证在游戏中场景能以帧速率快速运行(主要是静态灯光),再其保证实现最终外观效果,让灯光作为场景的焦点,使用带有平铺纹理的简单形状,可以快速生成场景,从而将大部分时间花费在研究灯光上。
如果想要更深入的研究照明,一开始必不可免的需要收集大量的资料,归纳总结出两个要点:
多数情况下作者采用的场景很简单,所需要做的就是抓住一个UE4平面或立方体将它们托到场景中,然后在网格上缩放它们,并将它们用作模块部件来制作所需要的简单建筑,比如墙壁、天花板之类的……
偶尔需要用Maya制作一些相对于复杂的建筑结构,只要是参考所需的图片,能设计出自己的理想场景就行,例如带有孔的墙可以更好的获取光线,或者更改使用网格的模块化来提高速度也是不错的选择。
其实在很多虚幻场景中,凭借良好的构图和照明,实际上根本不需要成千上百个道具或灯光就能让场景变得非常出彩。 在开始制作场景之前,首先确保找到一个元素较少并且灯光比较有趣还能拥有良好构图的参考资料比较好,这样可以更好的在Unreal内部模仿类似的感觉,其次多数情况可以参考来自太阳的主光,如果需要模拟太阳或月亮作为主要光源,完全可以将其附加到大气雾中以获得明亮的效果。 某些情况下,也可以为太阳或月亮使用聚光灯,这样可以在保持光源的基础上也可以根据自己的喜好自定义。
作者大多数情况会采用极少的灯光来满足他的需求,比如,在下面场景中的灯光设置由一个主光源(定向光)、一些用于某些环境的天窗、一个用于添加天空气氛的大气雾节点,一个Box Reflection Capture、一个后期处理组成Volume和Lightmass,在一些特定情况下也可以添加点/聚光灯作为人造反射光(譬如如果生成的GI没有像所期望的那样照亮特定区域时就可以采用这种方法)。
在下面黄色的场景中,作者使用一个大网格,上面设置了“使用自发光进行静态照明”而且仅用四个聚光灯就实现了场景的最终效果。
如果还想要从网格中生成自然光,那么完全可以直接在静态网格物体中添加自发光材质,单击“使用自发光进行静态照明”选项,确保使用的光照质量包围所需要的场景,然后进行灯光烘焙,从网格生成的光量是受发光材料的强度控制的。
想要渲染的效果达到预期,作者还对此做了详细的研究,首先观察太阳的角度,如何能让阳光创造的阴影使场景变得更加有意思,这就要考验你是否仔细查看产生了多少反射光,看是否有超过一个光源进入房间,看光线如何与不同元素相互作用等因素。 总而言之,根据你的参考,如果光来自太阳,就从定向光开始,如果你的参考是来自一盏灯的光,就从聚光灯等开始。 保持最简单轻松的想法,让你的主光源按照你想要的方式工作,然后再向你的场景中添加越来越多的灯光。 以下是一些可以供参考的图片、视频,在简单的场景中具有出色的灯光效果。 以下场景来自安藤忠雄的“光之教堂”、弗雷德里克·邦帕帕的“光之主题”和内森·鲁珀特的“太阳之影”照片
,时长04:15
一般创建的图像都有一个黑白参考,如果想要在场景中添加一些颜色,让反射光围绕场景散步颜色,依旧太阳是主要光源。 比如下图,作者想要一个由太阳散发出温暖的感觉,但也要同样感觉到明亮,出于这个需求,可以选择一种灰白色的暖色(在黄色范围内),与设置20的亮度一起允许大量光线进入场景,然后光线在橙色灰泥纹理上反弹,并将颜色传播到混凝土墙上,就能生成最想要的场景效果。
在夜景中,定向光可以设置为比较冷的颜色(不饱和蓝绿色)。这样可以获得更多的夜间感觉。在这个场景中,还使用了 UE4 的体积光设置(在高度雾中找到),可以给到它更多雾夜气氛。
在作者完成场景前,会通过合成软件(例如达芬奇)打开图像生成LUT贴图。 利用达芬奇调整整体颜色、对比度、饱和度和亮度来获得最满意的效果。完成后,将LUT贴图导到UE4并将其插入后期处理卷,这一步骤和后期处理体积中相机的曝光设置是获得场景中最终外观的两个主要因素。 可以看到第一张图片没有LUT贴图,默认相机曝光设置为0,第二张图片应用了LUT贴图,曝光设置为2.75。 仅使用相机曝光和LUT贴图,就可以更全面地了解场景。
重点要看好啦!好的灯光能深入到你的场景纹理和材质,如果你的材质没有正确的粗糙度或金属值,你可能会发现自己不停的调整灯光,但还是没办法达到你所预期的效果,这时候就要考虑下自己的材质设置是否正确了,毕竟,材质设置正确,光才会反射、折射来达到你所满意的效果 ~ 这时或许就可以用到这两个网站(例:Textures.com、Megascans)来选择你能用到的纹理素材。
在拥有自发光值的两个场景中,作者只使用颜色和强度值创建了一个超级简单的自发光材质,此值可以增加也可以减少烘焙场景后生成的光量。 使用自发光作为光源只会产生静态光照,并且会被烘焙到你的光照贴图中, 这意味着角色和动态对象就不会从这些灯光接收阴影。
想要场景变得更加有意思,还有一种很实用的方法就是调整主光源的角度,旋转主光源,直到产生更丰富的阴影。
当然也可以调整天光参数,比如下面这个场景,增强了天窗,让更多人的光线就可以从开口进入…… 简而言之,光线角度和天光设置可以决定一个场景的成败。
在设置完整个场景后,就要研究Lightmass烘焙可以变得更完美的过程啦。
在UE4的设置中,调整Lightmass设置,直到可以得到满意的光线反射和喜欢的阴影。在这些设置中,将更改静态光照级别比例、间接光照反射次数、天空照明反射次数、间接光照质量和间接照明平滑度。在这些设置中不断珩磨对Lightmass烘焙,这样最终就能产生最完美的结果。 调整静态照明级别比例将使阴影变得更加精确,因为它会增加场景中包含的体积照明样本的数量。更改Num Indirect Lighting Bounces会更改间接光照的反弹次数。更改Num Sky Lighting Bounces会更改来自天窗的反弹次数。 更改间接光照质量可以提高或降低最初的质量(将其设置为与自己的静态光照级别比例一致。如果静态光照级别比例设置为0.2,间接光照质量设置为 5。如果静态光照级别比例设置为0.1,间接光照质量设置为10。如果将静态光照级别比例乘以间接光照质量,会尝试得到1的值。这是Epic Games教授的有效方法,可以很方便的在烘焙中获得最佳质量,不妨大胆尝试一下!)
如果想有一个完美的场景,在制作过程中肯定会面临不少挑战,像作者在创建这些场景时就遇到了两大难点!
非常明亮的光斑,反射光非常强烈。
有斑点、黑暗或看不见的阴影。
比如第一个问题,是通过将“间接光照强度”增加到过高的值而产生的,外观在某些情况下会起作用,会注意到非常明亮且看起来很不舒服的区域。为了解决这个问题,需要降低了主光源的间接光照强度,并在后期处理设置中提高全局光照间接照明强度或在后期处理中提高曝光值。
第二个问题最终是光照贴图分辨率的问题,有时候像静态网格物体上的光照贴图分辨率这样简单的事情可能会被忽略,而最终会需要花费更多的时间来调整设置和重新烘焙,这样做就太浪费时间了。其实这就是需要提高出问题的每个对象的光照贴图大小质量就行。 在这里必须要注意的是,因为提高光照贴图的质量不仅会增加烘焙时间,还会增加需要存储在光盘上的内存量,所以一定要小心了。
说了这么多,含泪总结了大神Andrew Prince的UE4打光采访,希望多多少少给你们带来一些帮助,必须都给我“学废”!! 如果想要了解更多的打光技巧,在推荐你们两位大神Boon Cotter、Jeremy Vickery,干货知识绝对超值!
全文完
英文原版 Andrew Prince provided a detailed breakdown of his awesome Lighting Studies in UE4: working with natural light, adjusting color and temperature, playing with the angle and much more!
provided a detailed breakdown of his awesome Lighting Studies in : working with natural light, adjusting color and temperature, playing with the angle and much more!
Introduction
Hello, My name is Andrew Prince. I am from Simi Valley, CA, currently working at Whitemoon Dreams as a Lead Artist. I graduated from The Art Institute of CA in Santa Monica back in 2008 and have been in the game industry ever since. Right out of school I landed a job at EA working on a first-person shooter that was based in the Command & Conquer universe (unfortunately it was canceled). Shortly after in 2009 I took a position at Whitemoon Dreams where we have shipped Warmachine Tactics for PC & Starblood Arena for PSVR. I have also done Freelance work creating props for Bioshock Infinite, Star Wars the Old Republic and ESPN Sports Science segments.
Goals of the Project
My UE4 Lighting Studies project was all about creating really quick scenes (10 hours or less) that would allow me to study lighting & UE4’s Lightmass more in-depth. My main goals were: 1. Make sure that if in a game the scene would run at the frame rate (mostly static lights and not out of control lightmap sizes) 2. Achieve a final look where I could use the lighting to be the focus of the scene 3. Use simple shapes with tiling textures so I could generate these scenes quickly and spend most of my time focusing on lighting.
Since I wanted to study lighting more in-depth I started off gathering a bunch of reference material which followed my 3 main points above. I gathered images from movies with great cinematography and real-life architecture that I could find on Google. I picked scenes that were simple but looked amazing due to how the lighting came into their space and/or shot. This would allow me to focus more on how to achieve the same kind of lighting and not have to model props for hours at a time. Finding scenes to mimic like these along with using simple shapes inside of UE4 were the key decisions that would allow me to achieve these scenes quickly.
Working with Maya
For the most part, the reference I chose to use had the following: flat walls (planes & cubes), pillars (boxes/cubes) and one scene had a rounded shape to the wall (cylinders). Being that these scenes were simple (modeling wise) all I had to do was grab a UE4 plane or Cube and drag them into the scene. I would then scale them on the grid and use them as modular pieces to make walls, floors, ceilings, and simple pillars/beams. I used Maya on a couple of scenes for simple beams that needed a bevel on the edge (simple cubes with a bevel). In the colorful yellow scene, I used Maya to make the modular cylinder shapes for the walls and ceiling/floor (a simple cylinder on the grid which was inverted, given some depth and cut up into ¼ size for modularity). Using these simple primitives on the grid in UE4 allowed me to change up the scene rapidly to get an interesting look and keep my focus on the lighting. In some cases, I would start off composing the scene exactly like the reference only to find myself running with one or two main points of the scene (such as a wall with holes in them for light) and changing up the area to be a bit more interesting using the modularity of the meshes for speed
Less is More
I love the saying “Less is More”. In many facets of life, this is true including scenes in Unreal. With good composition and lighting, you don’t really need an enormous scene with hundreds or thousands of props and or lights to achieve a great look. This rule of thumb is exactly what I sent out to achieve as it would help me to create the layouts quickly and allow me to spend most of my time focusing more on lighting and the settings within Lightmass. Before I even started on these scenes I made sure to find a reference that had minimal elements, interesting lighting, and good composition so that I could study them and try to mimic a similar look inside of Unreal. In most cases the references main light was from the sun which allowed bright light to fill in the scene. This created nice global illumination and shadows which helped with the composition. For this type of look, I knew a directional light would work great so that’s what I started out with. The directional light in UE4 works great if you need to simulate a sun or moon as the main light source and you can attach it to the atmospheric fog to get a bright daytime effect in the sky. In some cases, you could use a spotlight for the sun or moon so that you can keep the light source local and customize it to your liking but for these scenes, a directional light worked best for me. Most of these scenes did not take a ton of lights to achieve the look I was going for. For instance, my light setup in the scene below is composed of 1 main light source (a directional light), a skylight for some ambient light, an Atmospheric Fog node to add the atmosphere in the sky, one Box Reflection Capture, a post process volume and a lightmass importance volume. In some cases, I will add point/spot lights to act as artificial bounce lights (if the GI that was generated didn’t light up specific areas like I had hoped).
In the colorful yellow scene, I used a large mesh which had “Use Emissive for Static Lighting” set on it along with only 4 spotlights to achieve the final look in that scene. If you want to generate light from a mesh that is emissive, the option “Use Emissive for Static Lighting” works great and can sometimes generate all the lights you need for a specific area. All you need to do to make this work is add an emissive material to a static mesh, click on the option for “Use Emissive for Static Lighting”, make sure to encompass your scene with a lightmass importance volume and then bake your lights. The amount of light that gets generated from your mesh is controlled by the intensity of your emissive material.
Natural Environment Light
For the most part, the scenes I chose to create had natural light (a sun/moon) coming in from the outside. The only other scene that was different was the colorful yellow scene which was lit (in my opinion) from a LED cylindrical light that spans the entire room. It all comes back to gathering good reference and really studying it to see how the image was created. The scene doesn’t always have to mimic the reference 1-1 but to achieve a render that looks correct you should know how / why the reference looks the way it does and how light reacts with certain surfaces. For these scenes, I studied the reference for a while. I looked at the angle of the sun and how it made the scene more interesting based on the angle of the shadows it created. I looked at how much bounce lighting was being generated, I looked to see if there was more than 1 source of light coming into the room, I looked at how light interacted with the different elements etc. This, in my opinion, is the best way to achieve the type of look you are striving for. Study your reference for as long as you need before diving in and throwing lights into your scene. If your reference has light coming from the sun, start off with a directional light. If your reference has light coming from a lamp, start off with a spotlight etc. Keep it simple, to begin with, and get your main light source acting the way you would like before adding more and more lights to your scene. Here are some reference images that I found (and used) that had great lighting in a simple scene. (The scenes below are from“Church of the Light” by Tadao Ando, “Light Motif” by Frederic Bonpapa, and “Shadows of the Sun” photo by Nathan Rupert).
Temperature & Color
A lot of the images I chose to create had a reference that was in black and white. I wanted some color in my scenes. I also wanted to have the bounce light spread color around my scene to show what would happen in a real-life situation. Again, for the most part, the sun was my main light source. In the scene below, I wanted the sun to give off a warm feeling but also be bright. For this reason, I went with an off-white warmer color (in the yellow range). This along with the brightness set to 20 allowed for a lot of light to enter the scene. The light then bounces around hitting the orange stucco texture and spreads the color onto the concrete walls which then gives the final look of the scene.
In my night time scene, the directional light was set to a cooler color (desaturated blue-green). This allowed me to get more of a night time feel. In this scene, I also went with UE4’s volumetric light setting (found in the height fog) to give it more of a foggy night kind of mood.
Before I finish off a scene I will run the image through a compositing program such as Davinci Resolve to generate a LUT map. In Davinci Resolve I will play around with the overall color, the contrast, the saturation & the brightness to get the final look. Once this is completed I will export the LUT map into UE4 and plug it into the post process volume. This along with the camera’s exposure setting in the post process volume are the two main elements that I tweak to get the final look in my scenes. Here you can see a before and after shot. The first image is without the LUT map and with the default camera exposure setting at 0. The second image is with the LUT map applied and the exposure set to 2.75. As you can see with just the cameras exposure and a LUT map you can get a more final look at your scene.
Textures
In my opinion, it is true that good lighting can only go as far as your scenes textures and materials. If your materials don’t have the correct roughness or metallic values, you might find yourself tweaking your lighting non-stop to gain a feel to your scene that you just aren’t able to achieve. If your materials are set up correctly light will bounce, reflect and refract the way it should thus giving you a great look in a shorter amount of time. Since I wanted these scenes to be fast and I didn’t want to spend a long-time modeling or texturing objects I chose to utilize Textures.com and Megascans for the textures you see in my scenes. These came pre-made with all the correct maps (Albedo, Normals, Height, AO, Roughness and Metallic Maps). For my scenes, I chose a couple simple concretes and a stucco texture which is what was used in all the scenes. With textures.com you will need to set up your own material within UE4 but with Megascans, you can use their Bridge app to export your textures and it will set up a material for you. This made creating these scenes really quick.
In the two scenes that I had the emissive value generate light. I created a super simplistic emissive material using just a color and an intensity value. As mentioned above, boosting this value will increase or decrease the amount of light that is generated after you bake your scene. Using emissive as light sources will only generate static lighting and it will be baked into your lightmaps. This means that characters and dynamic objects will not receive shadows from these lights. This was not my concern in this project, so it worked out well for my scenes.
Shadows & Light AngleAnother way I got my scene to be more interesting was to play around with the angle of the main light source. I would rotate the main light source in an interesting way until I generated more interesting shadows. This made my scenes look a lot better. Here is the same scene with a good and bad angle from the main light source.
I also generated more interesting light and shadows by playing with the skylight parameters. Here in this scene, I boosted my skylight to allow for more light to enter from the openings. Here you can see the difference when the setting is higher and lower.
In the end, the light angle and skylight settings can make or break a scene. I noticed this right off the bat in the reference I gathered. Almost all the images had really interesting light and shadows. Baking
After I set up my entire scene I will start playing around with what makes Lightmass bakes turn into magic. In my world settings in UE4, I would start to tweak the Lightmass settings until I got the light bouncing correctly and the shadows the way I liked. In these settings I would change the Static Lighting Level Scale, Num of Indirect Lighting Bounces, Num Sky Lighting Bounces, Indirect Lighting Quality & Indirect Lighting Smoothness. Honing in these settings does wonders to Lightmass bakes. Adjusting the Static Lighting Level Scale will allow your shadows to become more precise as it will increase the number of volume lighting samples contained in your scene. Changing the Num Indirect Lighting Bounces changes how many bounces your indirect lighting will have. Changing the Num Sky Lighting Bounces changes the number of bounces that come from your skylight. Changing the Indirect Lighting Quality will raise or lower the quality of your indirect lighting (I set this in line with my Static Lighting Level Scale. If my Static Lighting Level Scale is set to 0.2 I set my Indirect Lighting Quality to 5. If my static Lighting Level Scale is set to 0.1 I set my Indirect Lighting Quality to 10. I try to get a value of 1 If I multiply my Static Lighting Level Scale by my Indirect Lighting Quality. This was taught by Epic Games in order to get the best quality out of your bakes). Here you can see the difference when you leave these settings to default VS changing them to get a more precise look and better quality.
ChallengesA couple of the main problems that I ran into when creating these scenes were: 1. Really bright splotches of light where the bounce lighting was really intense2. Splotchy, dark or unseen shadows 3. Being able to spot the modular pieces after a bake. My first problem (really bright splotches of light where the bounce lighting was really intense) would get created simply from increasing my main light sources “Indirect Lighting Intensity” to too high of a value. The look would in some instances work but I would notice areas that were extremely bright and did not look right. In order to combat this, I lowered the Indirect Lighting Intensity way down on my main light source and would either raise the Global Illumination Indirect Lighting Intensity in the post process settings or raise the exposure value in the post process. I really had to play with all the tools that I had in the bag when it came to solving problems such as this.
The second problem I would have (splotchy, dark or unseen shadows) ended up being the lightmap resolution. Sometimes something as easy as the lightmap resolution on your static meshes can be overlooked and you end up spending more time tweaking settings and re-baking than noticing a simple solution. This simply required raising the lightmap size for each object that was causing a problem. I had to be careful here because raising the quality of a lightmap will not only raise the baking times but will also increase the amount of memory that would need to be stored on the disc should this be going into a game.
The last problem that I encountered (being able to spot the modular pieces after a bake) was corrected quickly by lowering the Static Lighting level Scale in the lightmass settings before running the final light bake. Sometimes I have encountered this problem because the lightmap UVs on an object are not snapped to the grid and or having overlapping lightmap UVs. Once these were checked I found out it was just the quality of the light bake and its settings. Raising the lightmap resolution in conjunction with lowering the Static Lighting Level Scale can help hide these as well.
ConclusionI hope that gave a good insight into how I created these scenes and I you liked the renders. You can view more images from these studies here. Finally, I would like to give a shout out to two amazing lighting artists that I gained a significant amount of knowledge from by spending a great deal of time studying and listening to interviews and or tutorials with them. These two guys are Boon Cotter and Jeremy Vickery. I suggest anyone who wants to learn lighting techniques to look these guys up and watch everything you can where they share their knowledge if you would like to get more into lighting.
END
|