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.

3 Dimensional Chat / Lightmap Creation (Screenshots)

Author
Message
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 27th Apr 2004 02:29
Following my recent post in the WIP section. http://darkbasicpro.thegamecreators.com/?m=forum_view&t=30216&b=8
I decided to take on the challenge of adding light mapping to my level editor.

This obviously is no easy challenge to take on, so I'm in need of some help. Spending hte majority of my day at flipcode, I've learned alot. (And from reading a few prior posts on lightmapping)

First and formost, if anyone has Kevil's lightmapping program please send it here. [email protected] (If not I guess I'll have to bother Kevil)

Alright, now the objective.

Create something like this.


I've got a simple fundamental of lightmapping using the lightmapping command.


I'm really a little confused about how to create a scene as above. Do I understand correctly that I have to use 2 objects, 1 being ghosted and lightmapped to make something like the above?

Ideally what I'm aiming for, is to go into my editor, place a light source and have the walls/floor/roof effected by the light source.

So how should I approach this?

I've got a few ideas....

1.) Make a plain and set the gamma&transparency really high so it appears to be light/dark.(Probebly would be hard and inefficient)

2.) Make two of every object. Then ghost and lightmap the second object. Objects are ghosted based on how close they are to the light source.

Perhaps I'm going the wrong way, maybe I already did something right but didn't know it. I'm looking for some ideas and your input will be valued.

Thanks for your help, I'll post on my updates and plenty of screenshots.



A book? I hate book. Book is stupid.
(Formerly known as Yellow)
QuothTheRaven
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 27th Apr 2004 02:33 Edited at: 27th Apr 2004 02:35
Take your level, fully textured, with no lightmap. Copy ALL the geometry EXACTLY. Make an exact clone of the old level that exactly overlaps the old level. Remove the texture from the copy and texture it with only the lightmap. Then dark ghost the object. Unless you're using BSP's then that's really the only way, unless you have the lightmap in the unwrapped texture of an object. If you're using tiled textures, you have to clone the level.

I used that method to create this:


MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 27th Apr 2004 02:49 Edited at: 27th Apr 2004 02:51
Ah yes, I was hoping you'd post QuothTheRaven.

I might have some trouble though, as the users will be making there level from 1000 tiles. This will make my saving of the level very difficult as I'll have to combine the entire level into one mesh, and then find a way to keep the textures like it was. This might mean storing/exporting the UV data which won't be too hard...

If I were using a modeling application to make the level, this might be easier.

Although, I have an idea. I might be able to make seperate objects(like a torch/candle/etc...) and use light mapping on them to appear to have lit the scene.

Hmm, this is proving a difficult task.

As you can see, there's 1000 different tiles that are all individuals. when one is clicked it's raised. At the moment the level is exported/saved as 1000 objects.(Rather inefficient)

(GUI not pictured. Red is current selected tile)


So I suppose if I combine the objects into one mesh, then make object from mesh, save the texture data, and finally have the object loaded into a third party program lightmapping would be easy.

I'll have to ponder over this, but thanks for all the help Quoth. I've got some ideas going.

(Mind the rambling)


A book? I hate book. Book is stupid.
(Formerly known as Yellow)
QuothTheRaven
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 27th Apr 2004 06:35
Yeah, the problem with my method is that you're going to have as many textures as you have objects. So clearly, the most efficient way for this lightmap to work is if you have very few objects.

Peter H
21
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 27th Apr 2004 17:24
QuothTheRaven- could i put lights into my game using your method? if so how do i make a lightmap? and i don't think dark ghosting works in DBPro (bug or something )


Formerly known as "DarkWing Duck"
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 27th Apr 2004 23:18
Dark ghosting should work fine Magellan. I'm on patch 5 and it works. Just play around with the flags.
------------------

Alright, I have an idea for minimizing the object count.
Just going to need to make a very clever alogrythm.




