Blitz3D Lights VS. Lightmapping?!?

Blitz3D Forums/Blitz3D Programming/Blitz3D Lights VS. Lightmapping?!?

Kozmi(Posted 2004) [#1]
Ok Guys,

This is going to sound like a complete stupid question here,
So please forgive it, ok?! I just was wondering in my head if it's possible to use a Blitz3D Omni light along with a level that has been lightmapped in gile[s]???

I've been trying to create this effect you see, Where my player is carrying around with him a torch through some dark cooridores of this level im' designing at the moment!
I want my torch to give off light in these dark cooridores and areas... But i've been having trouble getting my light to work... :( I take it that you can't use a regular Omni light along with a lightmapped level then correct? And if this is the case and all, Why is this then? And can someone possibly post a code example showing how I would use just such a effect with my torch? Id' greatly appreciate it very much so! Thank's Guys!!


Beaker(Posted 2004) [#2]
You can do it, but I wouldn't recommend it. You must remember that DX/Blitz lights only light vertices, so that may only really effect the corners of your rooms.

You might want to think about using a blended sprite (or similar) to simulate the light cast by your torch.


Gabriel(Posted 2004) [#3]
I take it that you can't use a regular Omni light along with a lightmapped level then correct?


By default, that's correct.

And if this is the case and all, Why is this then?


Because Gile[s] - like most lightmappers - enables fullbright on all lightmapped objects, which stops any blitz lights from affecting them. You've already applied light to the objects. If you were to allow Blitz lights to affect the objects again, you would effectively be doubling the intensity of your lights. The idea is to have Blitz lights to light non-lightmapped objects so that they match the lightmapped objects. If you were "double-lighting" the levels, the characters would only be single lit, and would still not match.

If you really, really want dynamic lights, you would normally use only dynamic lights and no lightmapping. That's not particularly viable in Blitz because blitz doesn't have per-pixel lighting or shadows. So for Blitz purposes, I would probably be inclined to use a blended sprite/quad like Beaker suggested.


Neochrome(Posted 2004) [#4]
ok, i did this once, but my sprite wasn't very good, i basically did a PNG with an alpha map and had a white circle of about 127,127,127 for the light intensity. it work OK, but when i was in a dark room, all i saw was a circle of white (dark gray actually) instead of what a vertex light would have done.

How would i get about this? would dot3 blending (4) work at all??


Kozmi(Posted 2004) [#5]
Hmmmm...

Ok! Thank's Guys for your helpful suggestions and all!
As a special note also, I just realized that this effect I once done in 3D GameStudio and all... I just remembered that 3D GameStudio has Dynamic Lights with their engine!
This would also explain why with their engine, that when you light a room with their engine, You need only apply... Or... drop a light into that room and render it, And the room will have it's light & shadows automatically!! Duh!!!
It would be cool if Mark Sibly would include Dynamic Lighting in the near future. But that would probably mean that he would have to step up to DX8 or DX9 to accomplish this! And I just read just yesterday in one of his work logs... I think?!? That he said he wasn't going to move up to DX8 or DX9 for Blitz 3D! So I guess that idea got shot out of the water huh? Anyways!! I did find a code snippet in the archives that Fredborg wrote that is called: Textured Spotlight that look's like it should do the trick! ;) However though! My only concern now is when I use this code sample of Fredborg's... I wonder how the dark area's are going to look when I use this kind of fake lighting?!? I am assuming it probably wont look just right!
Oh no!!!! :(


Gabriel(Posted 2004) [#6]
Blitz HAS dynamic lights. CreateLight() creates a dynamic light. If you disable FullBright on the lightmapped geometry, these lights will effect your levels too. I don't recommend it, but you're free to experiment.


Rob(Posted 2004) [#7]
A method to remove the effect of lightmapping would be cool. This is proper illumination with lightmaps.


Kozmi(Posted 2004) [#8]
Ok! thank's Sybixsus for clearing that up for me there! I might try to experiment a little with this and see what happens! ;)


sswift(Posted 2004) [#9]
If you want to make a hardware light "remove" lightmapping wherever it is shining, ie, make shadows go away, then you have to set up your lightmap object/surface the following way.

Lightmap texture - add blend

Lightmap Surface/Object - Whatever blending mode you're using for it. If it's blended on top of textures then that would be multiply or multiply x2.

Lightmap object/surface must be white, with texture on top.
Must have fog turned off.
Must have ambient turned off, unless you want ambient light to make it so no area can be fully black.
Must NOT be fullbright.
Probably want to set specular to 0, but do not have to.

And that's it. Now all areas lit by lightmaps will be lit. But those areas which have dark lightmaps on them will be affected by the Blitz lights and brightened up accordingly.

The only caveat is that if your surfaces don't have enough polygons hardware lights won't light them very well. If you have a big flat wall, then you'll want it to be divided into a grid to make the hardware lights look better. Same for the floor.