dynamic visibility
solutions
Static Potentially Visible Sets (PVSs)
the world is discretised in some way (BSP, grid, etc.) and the binary visibility from each sector (leaf node, cell or cluster respectively) to all other sectors is pre-computed and stored. 动态物和一些可破坏物不在遮挡的计算范畴。
Hardware Occlusion Queries
rendering the depth of a subset (or a simplified representation) of the scene – the occluders – and then rasterising (without depth writes,with occlusion query) the bounds of objects, or groups of objects. 古老的技术,把物体的bounding box传入得到物体是否被遮挡的结果
Hierarchical Z Buffer
- Render Occluder Depth
- Create a Depth Hierarchy
Test Object Bounds 根据投影到screen上的面积来决定depth map的mip level
sampler2D sHZB : register(s0); float4 main(INPUT input) : COLOR0 { float4 sbox = input.sbox; float level = input.data.x; float min_z = input.data.y; bool visible = input.data.z; float4 samples; samples.x = tex2Dlod(sHZB, float4(sbox.xy, 0, level)).x; samples.y = tex2Dlod(sHZB, float4(sbox.zy, 0, level)).x; samples.z = tex2Dlod(sHZB, float4(sbox.xw, 0, level)).x; samples.w = tex2Dlod(sHZB, float4(sbox.zw, 0, level)).x; // Modulate culling with depth test result float max_z = max4(samples); visible *= min_z <= max_z; return visible; }
- Process the results 根据得到的visibility结果来决定是否剔除物体。