A book? I hate book. Book is stupid.
(Formerly known as Yellow)
QuothTheRaven
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 28th Apr 2004 00:40 Edited at: 28th Apr 2004 00:41
Magellan Studios, if you want to use a lightmap like I did in that screenshot, then your level must be a .X file. Model your entire level, fully textured, without lightmaps.

You need a program that will lightamp for you, however. You cannot create the lightmaps in DBP. I personally use 3ds max, it has a rendering option to create a lightmap texture. Once your have your .X level completely modeled, save a new copy of it. Then completely remove the texture and make everything white. Then render the lightmap into that white texture in your modeling program. If done properly, you can delete all the lights, and there will still be shadows and highlights, because they're in the lightmap.

Then, in your code, you load the completely textured model, and then you load the lightmap only model. Since you never edited the geometry, the two levels will exactly overlap, and for some reason the textures will perfectly blend together, so if there's a black shadow on your lightmap it will blend into the textured level and create a shadow on the texture itself.

That's how I did the shadows from the light in my screenshot, one level object contains all the brick and grass and door textures etc, and one of them has only the shadows. They both overlap perfectly to blend together.

That's the best method I've found so far, but y ou need a program that can render lightmaps, and you need to use .X levels. You can't build them out of DB objects.

A while back I wrote a tutorial about how to get lightmaps into DBP using 3ds max. The links is here: http://www.thegamecreators.com/?m=forum_view&t=24024&b=3

Peter H
21
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 28th Apr 2004 00:58
i have GMax...and i don't think it supports rendering\lightmapping ...if it does then please tell so!

if not then...is there any free program\software that i can make a lightmap in?


Formerly known as "DarkWing Duck"
QuothTheRaven
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 28th Apr 2004 02:20
Nope, Gmax doesn't render lightmaps. And I don't know of any free ones, you can buy Gile[s] lightmapper from this website, however.

Peter H
21
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 28th Apr 2004 19:00
ya i was trying to avoid shelling out $50 though...but i suppose i should get it if i want lightmaps


Formerly known as "DarkWing Duck"
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 28th Apr 2004 19:22
Mike,
Are you sure you need rendered lightmaps?

For your engine, you could use the data to generate a memblock mesh, with vertice colours and with absolute minimum polygons. You can use the vertice colours to lightmap the level - would look pretty good in a maze game. This method would push your FPS as high as possible because there's no need for extra lightmap object, and the level can be 1 huge object - that's before I mention the Zdepth interference that Carto Shop owners are constantly hampered by.


Van-B


The nature of Monkey was irrepressible!.
Gir
22
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Crazy Taco
Posted: 28th Apr 2004 20:48
Ummmm...i didnt read all of the posts so sorry if this has already been covered, but there is no need to have double the amount of objects, just to get the other texture(lighmap) into your scene. If you have both textures you could just use something like photoshop and ghost the lighmap over the texture map. Ive not tried it as i have Gile[s] but it shud work perfectly without doubling your poly count!

Pete

I'm makin' a cake...
2kilo
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location: London
Posted: 28th Apr 2004 21:06
this is what I have found so far...

THE SOLUTION
Giles at the mo for me... You can either generate your own light maps [externally] and import to Giles, organise the texture layers then export to .dbo format which supports mutliple UV's.
Or just use Giles to create the lightmap. [I have found that I need to import the model with the UV I would use for the lightmap, then tile extra textures on the other layer].

OTHER ATTEMPTS?
-You can bake illumination to a UV map [Lightwave, etc], load the oringal .x file, load the image file, then use "set light mapping on".
PROBLEM: DB will only allow .x files one set of UV's therfore no tiling.

-You can use two .x models, both with the same geometry, but one contains just the lightmap. Then use the "Ghost" command. This will allow tiling.
PROBLEM: double the polygons plus the ghost overbrightens, [setting the ambient to around 65 seems to work]. Also some z-buffer issues...?

