lights
Blitz3D Forums/Blitz3D Beginners Area/lights
| ||
so i want to use just the l8 lights that dx7 can supply, and i have code on how to make them fade away so that no more than 8 are active at a time, but here is my question. how do i deactivate a light on just one entity? |
| ||
EntityFx Entity, 1 |
| ||
Unless he wishes for only some lights and not others to affect an entity (of which I have no idea how to achieve with blitz hardware lights). |
| ||
Unless he wishes for only some lights and not others to affect an entity (of which I have no idea how to achieve with blitz hardware lights). The only way you could do that is with multi pass rendering. |
| ||
would that slow down my game all that much? The multi rendering |
| ||
Yes, why do you need that effect? Maybe we can figure out another way to mimic the effect you want. |
| ||
I want my characters to change thier lighting if they were to go under a bridge for example, but I have a onverhead light that is light type 1 basically a sunlight. i want it to not shine on units if they are not visible to its light |
| ||
would that slow down my game all that much? The multi rendering No it won't slow it down at all. You're only rendering the same number of polygons - you're just doing it in two passes instead of one. |
| ||
If you have a spare light then you can use a black light under the bridge or you can use black mesh-lighting: http://www.blitzbasic.com/codearcs/codearcs.php?code=2020 |
| ||
are you the real puki? :D it's been a very long time. |
| ||
that works really well, thanks! |
| ||
is there a limit to how many fake lights i can use at once? |
| ||
I just applied a million fake light calls on that little sucker. Blitz didn't seem to care. However, I am not sure whether or not it can keep up with blending that much. I have further called 10 million fake lights. Again, Blitz3D did not complain. Play around with it. Use a loop with LightMesh ent, rand(255), rand(255), rand(255), rand(-50,50), rand(-50,50), rand(-50,50) That will throw random colour lights from random directions. |
| ||
i have this function for my lighting right now and the lights are either on or off, can anyone suggest some way to make the lights have a smoother transition rather than being on or off? Function lights(entity) LightMesh entity,-255,-255,-255 For l.light=Each light PointEntity l\entity,entity If EntityDistance(entity,l\entity)<=l\range#*2 And EntityVisible(l\entity,entity) Then TFormPoint 0,0,0,l\entity,entity ; bypass the limits of LightMesh's fake light coordinates LightMesh entity,l\r#,l\g#,l\b#,l\range#,TFormedX(),TFormedY(),TFormedZ(); re-apply fake lighting EndIf Next End Function |
| ||
Alter the LightColor. |
| ||
I have further called 10 million fake lights. Again, Blitz3D did not complain. Why should it? You're only changing the vertex colours. You can do that til you drop down dead of boredom and Blitz will continue happily. |
| ||
what about tformpoint? does that use a lot of processing? |
| ||
tformpoint and the other tform commands are very fast, they are just transforming between coordinate systems which is some simple matrix mathematics. |
| ||
what about entity visible? |
| ||
EntityVisible is a slower command, as it is pretty much a line pick, and depends upon the complexity of the geometry involved. |
| ||
is there a faster comand that does the same thing |
| ||
odd, for some reason tformpoint slows down my computer but entityvisible does not. |
| ||
actually i think its the way i utilize the code, here Function lights(entity) LightMesh entity,-255,-255,-255 LightMesh entity,64,64,64 For l.light=Each light If EntityVisible(l\entity,entity)=True Then ;l\visible#=1 l\r#=l\r#+10 l\b#=l\b#+10 l\g#=l\g#+10 Else l\r#=l\r#-10 l\b#=l\b#-10 l\g#=l\g#-10 EndIf If l\r#<0 Then l\r#=0 If l\g#<0 Then l\g#=0 If l\b#<0 Then l\b#=0 If l\r#>l\fr# Then l\r#=l\fr# If l\g#>l\fg# Then l\g#=l\fg# If l\b#>l\fb# Then l\b#=l\fb# If l\r#>0 Or l\b#>0 Or l\g#>0 Then TFormPoint 0,0,0,l\entity,entity x#=TFormedX() y#=TFormedY() z#=TFormedZ() LightMesh entity,l\r#,l\g#,l\b#,l\range#/10,x#,y#,z# EndIf Next End Function |
| ||
It will be the lightmesh command not the tformpoint that slows things down. The lightmesh command has to, internally, set the vertex colors of each vertex of the mesh. The tformpoint command simply takes a vector and transforms it from one space into another - it is not slow. |
| ||
any way to speed it up? |
| ||
Use hardware lights, other than that I'm not sure. Although as you are already aware you are limited to 8 hardware lights. |