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.

Work in Progress / WIP Lightmap generator

Author
Message
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 30th May 2003 18:59
I've been working on this lightmap generator lately. I do this mainly for learning purposes. It's not finished yet (and won't be for a while), but I thought I'd give you a screenshot.
What it does:
You define a few lights. Then you pass an object through the function.
This function makes a new object to go over the old one, and then calculates the lighting they receive and then puts all this data into one texture. And that's about it.



BTW there are three lights in there. Calculating took about a minute (is not very optimised yet).

Here is the original scene.



Kevil
rapscaLLion
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 30th May 2003 20:19
hey, that looks SWEET!!!

Alex Wanuch
aka rapscaLLion
hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 31st May 2003 02:05
really cool! so you could like extend the 7 light limit and make more virtual lights right.....

to live is to suffer, to survive, well, thats to find meaning in the sufferening.....
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 31st May 2003 02:13
Right! But they can't move .

Kevil

kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 31st May 2003 03:38
Some more screenies






Kevil

kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 31st May 2003 15:23
And here are screenies of a textured scene made by darkcoder with white lights.

Before:


After:



Kevil

Chenak
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 31st May 2003 15:29
thats pretty cool . How long did it take calc the lights?

Once you start down the Dark Path, forever will it dominate your destiny...
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 31st May 2003 15:42
Well, pretty long. About 2 minutes. But it's worth the wait. I always preview it with a low res lightmap texture. That usually takes less than 30 seconds.

Maybe if I do some optimizing I can make it go faster.

Kevil

rapscaLLion
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 1st Jun 2003 20:53
Well light map generation in any game or tool takes a long time. Don't worry about that so much as more features

Just a few questions:

Can you tone down the light intensity? I notice some of your screenies have glaring spots of light and such when it is too close to the wall.

Does the light bounce at all?

Is it just point lights or can you have spotlights as well?

How about strip lights like in quake and HL?

I know, these are all more advanced features so don't worry if you don't have them Just curious is all

Alex Wanuch
aka rapscaLLion
hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 1st Jun 2003 21:55
this looks better and better everytime i see it nice work!

to live is to suffer, to survive, well, thats to find meaning in the sufferening.....
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 1st Jun 2003 23:58
Quote: "Can you tone down the light intensity? I notice some of your screenies have glaring spots of light and such when it is too close to the wall."


Yep, you can set the max intensity of a light and just the intensity.
I introduced the max intensity feature with the textured level as you might be able to see. It can remove the glaring spots.

Quote: "Does the light bounce at all?
"


No, it doesn't have radiosity. But who knows in the future.

Quote: "Is it just point lights or can you have spotlights as well?
"


Only point lights for now. Might make some more in the editor. It's definately possible (That means I know how to do it ).

Quote: "How about strip lights like in quake and HL?"


What are those????

Kevil

hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 2nd Jun 2003 00:06
not sure but i think he means like in splinter cell?

to live is to suffer, to survive, well, thats to find meaning in the sufferening.....
SS1k
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: United States
Posted: 2nd Jun 2003 04:50
Wow. Sweet!!!

Just, let me know when you project first comes out for comercal use. Heck, I whould even pay for it! Because if I can use it, you are definatly are in the credits and on the payroll for my compony!

.:SIDEP0CKET:.
:..>Mind is Thought
:..>Play is Fun
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 2nd Jun 2003 22:38
Wait a few weeks and I might have finished my editor.
It will be free though .
I haven't done much on it yet, but here is a screenie for now.


Kevil

hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 3rd Jun 2003 01:04
Thats one kind gesture giving something of this quality to the db community for free! the editor looks great what are u using to make it?

to live is to suffer, to survive, well, thats to find meaning in the sufferening.....
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 3rd Jun 2003 01:14
Well, uhm, DBPro . What else????

Kevil

hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 3rd Jun 2003 03:13
well i meant the editor.... 'cus it looks windowish which gives a kinda formal and professional look to it

to live is to suffer, to survive, well, thats to find meaning in the sufferening.....
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 3rd Jun 2003 11:53
I meant the editor too. The interface is mainly drawn using the line and box command. I did want to give it a windowish look though.
But it is all made in DBPro.

Kevil

SamotH
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Greece
Posted: 3rd Jun 2003 16:40
very nice, but isn't there a problem with the black edjes of the faces? they are too dark

My wizards are many, but their essence is mine. Forever there are in the hills in their stone homes of grief. Because I am the spirit of their existance. I am them. I am the black wizards
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 3rd Jun 2003 16:48
Well, that has to do with the anti-aliasing. There might be a way to remove it(although hard), but I like it this way.

Kevil

SonicBoom
21
Years of Service
User Offline
Joined: 26th Nov 2002
Location:
Posted: 3rd Jun 2003 17:38
Horray for Kevil! Excellent work dood!

I for one searched around for a utily JUST like this program and found one I liked which, similarly, was still in development. Despite this they wanted $18 for it but I'd much rather support the efforts of a DB developer (and its currently FREE ).

A quick question though: when you implement this into your game do you need to load 2 models and then "Dark ghost" the lightmap version? Or does it use dbo format and if so does the new dbo format support using just one peice of geomentry but support the "double texture" & extra UV coords of the light map (thus being far more econimical on polygons)?

Also I take it this program if for creating light maps only and NOT modelling - thus all models are imported/exported, so what formats do you plan to support for import/export?

Once again Great Work indeed!
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 3rd Jun 2003 20:51
Thanx

Quote: "A quick question though: when you implement this into your game do you need to load 2 models and then "Dark ghost" the lightmap version? Or does it use dbo format and if so does the new dbo format support using just one peice of geomentry but support the "double texture" & extra UV coords of the light map (thus being far more econimical on polygons)? "


For now it will be 2 models. But if there is a possible way to put it in one model, I will definately try that out. But I can't think of a way to use different UV coords on the same model for now.

Quote: "Also I take it this program if for creating light maps only and NOT modelling - thus all models are imported/exported, so what formats do you plan to support for import/export?"


Yes, you will need to import/export the models. (Look at the "X" icons). It will probably support all the models DBPro can support. (so only .x until patch 5)

Now I have a problem at the moment. I can't load objects when inside a function, but the same code works outside the function. Talking about weird :S

Kevil

Kevil

rapscaLLion
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 4th Jun 2003 00:10
lol striplights was not a good way to describe it.
I'm talking about textures that emit light. So you
could make a strip of flourescent lights and have it come out evenly from the surface of the object with that texture. Any good HL/Quake etc mapper knows that those are the most used and realistic type of light, because point lights look surprisingly like pointlights, no matter how well they are placed. I suppose that's a lot harder to do tho...

Alex Wanuch
aka rapscaLLion
haggisman
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 4th Jun 2003 11:13
I dont think they are so much harder, just a hell of a lot slower. I guess you could say it would be like placing a lot of point lights in a row.

project: light/obscurance mapper (80% done)
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 4th Jun 2003 13:20
Yeah, my thoughts exactly. I might implement it in the future, but not in version 1 of my editor (which will only have point lights). But that will take a while too, because I have to go away for a week tomorrow. But after that I might be able to finish a version quickly.

Kevil

kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 4th Jun 2003 20:48
Here is the latest shot of the editor.



Plz post all the suggestions you have for this here, so I can read them later when I get back.

Kevil

n3t3r453r
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Russia
Posted: 7th Jun 2003 12:52
Exacly as I've fortelled

I'd like to change the world, but God doesn't want to give me sources!
Hell IVIonkey
21
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 7th Jun 2003 13:24
Suggestions:

Perhaps the ability to change the "chop size." This is basically how large/small the subdivisions on a given face are created for the purpose of illumination. Large chop values result in stair-stepping lightmaps, but are faster to render.

Also a variable lightmap smoother so you can configure how sharp a shadow should look.

Eventually, switchable lights. You'd have to break the lightmap up into sectors and render all the possible outcomes of light switching in a given sector.

Ability to add "fake faces" so that you can cast shadows to areas that shouldn't normally recieve a shadow; don't import these into the final model, but just use them to determine the texture illumination.

Little things, like the ability to adjust the global lighting scale, RGB gamma, cutoff values for rendering lighting of 0 luminosity (like anything under 10 will recieve a 0), ambient lighting (as a vector: direction, intensity, color).

Hope these ideas help... I look forward to seeing you develop this project!

Hell IVIonkey
21
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 7th Jun 2003 13:31
Oh, as for the anti-aliased black edges...

You perhaps could expand the face's texture by a few units, depending on your chop value (have it repeat/tile from the center rather than resize), apply the lightmap to it and do anti-aliasing, then crop the expanded (tiled) texture to its original size (removing the tiling effect), then applying it to the face again.

It could work...

kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 12th Jun 2003 21:59
n3t3r453r:

It's not the same, at least I thought .

Hell IVIonkey:

You can already change the "chop size". It's defined as units per texel and works great. A smoother lightmap can be accomplished to play around with the settings, so it does that too.
Switchable lights is hard, but that may come in a later version.
Fake faces can be done manually. Just use a different model to put through the lightmap generator and it will work.

And for the rest, the most things can be done. Anyway, nice suggestions, I'll see what I can do .

Kevil

n3t3r453r
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Russia
Posted: 14th Jun 2003 18:32 Edited at: 14th Jun 2003 18:35
Of course, not the same, but the theme is rather similar

I'd like to change the world, but God doesn't want to give me sources!
pugmartin
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: United Kingdom
Posted: 16th Jun 2003 18:40
Amazing!!!

pugmartin
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: United Kingdom
Posted: 16th Jun 2003 18:42
I bet if you just went into that nice little searchy thingy that kangaroo put together n typed `Kevil`, it`d come up with a whole host of great bits of code! Good work mate and keep it up

Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Jun 2003 20:47
hey Kevil if you can find your way to sending me a copy i can give you some good eyecandy

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 16th Jun 2003 21:56
You're on .
Only need to do some more stuff about the editor. I've got lightmapping working in the editor now, only need open/save/export/import features.



Kevil

Misanthrope
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location:
Posted: 16th Jun 2003 23:12
Looks very impressive.

I do have one (probably off the wall) question...is there any chance that in a future release, you could have it accept command line parameters so that if another app shells it out, it'll read in a file storing light information?

Reason I'm asking is because I'm working on a modernized version of a DarkBasic level exporter plugin for 3D Canvas Pro that I wrote about a year ago, and I think it'd be neat if I added in support for your lightmapper. (i.e., writing out light data to a file specification of your design, and then shelling your lightmapper with a commandline telling it where to find the lighting file).

Anyway, your screenshots look promising. Good stuff.

-Misanthrope
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 16th Jun 2003 23:48
Do you mean you want to be able to get light data from a file to use in my lightmap editor? In that case, I just made a light data exporter and importer, so if that's it, I can give you the file format and it'll work.

Kevil

Eddie Gordo
21
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 16th Jun 2003 23:56
someone may have asked but can you perform this on an animated character-type model. otherwise great work

In our hearts and minds we keep the powers of love, hope and the hidden powers of evil in which we can mold a hero or daemon of ourselves-Book of Enoch Chapter III
Misanthrope
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location:
Posted: 17th Jun 2003 00:15
Kevil, that's perfect. The file format would be greatly appreciated.

-Misanthrope
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 17th Jun 2003 01:12
Ok, I will include the file format in the help file then.

Eddie Gordo:
Nope, lightmaps are not made for that. You'll have to use realtime shadowing/lighting to do something like that.

Kevil

Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 17th Jun 2003 03:14
fair enough i won't be around the forums much for the next week but i'll look forward to the email with this ... i think between this and JTEditor i'm gonna have alot of fun hehee

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 17th Jun 2003 13:16
Yippee, I've finished open/save/export/import features. Actually the first version is finished now, but I'll do some more testing before I release a beta version.

And many thanx go to Tdk_man, because I used his file selector for the open/save/export/import features and it works great.



Kevil

Andy Igoe
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 17th Jun 2003 21:41
You impressed me with your memblock matrix Kevil, and you've impressed me again.

I can't wait to try this tool out, it's the final piece of the jigsaw in a game I was thinking about making.

If I do the game and use this tool i'll be sure to send a little reward your way In the meentime, please keep impressing me - you do some stunning work.

Pneumatic Dryll
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 17th Jun 2003 22:29
Hi,

I've always wondered about lightmappers - how do you do them I@ve always wanted to have a go but I've never managed it. Did you use memblocks? (obviously)

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 17th Jun 2003 23:25
David:
Just search for some documents on the net, like I did. You'll find what you need.

PneumaticDryll:
I'll do my best .

Kevil

David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 17th Jun 2003 23:32
Have you any links? My initial searches have been fruitless but i@ll keep searching

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 18th Jun 2003 03:46
http://www.gamedev.net would be a good starting point

I pride myself that i don't kill...
well not without a good reason
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 19th Jun 2003 12:50


i'll email you the model later... but i'm having a little trouble lol
the model does load (it takes about 5mins and the editor appears to lock) but there is a slightly bigger problem than than lol

I pride myself that i don't kill...
well not without a good reason
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 19th Jun 2003 13:29
lol this could take a while... i'm emailing the model & basic project now for you to play with - but i keep trying to create lights and ending up with "object out of range" or something like that.

I pride myself that i don't kill...
well not without a good reason
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 19th Jun 2003 15:14
Yea, I know what the problem is, and I told that to you. Your level is very complicated. You probably left the unitsperpixel value at 5. For a level of this size (it has to do with size and polies) it will create a very high res lightmap. Since I put the maximum to 2048x2048(I have an array of this size) the array will go out of bounds and that is probably your problem.

The model taking that long to load is normal with a normal like that I guess.

But the main problem with your model is the creation of the overlay model. (something I hope won't need to be done anymore with the future .dbo system) That's because it's a model that's very big and has very small details. It gives very wierd blitting, but if I set the threshold to 2.5, the blitting is almost gone, but it will look weird up close.

Kevil

Login to post a reply

Server time is: 2024-05-02 07:26:19
Your offset time is: 2024-05-02 07:26:19