I think Giles is well worth the money just to able to get at the .dbo file format.
QuothTheRaven
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 28th Apr 2004 22:40
Quote: "Ummmm...i didnt read all of the posts so sorry if this has already been covered, but there is no need to have double the amount of objects, just to get the other texture(lighmap) into your scene. If you have both textures you could just use something like photoshop and ghost the lighmap over the texture map. Ive not tried it as i have Gile[s] but it shud work perfectly without doubling your poly count! "


This is actually a really bad idea. Most games work on the principal of tiled textures. If you need to cover a huge wall, you don't have to create a huge texture for it. However, if you bake your lightmap into the textures, that means you can't used any more tiled textures. So to cover the huge wall, you need a huge texture, it can't be tiled, because the lightmap verticies and the texture verticies must line up.

Gir
22
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Crazy Taco
Posted: 28th Apr 2004 22:44
Yeah i didnt really think about massive objects!

I'm makin' a cake...
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 29th Apr 2004 00:11
@2kilo

At this point I want to avoid having to use third party programs. It'd be nice, and much more efficient if users could just do everything in one editor and not have to pay extra for gile[s]. (Even though gile[s] is very useful.)

If worse comes to worse though, I will result to gile[s].


---------------------------------------
@Van-B

I'm not to familiar with vertice colors, could you elaborate a little more. I'm guessing that vertex coloring would blend the texture according the the color of the verticies? (Do I assume correctly? Might have to bother you,kevil, and the Rosewall racer people a little more. )

Sounds like an efficient way to go about doing things though. I'm going to work on converting my level to one memblock, and hopefully by then I'll find out a little more about these vertice colors. The attractive part of this method is that this method will be simplier. Not to mention loading times shortened without having to precalculate the lightmaps.
--------------------------------------------

