diff --git a/03-UnrealEngine/Rendering/RenderFeature/Lumen学习笔记(4)——Game104学习笔记.md b/03-UnrealEngine/Rendering/RenderFeature/Lumen学习笔记(4)——Game104学习笔记.md new file mode 100644 index 0000000..bd05389 --- /dev/null +++ b/03-UnrealEngine/Rendering/RenderFeature/Lumen学习笔记(4)——Game104学习笔记.md @@ -0,0 +1,148 @@ +--- +title: Untitled +date: 2024-12-28 21:56:29 +excerpt: +tags: +rating: ⭐ +--- +![[HierachicalTracing2.png]] + +![[HierachicalTracing3.png]] + +![[HierachicalTracing1.png]]# Reflective Shadow Maps(RSM,2005) +论文地址: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 + +# VXGI(Nvidia 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 +SIGGRAPH2015:Advances 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 diff --git a/03-UnrealEngine/卡通渲染相关资料/卡通渲染开发总览.md b/03-UnrealEngine/卡通渲染相关资料/卡通渲染开发总览.md index 3420c41..c7fa1de 100644 --- a/03-UnrealEngine/卡通渲染相关资料/卡通渲染开发总览.md +++ b/03-UnrealEngine/卡通渲染相关资料/卡通渲染开发总览.md @@ -28,6 +28,8 @@ rating: ⭐⭐⭐ - https://zhuanlan.zhihu.com/p/716241556 - BanG梦想! 女子乐队派对 - 异度神剑 + - 碧蓝幻想 + - https://zhuanlan.zhihu.com/p/14858282081 - 归龙潮 - 其他人的作品 - [蛋白胨](https://www.zhihu.com/people/danbaidong1111) https://zhuanlan.zhihu.com/p/663968812 @@ -133,36 +135,39 @@ rating: ⭐⭐⭐ 6. 渲染深度与法线Buffer。 7. 渲染级联阴影。 8. 合成,阴影与环境光照(AO、环境探针)。 -14. [ ] 添加Debug View https://zhuanlan.zhihu.com/p/668782106 -15. [ ] [_UE5_ Shader Print系统](https://zhuanlan.zhihu.com/p/637929634) -16. [ ] GBufferView实现。 -17. [ ] Toon Debug模式,可以让美术在材质进行进行简单的光照计算。 -18. [ ] ToonShadow +14. [ ] 云彩生成器 + 1. [ ] https://www.bilibili.com/video/BV1L5kdYFEXc/?spm_id_from=333.1007.tianma.4-1-11.click&vd_source=d47c0bb42f9c72fd7d74562185cee290 + 2. [ ] 风格化水面资产 https://item.taobao.com/item.htm?id=865360489543&pisk=gLHsX7NMiNb1gB7njFKURXly5Dwb5q9y1iZxqmBNDReTkigKDtQA6-FLJorOMSU2sqNju2VxQRoZRGDIPtWwSCmAh-yvzUJyUcman-Lyk8kOUGq4mNUAurCKv-rjPdNAXcmgnrIFkQlKjZg5RK5YDrKQpor7k-EYW9KQcuaYHPFAJ6E8JrexkSIdJuZ5MZCTHkKQju5OBoeYvMEaVtBtk-KIvyqxnDXQDCZ-fHz1qUDkpeKgJtBxdlNpTcUKrr-4i5TjbyXvy1Zg1coTRtBxKXkPllz9ZMz0QPDbfqvlIRFjTAVoQeBsl20KBSDp8B00QuV-MD-lTPDIQvFsCU1uCX3nd5DOWhqtsqDbQx71hDMb57HTOKx0CDEYdbneq6zidAkL1AT5ZPMiDjPItNTUuboEBWgJ89g0GXkgZA8dC4IyzTz7sJ5fA7XbAz-BAsf0xzPwqJ_edaNTxlTyAH_Gi5E3AmtBAsDg6kqF6HtCWc1..&spm=a21xtw.29178619.product_shelf.74.41727d6dRCDvul +15. [ ] 添加Debug View https://zhuanlan.zhihu.com/p/668782106 +16. [ ] [_UE5_ Shader Print系统](https://zhuanlan.zhihu.com/p/637929634) +17. [ ] GBufferView实现。 +18. [ ] Toon Debug模式,可以让美术在材质进行进行简单的光照计算。 +19. [ ] ToonShadow 1. ![[星穹铁道中下巴阴影处理.png]] 2. [ ] ToonSDFShadow 1. [ ] TODO: SDF贴图工具? 3. [ ] ShadowPass https://zhuanlan.zhihu.com/p/619718145 1. [ ] 半分阴影[[幻塔-半程自阴影.png]] -19. [ ] LookDev场景 +20. [ ] LookDev场景 1. [ ] https://zhuanlan.zhihu.com/p/394608910 -20. [ ] 考虑往GBuffer中添加更多数据(考虑Velocity以及SingleLayerWater) +21. [ ] 考虑往GBuffer中添加更多数据(考虑Velocity以及SingleLayerWater) 1. ShaderMaterialDerivedHelpers.cpp(Shader宏)、GBufferInfo.cpp(GBuffer格式)BasePassRendering.cpp(950行,SingleLayerWater写入GBuffer格式相关) 2. 确定一下SingleLayerWater中VSMFiter与DistanceFieldShadow对渲染结果的影响,之后在文档中说明。 -21. [ ] 修复SIngleLayerWater的缩略图渲染渲染错误(双击会有一瞬间的错误产生) -22. [ ] 添加对应的Stat https://zhuanlan.zhihu.com/p/716644594 -23. [ ] ToonLumen、GI以及晕染效果实现。![[卡通渲染晕染效果.mp4]] -24. [ ] 在材质中实现ToonEye相关效果 +22. [ ] 修复SIngleLayerWater的缩略图渲染渲染错误(双击会有一瞬间的错误产生) +23. [ ] 添加对应的Stat https://zhuanlan.zhihu.com/p/716644594 +24. [ ] ToonLumen、GI以及晕染效果实现。![[卡通渲染晕染效果.mp4]] +25. [ ] 在材质中实现ToonEye相关效果 1. 【二次元人物眼睛如何变形?】 https://www.bilibili.com/video/BV14M4m1y71A/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e 1. 原视频 https://www.youtube.com/watch?v=euIyX9v8rvw 2. 眼睛建模 https://youtu.be/s2_7Q2IIvNY?si=fWiYjqcLFXzdeQ-B&t=126 -25. 尝试实现Forward+ +26. 尝试实现Forward+ 1. BasePass https://zhuanlan.zhihu.com/p/618698467 -26. DX11问题修复 +27. DX11问题修复 1. [x] ToonOutline SceneColorTexture为空的问题。 **DX11限制,必须CopyTexture** -27. 卡通渲染针对TAA的优化思路 https://zhuanlan.zhihu.com/p/678876237 +28. 卡通渲染针对TAA的优化思路 https://zhuanlan.zhihu.com/p/678876237 1. https://www.bilibili.com/video/BV1BK411v7FY/?spm_id_from=333.788&vd_source=ea6df38502a795b7533aa33b78bf1159 2. https://zhuanlan.zhihu.com/p/20786650 -28. [ ] Unreal Engine 5.4 Scene Extension https://zhuanlan.zhihu.com/p/706268007 +29. [ ] Unreal Engine 5.4 Scene Extension https://zhuanlan.zhihu.com/p/706268007 1. [ ] 通过SceneExtension改进ToonObjectID,这样可以减少对应ToonBuffer的精度来存其他数据。 2. [ ] https://www.bilibili.com/video/BV1fM4m1U7Tp/ @@ -183,6 +188,7 @@ TODO: - [ ] 星穹铁道 - [ ] 绝区零 - [ ] 蓝色协议 +- [ ] 碧蓝幻想 # 卡通渲染引擎功能总览(按照渲染顺序进行排序) - GBuffer For ToonShaderModel