Set up a type containing all entities you want to include in the vis operation.
Divide the screen into segments - how many is undecided, but too many will cause slowdown. One per pixel would be ideal, but its never going to happen. You *could* do the picks at different points each frame to get more coverage (damn good idea Skitchy) ;)
Show all entities.
Do a camerapick on the center of each segment.
Flag each picked entity as visible.
Hide the unflag'd entities if they are a certain distance away from the camera (to avoid any obvious close-up errors).
Its not perfect, but I think it will work. I invite anybody to expand/completely destroy the idea ;)
Code is from my brain and is therefore untested :)
EDIT : ahh, sh!zzle. I was hiding the visible entities...fixing now
Divide the screen into segments - how many is undecided, but too many will cause slowdown. One per pixel would be ideal, but its never going to happen. You *could* do the picks at different points each frame to get more coverage (damn good idea Skitchy) ;)
Show all entities.
Do a camerapick on the center of each segment.
Flag each picked entity as visible.
Hide the unflag'd entities if they are a certain distance away from the camera (to avoid any obvious close-up errors).
Its not perfect, but I think it will work. I invite anybody to expand/completely destroy the idea ;)
dim pickedlist(1000) ;clear the array (important) for count=0 to 1000 pickedlist(count)=0 next for vismesh.typevismesh=each typevismesh showentity(vismesh\obj) next ;alter offsetx and offsety each frame on a loop from 1->32 for x=offsetx to graphicswidth() step 32 for y=offsety to graphicsheight() step 32 camerapick(cam,x,y) if pickedentity()<>0 pickedlist(index)=pickedentity() index=index+1 endif next next min_vis_distance#=20 for vismesh.typevismesh=each typevismesh if entitydistance(cam,vismesh\obj)>min_vis_distance# hideentity(vismesh\obj) endif next for count=0 to 1000 if pickedlist(count)=0 then exit showentity(pickedlist(count)) endif next
Code is from my brain and is therefore untested :)
EDIT : ahh, sh!zzle. I was hiding the visible entities...fixing now