Any more solutions/suggustions or comments are appreciated.
(Meanwhile I'll try to figure out vertice colors)



A book? I hate book. Book is stupid.
(Formerly known as Yellow)
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 29th Apr 2004 11:20
Once you take a look at kevils memblock matrice example you'll see how vertice colours come into effect. They're really easy to set with the function Kevil made for adding vertices to the memblock, that's what I use to keep things sensible.

For calculating your lightmaps your really lucky with your game idea because it should be a breeze. For each side of the wall, like each wall surface you have 4 positions that you can colour a vertice, so if you start from each corner, a little bit away from the edges though, then project this point towards each light source - then if there is nothing between that point and the light source you can colour the vert depending on the distance from the source. The cool thing about vertice colours is they blend across the polygon, so the actual gradients in your vertice lightmap will be smoother than if you had a rendered lightmap.


Van-B


The nature of Monkey was irrepressible!.
2kilo
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location: London
Posted: 29th Apr 2004 20:45
@MikeS

"do everything in one editor" I know exactly where you are coming from, me to. But untill patch 6 [vapourware?] this seems impossible?

Am I right? You would need a lot of vertex points to create a light map with realistic qualities that shift with subtle changes?
Mussi
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 29th Apr 2004 21:30
I'm workin on an editor myself and I'm adding lightmap functionality to , I'm makin my own lightmap function, need to do some stuff before it works correct. but weigthing for upgrade 6 might be the best thing to do



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 30th Apr 2004 02:40
Ok thanks for the help Van. I'll explore Kevil's method throughout the weekend.
------------
Sounds great Mussi. The only thing is, I really don't want to wait for U6 for anything. No telling when it'll come out.
-----------
2kilo, it'll probebly be very difficult but I'll try Kevil's method based on Van's suggustion to hopefully get some nice results.
-----------

Thanks for all the help.



A book? I hate book. Book is stupid.
(Formerly known as Yellow)
walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 30th Apr 2004 07:40 Edited at: 30th Apr 2004 07:41
indeed, VanB`s idea seems spot on. if your objects are all simple like that, you should be able to use the intersect object command to make a simple ray-caster.

creating shadows, however, is another story. that's some very complicated math. plus you have to deal with multi-texturing.

good luck by the way!!

by the way, Gile[s] was mentioned in this post quite a few times, and I must say it's fantastic.

http://walaber.dbspot.com/sbf/rolling02.jpg <- big image

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 30th Apr 2004 12:51
Coding the lightmapping part should be easy as pie, I added a test lightmapper to vanMESH yesterday in the space of about half and hour - just enabled poly collision on my object, then stepped through each vert and coloured it if there is no collisions - I used the camera position as a light (until I add entities to handle this stuff). You'll probably spend more time messing around with the level object display properties than the lightmapper itself. You can get the vertice lights looking nice and defined because I've done it before - I need to check up on what I did though.

One thing though - I dislike the built-in collision commands, I just don't trust them. What I'm gonna do is position a dummy object at each vert location in turn then point the camera at it - then do a pixel check to see if the object is visible, should be much more stable and accurate but also a little slower.

2Kilo,
Vertice lighting affects the whole polygon and is pixel smooth - like you are restricted by the size of your polygons, but the blending of colours is perfect. You'd really need to tile the floor, like use several polygons on the floor, but that'll probably be done in the engine anyway if it works on a 3D grid type thingy. Using 1 big plain for the ground is not a good idea when trying to make lightmaps.


Van-B


The nature of Monkey was irrepressible!.
eat much pie
21
Years of Service
User Offline
Joined: 9th Apr 2004
Location: Within the mind of a lowly mortal...
Posted: 30th Apr 2004 18:40
Some people were talking about making another object, applying lightmaps, and dark ghosting it, but why? Why don't you just use the 'Set Light Mapping On' command?

One by one, the penguins are stealing my sanity...
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 30th Apr 2004 19:12
Because that's only for texturing a precalculated lightmap on an object - not at all usefull really when you have no lightmap texture and your level model uses multiple texture files.


Van-B


The nature of Monkey was irrepressible!.
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 1st May 2004 06:18 Edited at: 1st May 2004 06:18
Ah, it's all starting to sink in now Van.

I really was having a hard time visualizing how coloring verts helped out until I added a wireframe display mode for my level editor today.

(Sorry had to be a .bmp, JPG was too low quality.)


As you'll see from the screen, the verts are either dark or light depending on the light source. ( I even raised some tiles so you'll see how they'll look dark on one side and light on the other.
------------------------

I've been looking through kevil's code on his memblock matrix and am sort of understanding how this process will work. Will probebly take me a good couple days(hopefully by this weekend or next) to get this in place.

Thanks for the help everyone. Please post any suggustions, other methods, or anything else you find useful for this thread. I'll post results whenever I finish(or need help).



A book? I hate book. Book is stupid.
(Formerly known as Yellow)
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 3rd May 2004 12:18
Ahh, good to hear your figuring things out.

One thing I noticed, if you disable lighting you get much better results from the vertice colouring, and your object displays faster. If you lightmap your level through the vertices then you can dispense with lighting the model altogether - the vertice colouring will look after that and the model will totally rely on your vertice colours.

I mentioned that I added a lightmapper to vanMESH, well I changed it yesterday to use a dummy object that is placed at the vertice location. I position the camera at the light source then I place the dummy object and point the camera at it. Then I check the screen location to get the colour of the pixel, then hide the dummy object and check the colour of the pixel against the first colour. If the colours are different then the vertice is affected by the light (depending on the 3D distance from the light source). That even supports transparent textured objects because it's totally visual - does'nt rely on any collision system . I strongly advise this as a neat and easy lightmap solution.


Van-B


The nature of Monkey was irrepressible!.
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 3rd May 2004 23:22
Thanks for all the help Van B.

I've also spoken to Kevil and he's helped step me through the process. Now all that's left is to put it in code.

I'll of course post some screenshots once I get this implemented, although I'm not guareenting a time frame. These days lighting is key to good games(or level editors ), so I don't want anything rushed.



A book? I hate book. Book is stupid.
(Formerly known as Yellow)

Login to post a reply

Server time is: 2025-06-28 16:22:00
Your offset time is: 2025-06-28 16:22:00