Vertex lighting.

Blitz3D Forums/Blitz3D Programming/Vertex lighting.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi vertigo, I haven't read all in the thread so might be stating what's been said before.

I also use a vertex lighting system on my static meshes. Which looks 'ok' - not fab, but I'm happy with it.
It would obviously be way too slow to light my dynamic meshes in a similar way (or to have dynamic lights), so for my dynamic entities I use the same routine, except aaplying the lighting result to individual vertices I use it to 'light' each mesh seperatly - using Entitycolor I can darken, lighten and even color my dynamic meshes in real-time (leaving the static set untouched). This works quite ok. So when a character walks from the outside (sun light) into a building (dark), it nicely changes shade...
Might be an idea?!

I made a routine GetLightColorAt(x,y,z) and returns an rgb value (checking all available lights, their individual color, range, shape, intensity and shadow casting options - and returns a net RGB value, I can post a copy if you like). With vertex lighting I apply the rgb to a vertex, for the entity I use the same routine but apply it with EntityColor.

Also, lighting my set (with ""ray-traced"" shadows) takes about 2 minutes. But once rendered, I save each vertex's rgb to a file. Loading this back, and simply re-applying it with a for..next loop takes less than a second!!!

D.