MontyTRC89 / Tomb-Editor

Tomb Editor
57 stars 16 forks source link

TE: Spatial hashing of room vertices for quicker lighting #820

Open Raildex opened 5 months ago

Raildex commented 5 months ago

Currently, The lighting calculation iterates over each light and each vertex. The Vertex Indices (VertexRange?) should be spatially hashed so the lighting needs only be calculated for vertices within a lights area of influence.

Something along the lines of IDictionary<VectorInt2,IList<VertexRange>>, where the Key is a vector that contains the x/z position. The bucketing should not be too small, otherwise you get 6 vertices for a single bucket.

The spatial hash would also allow to run the whole thing in parallel