Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / DarkLights - Disabling an individual lights' lightmap!

Author
Message
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 24th Mar 2008 17:35
Hi,

What I want to do is disable a lightmap for an individual light. For instance, when the player hits a light switch the lightmap for that light would be disabled. Well to be more specific, I want to force each light in DarkLights to create it's own lightmap, so I can loop remove the lightmap from the objects it has been applied to. Like dynamic lights in FPSC.

Thanks in advance.

Much good work is lost for the lack of a little more.
Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 24th Mar 2008 19:15
Well its quite easy actually - what you should do is to loop through each light in the scene and re-render light maps with this light turned off. Downside would of course be the produced amount of lightmaps which would take a lot of space.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.7
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Mar 2008 19:18
Is there no way to generate a light-map texture per light and blend them, so you could just enable/disable individual texture layers?

monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 24th Mar 2008 20:06
Yeah, I suppose I could just add one light at a time to DarkLights, build the lightmaps then do the same for all the lights in the scene.

Thanks guys I will give it a try.

Much good work is lost for the lack of a little more.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 31st Mar 2008 01:07
How did that turn out monotonic?

monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 31st Mar 2008 22:04 Edited at: 31st Mar 2008 22:07
KISTech,

I haven't had a chance to try it out yet, sorry. I've been really busy the last week, moving house.


EDIT:

I have been thinking about this though, if I render a lightmap for one light, the areas that aren't effected by the light are going to be black. Now, if this is blended with another lightmap for a different light, then the black areas are going to conflict with the other lights' effect on the final colour. I haven't thought of a way around it yet, still thinking though.

Much good work is lost for the lack of a little more.
Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 31st Mar 2008 22:52 Edited at: 31st Mar 2008 22:53
Maybe you should limit your game/map so that in a room only one animated light source could be created? This would work until you apply/render light maps separately for each room but will introduce a lot limitations for level design. I guess that would work for a simple fps like HL1 but something more advanced would get limited.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.7
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 31st Mar 2008 23:50
Yeah, this is would be a problem.

I've been thinking about applying an alpha map to every lightmap, which will mask the area covered by every other light in the scene but not the current. This would leave the dark areas intact where needed and allow other lights to influence the scene without getting interference from the dark areas in other lightmaps.

But, this sounds a little hacky to me. What do you think?

Much good work is lost for the lack of a little more.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 1st Apr 2008 00:08
I just purchased DarkLights this weekend, and much to my disappointment there really isn't a lot added to the lighting for DBPro with it except that you can generate lightmaps on the fly now. I was hoping for more dynamic shadowing functionality.

It seems the power of DarkLights comes from the lightmaps that you can generate while you are building your level. While that's not exactly dynamic, it's better than baked in shadows.

My question is, what happens if you just continue your program's main loop and shift the position or change the color of the DarkLights lights, and then start the lightmap thread again. It should recalculate the lightmap on the fly and give you what you're looking for, in theory. (if it doesn't crash because you are rendering objects that the other thread is modifying.)

However, if you are able to do that with DarkLights and get away with it, then I see great possibilities.

monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 1st Apr 2008 00:18
Rendering lightmaps is a slow process, far too slow to do in realtime.

Much good work is lost for the lack of a little more.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 1st Apr 2008 01:25
Didn't work anyway. I set up a scene and started off the lightmap thread, but let the program continue into the main loop while it was still generating the lightmap. It was choppy for a while, then when it got closer to the end of the lightmap generation it crashed. Probably right about the time it tried to update the objects.

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 1st Apr 2008 01:27 Edited at: 1st Apr 2008 01:27
Question:

Is DarkLights strictly for lightmapping? or can you use it for dynamic lighting in game? I suspect I already know the answer to this, but figured I would ask anyway..

monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 1st Apr 2008 01:29
DarkLights is for lightmapping only.

Much good work is lost for the lack of a little more.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 1st Apr 2008 01:36
That's pretty much what I was afraid of.

Ah well, I've never been able to get the lightmap to show up when I create a model in 3D World Studio, so this will end up helping me anyway.

Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 1st Apr 2008 18:04
@Monotonic -

I want to return to HL1. What I liked it's light mapping system is that it generated a lot of low quality light maps. But it somehow managed to do animated lights too. If you have played it then you would definitely remember that there were sorta 'light mapped dynamic lights' if you can find some info about it or even better obtain HL source code (if I remember correctly it was released before) you could see how its done and stored.

Speaking about your idea on alpha values - it would work BUT I don't have a clue how would you implement this with DL light maps. Only way you can do this is to go through all generated light maps, find where they are placed detect how many lights are overlapping and mask out black parts of other light maps. In my opinion this would be something too heavy for me and for other average DBPro users and on the other hand it would introduce a lot preprocessing which would lead to a way too long light mapping time.

Once again do a search on HL light maps you might find something interesting.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.7
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 1st Apr 2008 18:07
Olby,

Yeah, good thinking. I will have look around see what I can dig up on HL and report back with my findings.

Much good work is lost for the lack of a little more.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 1st Apr 2008 20:34
If one of you get the chance, could you take a look at my thread on the 3DWS board here? I'm having a problem with lighting and no one seems to be jumping in to give any feedback.

monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 1st Apr 2008 21:04 Edited at: 1st Apr 2008 21:07
Ok,

I haven't been able to find the source for half-life 1, but while searching the internet it seems that dynamic lightmaps aren't out of the question. So long as they are used sparingly, and they use pretty low res' settings.

So I tried implementing this, but I seem to be having a problem. The first iteration of the lightmapping process works ok, but as soon as I try and update the lightmaps the whole scene is rendered with no light what so ever i.e. black.


Here is the code I'm using, if anybody would be so kind to take a look I would appreciate it. I have attached the model I'm using, it doesn't contain any textures though, but that is not a problem.



Much good work is lost for the lack of a little more.

Attachments

Login to view attachments
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 1st Apr 2008 22:57 Edited at: 1st Apr 2008 23:03
Figured it out, if you call lm set ambient light before the main loop the lightmapping works.

Revised code:




This is supprisingly fast, obviously if the map or room is more detailed you would have to reduce the quality of the lightmap by a fair bit.

Much good work is lost for the lack of a little more.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 2nd Apr 2008 00:07 Edited at: 2nd Apr 2008 01:27
Wow, that really is fast.

That's essentially the dynamic lighting I was sort of trying to do earlier. Way cool.

Except when I add it into a scene it looks like crap...

Login to post a reply

Server time is: 2024-10-18 07:58:07
Your offset time is: 2024-10-18 07:58:07