Skip to content

Commit 9682aad

Browse files
committed
add code notes on REDEngine, add thoughts
1 parent e264af3 commit 9682aad

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

12.red_engine_notes/REDEngineGI.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# REDEngine的GI
2+
3+
相关源码文件
4+
5+
* giProbeBakingUtility.cpp **[backendPipeline]**
6+
* GI::RenderProbes
7+
* ProbeBakeGeneratorState::ProcessProbeData
8+
* 烘焙GI Surfel
9+
* 一个启发是近距离的Surfel数据可以通过多帧GBuffer来生成,而不是通过Voxelization,这样能更高保真度的保存数据,这个Surfel数据的保存可以通过Spatial Hash Grid保存,类似的实现在AMD BrixelGI里有所提及;HSGI[TX]则将Voxelization生成的world space surfel数据作为GI场景表达的一个补充,当然也可以考虑多帧GBuffer生成surfel voxel修正漏光
10+
* ScheduleGIGenerate
11+
* "Detect Empty Sectors ( Only Terrain and Roads )"
12+
* "Create Proxies for the scene"
13+
* "Create Scene and Add Proxies"
14+
* "GI Probes placement"
15+
* Max probes per sector
16+
* "Initial tetrahedralization of probes"
17+
* "Render GI Probes"
18+
* "Clean After GI Probes"
19+
* "Merge TetStructures"
20+
* "Process GI Bricks"
21+
* "Generate DepthMap"
22+
* "RayTrace Surfel-Probe"
23+
* Collect surfels
24+
* "Generate Save Data.. Save header"
25+
* "Generate Save Data.. Processing Surfels"
26+
* Using HilbertID/Morton Code
27+
```C
28+
Uint32 HilbertID( Uint32 x, Uint32 y, Uint32 z )
29+
{
30+
#define SPLIT_BITS(b) \
31+
b = (b | (b << 16)) & 0x030000FF; \
32+
b = (b | (b << 8)) & 0x0300F00F; \
33+
b = (b | (b << 4)) & 0x030C30C3; \
34+
b = (b | (b << 2)) & 0x09249249;
35+
SPLIT_BITS( x );
36+
SPLIT_BITS( y );
37+
SPLIT_BITS( z );
38+
#undef SPLIT_BITS
39+
return x | (y<<1) | (z<<2);
40+
}
41+
```
42+
* "Generate Save Data.. Post RayCast"
43+
* "Save Resources"
44+
* "Clean up"
45+
* UE里去实现这个过程利用GPU Lightmass会比较合适
46+
* GPULightmass有完整的GPU Scene、材质信息
47+
* giProbeDistributionGenerator.cpp **[backendPipeline]**
48+
* ProbeDistribuitionGenerator::Generate `"Distribute probes"`
49+
* runtimeSystemGI.cpp **[backendPrecomputedLight]**
50+
* GI::CProbeSpawner::PopulateProbeData
51+
* 先生成SDF数据
52+
* 然后根据摆放的GIVolume在Volume内的Mesh按密度控制沿着表面布置Probe
53+
* giProbeSectorsGenerator.cpp
54+
* ProbeSectorsGenerator
55+
56+

0 commit comments

Comments
 (0)