entityvisible???!?

Blitz3D Forums/Blitz3D Programming/entityvisible???!?

D4NM4N(Posted 2004) [#1]
Anyone know anything about entityvisible() as im trying to create lights with flared textures. But not to have them clipped by the Z buffer. What i want to do is this (this is not the actual code, just to get the idea):

if entityvisible (camera,lightsource)
entityorder lighttexture,-1
else
entityorder lighttexture,1

it works and draws the flare in front, but entityvis seems to ignore any objects in the way and still apears in front.

Does it only work for collision objects?? WHY WHY WHY WHY wont it work!!!!! :(


Damien Sturdy(Posted 2004) [#2]
i would LinePick from the light to the camera. If it returns nothing, then draw the flare

Yes, you will need to set EntityPickMode (i think) on all the entities that could get in the way.


cheers


Rimmsy(Posted 2004) [#3]
The objects like walls and things in between your light and the camera have to be entityPicked

entityPick level,2 ; polygon picking enabled for this mesh

Note: this might slow down your game depending on how complex your level geom is and how often you call EntityVisible. In fact, it's quite a bottleneck command, and you should try and use it as little as possible.

You might have twenty lights in your level, with which you're calling EntityVisible(camera,lightsource) every loop. That's quite a slowdown.

You might think about making a check for distance before checking whether it's visible.


jfk EO-11110(Posted 2004) [#4]
Rims is right, I had this effect in my engine for all lights, but dropped it since it is way to slow.

You can use it for a hand full off unique effects such as the sun etc. But I don't recommend to use it for a high (>5)number of lights.


Rimmsy(Posted 2004) [#5]
Mmm, there are quite a few techniques for speeding it up:

entitypicking certain geometry with sphere or box rather than polygon.

Checking for the light distance and only doing a pick if it's within a certain distance

only do a pick once every 10 cycles. The less accurate you get the faster it will work.

Like jfk said, only make certain lights pick-worthy. That is, special lights like the sun will be occluded by the level, whilst streetlights will always be on and just have an EntityOrder of 0 (normal)

It's a lot of testing, and not really worth the struggle in the end. try a combination of these and you might be able to run the lights with full effects all the time.

Share the results with us.