BlueRoseNote/03-UnrealEngine/Rendering/RenderFeature/Lumen学习笔记(4)——Game104学习笔记.md

172 lines
6.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Untitled
date: 2024-12-28 21:56:29
excerpt:
tags:
rating: ⭐
---
# 前言
相关论文地址:
- Reflective Shadow Maps: https://users.soe.ucsc.edu/~pang/160/s13/proposal/mijallen/proposal/media/p203-dachsbacher.pdf
- Light Propagation Volumes: https://ericpolman.com/
- VXGI:
- https://on-demand.gputechconf.com/gtc/2014/preseintations/S4552-rt-voxel-based-global-illumination-gpus.pdf
- https://docs.nvidia.com/gameworks/content/gameworkslibrary/visualfx/vxgi/product.html
- https://developer.download.nvidia.com/assets/gameworks/downloads/secure/GDC18_Slides/Advances%20in%20Real-Time%20Voxel-Based%20GI%20-%20GDC%202018.pdf?HAwkc19IdhKMFWUs8jSk-If6y4QowlgUUrY8F9SL1-4qnhWWo-u5_gptg4ITWjMJCd1JrFbGmBw4-ztQCJ4M9Bh61am6lFCerKQVApEjN-HQ4chiSb5MLRLY41TyIse6_XW2DpNAe0_4inrYkZqxVb2iGiyZQhxwzfZ40dByP-X8jRYfWhJVsC1aSIqZ8BkooGkjUoUUGw2r7AAxyWVQole9a4je_76g04KtUwlONQ==
- Lumen:
- [https://youtu.be/2GYXuM10riw](https://youtu.be/2GYXuM10riw)
- https://www.advances.realtimerendering.com/s2021/Radiance%20Caching%20for%20real-time%20Global%20Illumination%20(SIGGRAPH%202021).pptx
- SSGI: https://www.ea.com/frostbite/news/stochastic-screen-space-reflections
- DDGI:
- https://zhuanlan.zhihu.com/p/404520592
- https://developer.download.nvidia.com/video/gputechconf/gtc/2019/presentation/s9900-irradiance-fields-rtx-diffuse-global-illumination-for-local-and-cloud-graphics.pdf
# HIZ Tracing
![[HierachicalTracing2.png]]
![[HierachicalTracing3.png]]
![[HierachicalTracing1.png]]# Reflective Shadow MapsRSM2005
论文地址https://users.soe.ucsc.edu/~pang/160/s13/proposal/mijallen/proposal/media/p203-dachsbacher.pdf
Let's inject light in. (Photon Mapping?)
解决如何把“光”注入到场景中。
**Cool Ideas**
- Easy to be implemented
- Photon Injection with RSM
- Cone sampling in mipmap
- Low-res Indirect illumination with error check
**Cons**
- Single bounce
- No visibility check for indirect illumination
# Light Propagation Volumes
**"Freeze" the Radiance in Voxel**
Light Injection
- Pre-subdivide the scene into a 3D grid
- For each grid cell, find enclosed virtual light sources
- Sum up their directional radiance distribution
- Project to first 2 orders of SHs (4 in total)
# Sparse Voxel Octree for Real-time Global Illumination (SVOGI)
## Shading with Cone Tracing in Voxel Tree
Pass 2 from the camera
- Emit some cones based on diffuse+specular BRDF
- Query in octree based on the (growing) size of the cone
# VXGINvidia UE4 Plugins
**Problems in VXGI**
Incorrect Occlusion(opacity)
- naively combine the opacity with alpha blending.
Light Leaking
- when occlusion wall is much smaller than voxel size
# SSGI
SIGGRAPH2015Advances in Real-Time Rendering course
**Radiance Sampling in Screen Space**
For each fragment:
- **Step 1**: compute many reflection
rays
- **Step 2**: march along ray direction
**(in depth gbuffer)**
- **Step3**: use color of hit point as
indirect lighting
![[SSGI1.png]]
![[SSGI2.png]]
中间的RayCast使用RayMarching进行。但使用LinearRayMarching相对比较消耗资源所以采用HierachicalTracing。
![[SSGI3.png]]
最低层级
![[HierachicalTracing1.png]]
层级+1相当于RayMarching2个像素。
![[HierachicalTracing2.png]]
层级+2相当于RayMarching4个像素。此时RayHit。
![[HierachicalTracing3.png]]
回退当前HiZ像素的上一层级。
![[HierachicalTracing4.png]]
回退当前HiZ像素的上上一层级。
![[HierachicalTracing5.png]]
找到RayHit位置。
![[HierachicalTracing6.png]]
## Ray Reuse among Neighbor Pixels
- Store **hitpoint data**
- Assume visibility is the same between neighbors
- Regard **ray to neighbor's hitpoint** as valid
![[ConeTracingWithMipmapFiltering1.png]]
# Lumen
## Phase1: Fast Ray Track in Any Hardward
Signed Distance Field(SDF)
1. 它是均匀的。
2. 在空间上是连续的。
### Cone Tracing with SDF(ie. Soft Shadow)
## Phase2:Radiance Injection and Cacheing
![[MeshCard1.png]]
MeshCard的目的是为了将直接光照存储在模型上Surface Cache
![[GenerateSurfaceCache1.png]]
![[GenerateSurfaceCache2.png]]
最终目的是通过SurfaceCache这4张图渲染出SurfaceCache FinalLighting
![[LightingCachePipeline1.png]]
1. 计算SurfaceCache DirectLighting
2. 通过1计算体素光照。
3. 通过体素光照来计算间接照明。
4. 最终计算Surface Cache FinalLighting。
以此进行循环。![[DirectLighting1.png]]
针对多个光源会渲染对应数量的cache之后累加在一起。
![[MultiLightSurfaceCache.png]]
### Voxel Lighting to Sample
![[VoxelLightingToSample.png]]
对于近处的物体可以准确拿到Hit到物体的上一点的Radiance对于远处的物体会以相机坐标轴生成一个Voxel形式的表达之后通过Global SDF拿到对应的Radiance。
***PS. 该Voxel存储的数据为每个面对应方向上被其他直接照明照亮的亮度。***
![[VoxelClipmap.png]]![[BuildVoxelFaces.png]]
其Voxel的计算是基于SDF的。
![[InjectLightIntoClipmap.png]]
![[IndirectLighting.png]]
在SurfaceCache中 8x8的tile中行与列间隔4个像素放置2个探针进行4次空间Voxel采样。
之后进行球谐插值:
![[IndirectLighting_SHLerp.png]]![[Per-PixelIndirectLighting.png]]![[CombineLighting.png]]
## Phase3:Build a lot of probes with Different Kinds
![[ScreenProbeStructure.png]]
每隔 16 * 16 个像素采样一个ScreenSpaceProbe。采样的内容是Radiance与HitDistance以8面体Octahedron Mapping的方式进行存储。
![[ScreenProbePlacement.png]]![[PlaneDistanceWeightingOfProbeInterpolation.png]]![[DetectNon-InterpolatableCases.png]]![[ScreenProbeAtlas.png]]
将重采样的结果部分区域的屏幕空间探针因为实际空间距离太远进行插值没有意义所以需要额外填充探针进行重采样存在Atlas下面的空出来的区域。
![[ScreenProbeJitter.png]]
### 重要性采样
![[ApproximateRadianceImportanceFromLastFrameProbes.png]]![[AccumulateNormalDistributionNearby.png]]![[NearbyNormalAccumulation.png]]![[StructuredImportanceSampling.png]]![[FixBudgetImportanceSampling.png]]
### Denoise
![[Denoise_SpatialFilteringForProbe.png]]![[Denoise_GatherRadianceFromNeightbors.png]]![[ClampDistanceMismatching.png]]
### WorldSpace Probes and Ray Connecting
![[WorldSapceRadianceCache.png]]![[WorldSpaceRadianceCache.png]]![[ConnectingRays.png]]![[ConnectingRays2.png]]![[ConnectingRay3.png]]![[PlacementAndCacheing.png]]
## Phase4:Shading Full Pixels with Screen Space Probes
在ScreenSpaceProbes将场景Radiance都收集好。
![[ConvertProbeRadianceTo3rdOrderSphericalHarmonic.png]]
![[FinalIntegarationWithSH.png]]
## 性能问题
![[LumenTrackMethod.png]]