1 convert all leafs in octree to PvsNode, add to list pvsNodes 2 3 for (every nodeX in pvsNodes): 4 for (every nodeY in pvsNodes): 5 if (nodeX == nodeY or nodeX adjecent or intersecting nodeY): 6 continue 7 8 setup camera for (nodeX, nodeY) 9 draw every node except nodeX & nodeY 10 11 turn on occlusion query 12 draw nodeY as bounding box 13 turn off occlusion query 14 15 if (numSamples > 0): // node is visible 16 add nodeY to nodeX's potentially visible set 17 18 19 setup camera for node, sideI: 20 21 float width, height, near; 22 23 switch (sideI): 24 case X+ 25 case X- 26 width = x extent 27 height = y extent 28 near = z extent / 2 29 case Y+ 30 case Y- 31 width = x extent 32 height = z extent 33 near = y extent / 2 34 case Z+ 35 case Z- 36 width = z extent 37 height = y extent 38 near = x extent / 2 39 40 41