【Unity灯光与渲染技术】LightProbes灯光探测器实践

Light Probes实现操作

关于反射探头和屏幕空间反射的资料相对较少,暂时还没有深入理解的需求。而在论文中需要深入Light Probes相关知识点,所以今天就用一下午实现了一下具体的过程。试试才发现有许多细节是需要注意的。下图是工程的基本构造,其中左上方是蓝色的光源,右方中部是红色的光源,左方下部是黄色的光源。三种不同颜色的光源相互作用,在球体身上显示不同部分的光照信息。在烘焙之前,Light Probes并不具备光照亮度和颜色的信息,但是在进行烘焙以后,所有的Light Probes都分配了不同的光照亮度和颜色。此时关闭灯光,场景中的光照信息仍然存在Light Probes之中,为主体提供光源。实现动态的全局光照。


 

测试Light Probe

上图中主要包含了三部分内容:

1.简单的场景:一个球和地板

2.Light Probe Group组件

3.三个不同颜色的灯光

实现的效果是当小球下落的过程中,关闭实时灯光仍然可以看见小球上面变化的光照,如下面三张图片所示:


  

 

上面三张图标均是在关闭光源后以烘焙贴图照亮的结果。上左侧图显示的是在蓝色光源处,其光照信息是周围具有蓝色灯光信息的Light Probe 提供的光照。下面三幅图片分别对应上面三张不同颜色亮度的球体所在的位置。我们可以看到下图中球体所在的地方有几条黄色线条围城的三棱锥,而球体则受构成这三棱锥的四个Light Probes的光照信息影响。不管物体移动或者旋转,其光源仍然会自然地显示在物体上。达到了实时全局光照的效果。


  

PROBE功能仍然在不断完善优化,如果未来有需求还可以了解相关的内容。

1.Tetrahedron based light probe interpolation(基于四面体的Light Probe插值)

2.Unity Light Probe自动均匀分布方

 

下面提一下实践过程中值得注意的是烘焙的操作流程,涉及到灯光开关、Baking模式的选择以及Lighting Scene面板Atuo选项是否开启。

灯光模式

 

首先要明确的是,三维系统中默认设置的灯光模式是实时的,如果我们要通过灯光贴图这种方式降低消耗就需要在游戏中关闭实时灯光,所以要对灯光模式进行设置。而烘焙贴图的过程中需要实时灯光提供光照信息,所以在烘焙过程中要保证灯光的勾选状态。

Baking模式

 

在灯光的Light属性面板中有一行Baking属性,其有三个模式分别是Realtime、Baking、Mixed。Unity里每盏灯光默认的烘焙模式都是”Realtime”,这代表这些灯光仍然会照亮你的场景,Unity的预计算GI系统会处理间接光。

如何设置烘焙模式是”Baked”,那么这些灯光将会透过Unity的烘焙GI系统处理直接光源和间接光源,产生出来的光照贴图一旦贴到场景上在执行期间是不能改变的。如果需要实现光照贴图的效果就选择此模式。

选择烘焙模式为”Mixed”的话,场景内的静态对象会被烘焙GI拿去做计算,然而,不像”Baked”模式,混合模式的灯光仍会继续运算即时光源到非静态对象上,这对于你想把静态环境烘成光照贴图,但同时又希望同样一盏灯能为会动的角色计算阴影很有帮助。

 

Atuo选项

当我们需要即时看到连续改变的烘焙效果时,需要开启AUTO选项。也可以通过点击build来进行一次的烘焙效果。


 

 

 

Unity light probes are an important part of every scene. It provide the transmission of direct, indirect and reflected light from light sources in mixed and baked modes to dynamic objects. The accuracy of lighting dynamic objects on the scene largely depends on how correctly the light probes are placed. Magic Light Probes is an editor extension that is designed to help you arrange your light probes in the automatic mode as quickly and correctly as possible. The main goal of the tool is to automatically install the probes exactly where they are needed – shadows borders, sharp changes in the color of textures, transitions from well-lit areas to dimly lit, corners and intersections of geometry, edges of geometry, ledges, breaks, sharp descents, two-sided geometry (to prevent leaks through walls, floors and ceilings). In addition, the modes of uniform filling of the entire volume and vertical duplication for particularly difficult cases are supported. This tool can guarantee that: – No probes will be located inside the geometry, no matter how complex it is, convex or concave. This is very important, because even in the simplest case of manually arranging probes by simple duplication, you will inevitably encounter probes within the geometry. – With high accuracy, light probes will be installed at corners and intersections of the geometry. In corners, as a rule, the light intensity is lower, therefore, in order to properly illuminate a dynamic object when approaching such places, it is necessary to install probes there. – Depending on the settings, the system will try to place the probes in the most contrasting places (errors are not excluded) It is guaranteed to be pretty fast in most cases.In addition to email and the forum, the Discord channel is available to you, where you can receive answers to any questions in real time. Features: – Automatically check for updates – Workflow selection Simple (quick and easy); Advanced (slower and more accurate) – Quick editing o
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值