当前位置:网站首页>[TA-Frost Wolf_may-"Hundred Talents Project"] Graphics 4.3 Real-time Shadow Introduction
[TA-Frost Wolf_may-"Hundred Talents Project"] Graphics 4.3 Real-time Shadow Introduction
2022-08-05 03:25:00 【zczplus】
4.3.1 Real-time shadow technology based on pictures
The pictures in it mean:Render shadows to images
平面投影阴影
- 根据光的方向,Projects each vertex of the object onto the flat ground.
- 数学原理:相似三角形
- 缺点:
- 只能投影到平面;
- 投影物体必须在光线和平面之间;

投影阴影
- 为每个阴影投影体设置一个相机
- 把阴影投影体渲染到阴影纹理中
- 渲染阴影接收者,并且与阴影纹理进行混合

Unity中的实现
- Projector组件:
- 可以设置它的参数生成一个视锥体
- Projector会使用提供给它的材质,Draws all objects inside the frustum
- 使用Render Texture生成阴影映射图,Draw the shadow cast volume into the shadow texture
- 给Project设置物体和阴影映射图混合的材质
阴影映射

On the right is the depth map,Black is close,White is the principle
- First get a depth map of the light position
- Each pixel is processed at the viewing angle position
- Convert the coordinates of the current position to the depth map obtained from the light position and compare the size
- If it is greater than the previous depth value,Indicates the farther away from the light source,Description is blocked,thus forming a shadow

The third step is the process of comparison and comparison mentioned above;
4.3.2 Real-time shadow optimization
Shadow mapping problem – 自阴影
由于阴影映射的分辨率有限,Discrete sampling points and numerical deviations can cause incorrect shadowing.This is self-shadowing,也被称为Z-Fighting或者阴影粉刺(Surface Acne)
解决方法:当比较深度时,为了避免表面自阴影,需要设置容错阈值:
- 深度偏移(Depth Bias)
- 法线偏移(Normal Bias)
But if the depth cheap is set too large,会导致漏光现象.即阴影与投影者之间发生脱节,也叫做Peter Panning问题.
Offset optimization
The left half of the figure below explains it in great detail,
Points picked during sampling may be red points,as the texel depth in the shadow map,但是在ViewThe dark blue dots during sampling clearly correspond to the same line segment,But it is deeper in comparison,So it will be regarded as a shadow.The solution is to apply an offset,Try to respond correctly to the context.
Unity中的Offset optimization
- Shadow Caster 阶段基于顶点的Normal Bias;
- 在Shadow Caster阶段, 让遮蔽物进行反向偏移;
优点:性能高
Shadow mapping problem ——走样
View shadow mapping from the process of signal reconstruction:
- 初始采样:渲染阴影映射;
- 重采样:从摄像机视角对采样信号(阴影映射)重采样;
Aliasing problems occur in both stages.
- 阴影映射在世界空间均匀分配;
- 视锥体内物体经过透视投影后,近大远小,近平面和远平面的像素一样;
- Elements close to the observer use significantly fewer sampling points;
- This error is called perspective aliasing;

级联阴影映射(Cascaded Shadow Map)
The most efficient solution for perspective aliasing;
把视锥体分割为多个子视锥体;
为每个子视锥体计算独立的相等大小的阴影映射;
其中的shadow distanceCustomizes the range of shadows generated(Originally from the near plane to the far plane),Some overhead is reduced;
重采样误差
A mapped texture is a dynamically generated texture;
滤波 —— 纹理采样误差的解决方案;
滤波
- 图像处理中,通过滤波强调一些特征或者去除图像中一些不需要的部分;
- 滤波是一个邻域操作算子,Use the values of the pixels surrounding a given pixel to determine the last output value for that pixel;
阴影的滤波
- 使用一部分阴影映射采样点来计算某个指定View采样点的最终阴影结果的方法.
PCF滤波
- 从光方向生成阴影映射;
- Depth testing from a camera perspective;
- 当该着色点通过深度测试时,取该像素周围指定大小(滤波核)的范围.Calculate their visible average as output.

blockedIndicates that the surrounding pixels are not visible42个,visibleIndicates that the surrounding pixels are visible7个,The shadow value is finally calculated
PCF滤波的不同实现
- 采样数K
- 规则滤波,33 或者 55;
- 采用Poisson Disk的形式来分布一定数量的采样点.
- Filter kernel hash number
- Gaussian function as filter function etc;
作业
An optimized solution for real-time shadows
- Use depth offset or normal offset to adjust for self-shadowing problems;
- The cascaded mapping method is used to optimize the results for aliasing problems;
- Use for sampling problemsPCFFiltering is optimized,Achieve better soft shadow effect;
- 利用PCSS(Percetage closer soft shadows)Do a soft shadow implementation;
- 针对PCSSIt's optimized againVSSM(Variance Soft Shadow Mapping)
- 由于VSSMSuppose there are too many constraints,出现了MSM(Moment shadow mapping Matrix shadow mapping)
There is still a lot, a lot, a lot to learn!Games101后半部分+202,继续加油吧!
边栏推荐
- The problem of lack of dynamic library "libtinfo.so.5" in ksql application under UOS system
- 思考(八十八):使用 protobuf 自定义选项,做数据多版本管理
- public static
List asList(T... a) What is the prototype? - dmp (dump) dump file
- 基于生长的棋盘格角点检测方法
- 【已解决】Unity Coroutinue 协程未有效执行的问题
- 用CH341A烧录外挂Flash (W25Q16JV)
- Flink 1.15.1 Cluster Construction (StandaloneSession)
- 如何在WordPress中添加特定类别的小工具
- ffmpeg 枚举decoders, encoders 分析
猜你喜欢

Beyond YOLO5-Face | YOLO-FaceV2 officially open source Trick+ academic point full

The linear table lookup

2022-08-04T17:50:58.296+0800 ERROR Announcer-3 io.airlift.discovery.client.Announcer appears after successful startup of presto

使用二维码传输文件的小工具 - QFileTrans 1.2.0.1
![[Paper Notes] MapReduce: Simplified Data Processing on Large Clusters](/img/89/8adef42b0cfd154e6fa7205afaeade.png)
[Paper Notes] MapReduce: Simplified Data Processing on Large Clusters

dmp (dump) dump file

龙蜥社区第二届理事大会圆满召开!理事换届选举、4 位特约顾问加入

大像素全景制作完成后,推广方式有哪些?

通过模拟Vite一起深入其工作原理

【七夕节】浪漫七夕,代码传情。将爱意变成绚烂的立体场景,给她(他)一个惊喜!(送代码)
随机推荐
undo problem
ASP.NET application--Hello World
Use SuperMap iDesktopX data migration tool to migrate map documents and symbols
.NET Application -- Helloworld (C#)
毕设-基于SSM房屋租赁管理系统
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1
Bubble Sort and Quick Sort
Solve the problem of port occupancy Port xxxx was already in use
How to simulate the background API call scene, very detailed!
(11) Metaclass
Thinking (88): Use protobuf custom options for multi-version management of data
Shell script: for loop and the while loop
Package zip is not available, but is referred to by another package.
惨遭打脸:字节某部门竟有这么多测试员
Study Notes-----Left-biased Tree
You may use special comments to disable some warnings. Three ways to report errors
In 2022, you still can't "low code"?Data science can also play with Low-Code!
private package
Intersection of Boolean Operations in SuperMap iDesktop.Net - Repairing Complex Models with Topological Errors