当前位置:网站首页>Talking about 3 Common Shadow Rendering Techniques in Games (3): Shadow Mapping
Talking about 3 Common Shadow Rendering Techniques in Games (3): Shadow Mapping
2022-08-10 06:14:00 【Youmeng Maker】
Talking about 3 common shadow rendering techniques in games (3): shadow map
Copyright Notice
- This article is an original article of "Youmeng Maker", you can reprint it freely, but you must add a complete copyright statement
- For more learning resources, please add QQ: 1517069595 (enterprise-level performance optimization/hot update/Shader special effects/server/commercial project combat/weekly live broadcast/one-to-one guidance)
Third, shadow map
3.1 Shadow Map Features
- Shadow mapping is a shadow rendering method officially adopted by Unity. The official has done a lot of work in order to integrate the shadow mapping method. As developers, we only need to set the lights in the scene and set the in-game lighting.Whether the gameobject can generate shadows can be completed
- An additional ShadowCaster channel is required
- Easy to implement soft shadows
3.2 Shadow Map Implementation
- The first step: generate a depth map at the position of the light, and render the depth value in the scene into the depth map, as shown in the following figure, the part of the ground and the place where the block is illuminated by the light need to be rendered, then we willRender their depth values into our depth map.The information of these scenes will be stored in an additional pass called ShadowCaster.
ShadowCaster is a pass specially used to obtain the depth information of the scene. The depth information of this Pass is obtained from the position of the light
- Step 2:
- If we want to render the ground plane, and the ground plane is composed of points, if we want to render point P, if we look at it with our naked eyes, then it is easy to see that point P is in shadow,But how does the computer know if point P should be rendered?
- Compare the rendered depth map with the depth value of point P in the light space, which involves converting the depth value of the camera space of point P into the light space (this involves a lot of low-level knowledge points, you canWatch our open class to learn more).After the point P is transferred to the light space, it can be understood that the point P is 0.9 away from the light and 0.4 away from the camera. Because 0.9>0.4, the point P is in the shadow and does not need to be rendered.
- More about the underlying knowledge, such as the underlying API, the implementation details of the spatial transformation of point P at the engine level, are also explained in our open courses.
3.3 Soft Shadows
- ShadowMap can also achieve the effect of soft shadow. Soft shadow is an important shadow effect in the game. A shadow is composed of umbra and penumbra. Soft shadow is the so-called penumbra, such as the picture in the lower right corner, around the shadowWith the blurred shadow, how to achieve the effect of soft shadow, you can pay attention to our ShadowMap course, we will tell you the specific implementation method
Summary
- Further study content:
- The solution to the depth jitter problem.
- A plane on the left of the picture is parked on the runway, because the depth value of the runway map and the shadow of the plane is the same, so there will be jitter.
- Multi-light real-time shadowing and its performance optimization.
- If there are multiple light sources in the scene, it will cause multiple shadows to the same object. How to realize real-time shadowing of multiple light sources and its performance optimization, you can continue to pay attention to our course.
- The solution to the depth jitter problem.
- In this article, I mainly explain two aspects of knowledge, the implementation of plane shadows and the use of stencil buffers, and the implementation principles of shadow cones and shadow maps, as well as the realization of shadow effects in some commercial projects.possible problems.
- If you want to learn more about shadow rendering and the learning route in TA, you can scan the QR code to join our open class and receive relevant materials.
For more learning resources, please add QQ: 1517069595 (/enterprise-level performance optimization/hot update/Shader special effects/server/commercial project combat/weekly live broadcast/one-to-one guidance)
边栏推荐
猜你喜欢
STM32F407ZG 看门狗 IWDG & WWDG
51单片机AD590温度测量ADC0832运放2.73V减法电压变换
以STM32F103C6TA为例通过配置CubeMX实现GPIO输出完成点灯实例
在Unity的Update中通过物体自身位置判断运动方向
从零开始构建Google Protocol Buffer / protobuf 的helloworld工程(超级详细)
【接口自动化】
ASP.NET连接SQL Server的步骤
每日刷题(day03)——leetcode 899. 有序队列
通过adb devices命令在控制台显示企业级PicoNeo3设备号
每日刷题(day01)——leetcode 53. 最大子数组和
随机推荐
接口自动化2.0
LruCache与DiskLruCache结合简单实现ImageLoader
内核性能分析总结
每日刷题(day02)——leetcode 622. 设计循环队列
21天学习挑战赛--图像物体的边界
废水中氟离子去除方法
mysql使用常见问题和解决
手把手教你改内核源码--sysfs虚拟文件系统1
Teach you to change the kernel source code--sysfs virtual file system 2
STM32F407ZG TIM通用定时器
自定义View的流程总结学习
Kernel performance analysis summary
常用模块封装-pymysql、pymongo(可优化)
在Unity的Update中通过物体自身位置判断运动方向
二次元卡通渲染之描边
除砷树脂吸附原理
qemu和主机共享磁盘
STM32F407ZG 串口通信+固定帧头帧尾传输数据帧
Easy to master Unity of eight prior to rendering
ASP.NET连接SQL Server的步骤