VISI (MREA Section): Difference between revisions

no edit summary
imported>Jackoalan
(Created page with "Within MREA resources, the '''VISI section''' stores a PVS indexed into an octree. This PVS...")
 
imported>Jackoalan
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 19: Line 19:
|-
|-
| bool
| bool
| Unknown 1
| Has Actors
|
| If set, the game will resolve script entity IDs for the PVS lookup
|-
|-
| bool
| bool
Line 32: Line 32:
| u32
| u32
| Light count
| Light count
| Number of area lights encoded in octree leaves.
| Total number of area lights encoded in octree leaves.
|-
|-
| u32
| u32
| Unknown 3
| 2nd Layer Light Count
|
| Lights within total that are in the 2nd BABEDEAD layer.
|-
|-
| u32
| u32
Line 56: Line 56:
| u8[lightVisibilityNodeCount][leafSize]
| u8[lightVisibilityNodeCount][leafSize]
| Light visibility node array
| Light visibility node array
| Array of [[#Leaf Nodes|leaf node data]] indicating visibility of other objects from light's perspective.
| Array of [[#Leaf Nodes|leaf node data]] indicating visibility of other objects from light's perspective. 2nd layer lights are listed first.
|-
|-
| float[2][3]
| float[2][3]
| Octree AABB
| Octree AABB
| Total bounds subdivided by octree.
| Total bounds subdivided by octree. '''Note:''' the coordinates of the AABB are in local area space (i.e. inverse-transformed with the matrix in the MREA header).
|-
|-
| u32
| u32
| Total visibility bit count
| Total visibility object count
| Number of bits per-leaf that indicate visibility from the selected octree region (static + entities + lights).
| Number of objects per-leaf that indicate visibility from the selected octree region (static + entities + lights).
|-
|-
| u32
| u32
| Total light bit count
| Total light object count
| Number of bits after visibility bits that indicate in-bounds/out-of-bounds state of each light.
| Number of objects within total that are lights.
|-
|-
| u32
| u32
Line 81: Line 81:
=== Octree Nodes ===
=== Octree Nodes ===


The octree data is arranged in a Z-major depth-first hierarchy embedded with variable-length pointers to skip over
The octree data is arranged in a Z-major, depth-first hierarchy embedded with variable-length pointers to skip over
children, permitting rapid child selection. Each node of the octree starts with a 1-byte header
children, permitting rapid child selection. Each node of the octree starts with a 1-byte header
of classification bits. If at least one subdivide bit is set, the node is a branch and contains 1-7 pointers, addressed
of classification bits. If at least one subdivide bit is set, the node is a branch and contains 1-7 pointers, addressed
Line 112: Line 112:
Instead of child pointers, leaf nodes contain byte-packed bits indicating visibility.  
Instead of child pointers, leaf nodes contain byte-packed bits indicating visibility.  
The bits are arranged from LSB to MSB per-byte. First are the bits relating static MREA geometry  
The bits are arranged from LSB to MSB per-byte. First are the bits relating static MREA geometry  
in-order of the first MREA section. Next are bits relating the scripted entities in the VISI entities table.
in-order of the first MREA sections. Next are bits relating the scripted entities in the VISI entities table.
Finally are the bits relating lights in order of the BABEDEAD section of the MREA. Following these is another
 
set of bits for each light indicating if it's in-bounds of the octree or not.
Finally are the bits relating lights in order of the BABEDEAD section of the MREA. The 2nd layer lights are related first. Each light encodes 2-bits apiece,
with the following enum represented:
 
{| class="wikitable"
! Value
! Description
|-
| 0
| Not Visible
|-
| 1
| Visible
|-
| 2
| Outside Octree Bounds
|}
Anonymous user