cjcliffe / CubicVR.js

CubicVR 3D Engine, WebGL Edition
http://www.cubicvr.org/
527 stars 106 forks source link

Octree light partitioning #2

Open cjcliffe opened 13 years ago

cjcliffe commented 13 years ago

Need a way to calculate the lights that apply to each sceneObject so that when rendering we're not doing excessive drawing of objects that are outside the range of a particular light.

Perhaps having an .active_lights array for each sceneObject with two lists in it, one for dynamic and one for static lights (so we can splice them together on render). If the octree can somehow fill these lists on each pass we'd have a forward-run of just visible objects with their active lighting set.

We'll need a static/dynamic flag for objects and lights and hopefully the static stuff can be computed when a light/object is added and the dynamic can be a slightly more efficient system that uses object tracking like we have now.

cjcliffe commented 13 years ago

Some additional notes:

For static light source clusters or dynamic lights attached to objects (i.e. car headlights) we could group them into single sets with unified bounds, might save a fair bit of time iterating individual light sources when there are many clustered together.

cjcliffe commented 13 years ago

Another note:

Add the ability for SceneObjects to have a static/dynamic setting. SceneObjects with at static flag vs. a static light we can perform additional more expensive bounding box check on insert (not AABB, BB planes) to reduce the need for high-resolution octree to accomplish the same overlap resolution.

cjcliffe commented 13 years ago

Investigate to ensure octree.js in #26 will work with octree light partitioning and if not, what needs to change.