Lightmapping

A forum just for you old time Descent and Descent2 players.
Post Reply
Lehm
DBB Ace
DBB Ace
Posts: 121
Joined: Thu Nov 05, 1998 12:01 pm

Lightmapping

Post by Lehm »

Don't know if anyone notice, but lightmapping has been put into the latest version of d2x. There still a few issues with it, but once those are resolved it should look something like this.

http://www.geocities.com/lehm_2000/d2x/scrn0003.jpg

Now you must have a higher end card for this feature to work. We're Talking Geforce 5+ or Radeon 9+. We're having a few performance issues. So if it runs slow on your system let us know. And I mean RUN, I know it takes a while to load the levels right now, I'm working on that. I should mention that the option is located in the render options menu. Remember this is just a preview, it will get better.

Oh yeah and thanks to Riot for testing it.
User avatar
Riot
DBB Ace
DBB Ace
Posts: 42
Joined: Wed Jun 01, 2005 2:15 pm
Location: Portland, OR
Contact:

Post by Riot »

Alright, here's my jaunts through Counterstrike with some of the new lightmap code (the water levels were very unimpressive, I was sad.) Anyway, this is on my Sapphire Radeon 9600 Pro 256MB

I love Descent so much, <3

Image

Image

Image

Image

Image

Image

Image

Image

Image
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6458
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

what exactly are you doing that needs such high-end hardware?

how exactly are you guys calculating the light-maps, and are you planning to cache the calculated light-maps in future releases?
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6514
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Post by Jeff250 »

This is about what it looks like on my Geforce FX 5950...
Image

If it's not apparently obvious, both the white and other colored lighting is there, but just very, very subtly. The good news is that my framerate never dropped below a solid 120.
Lehm
DBB Ace
DBB Ace
Posts: 121
Joined: Thu Nov 05, 1998 12:01 pm

Post by Lehm »

fliptw wrote:what exactly are you doing that needs such high-end hardware?

how exactly are you guys calculating the light-maps, and are you planning to cache the calculated light-maps in future releases?
The only practical way to enable lightmapping with the way the texture stages are setup was to use pixel shaders. And those are only supported on higher end systems. Beleive me I tried to get it to work using normal blending but it just wouldn't work.

The method for calculating is currently brute force. Every pixel is calculated one at a time. That's why it's so slow, I'm working on a much more efficient way to do it.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6458
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

cool.

as for Pixel shaders, make sure you are doing a proper check for vendor, as ATI and Nvidia's pixel shader engines use different implementations for PS 2.0, which explains what me and Jeff250 are seeing - something about pixel precision.
Lehm
DBB Ace
DBB Ace
Posts: 121
Joined: Thu Nov 05, 1998 12:01 pm

Post by Lehm »

The rendering problem isn't a vendor issue. Diedel tried to change some stuff and it didn't quite work out. That should be fixed in the next version...I hope.
User avatar
Tyranny
DBB Defender
DBB Defender
Posts: 3399
Joined: Sun Nov 10, 2002 3:01 am
Location: Phoenix, Arizona

Post by Tyranny »

Looks great so far other then being a bit sluggish on 800x600. I was running it on 1024x768 and 1152x864 sans-lightmapping. Level load delay wasn't "horrible". It was actually quite tolerable. I've seen worse...but it did load, which was good.

However the effects don't stay if you adjust resolutions while in-game on my end. You have to leave the level and change the settings and then restart a level. The whole level becomes dark with mixed effects happening on the textures. If you want screenshots I can provide them if they're needed. Same them happens when I ctrl+enter'd to minimize the screen. Just imagine the whole level going dark and someone came in and spray painted glow-in-the-dark paint on the walls ;)

System:
P3 1.0ghz
512mb SDRAM
GFFX5200 256MB

Good work though :)

Martyr Prime: Lightmapped!
Image
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

I have restructured Lehm's lightmapping code a little, as it was pretty experimental, and may have introduced a bug or two when doing so. There is the original Lehm code path in my code adaption available though, too, and I cannot see it producing better results than mine. :(

I also have to say that I don't really like the lightmapping rendering results yet, because they seem to take away contrast pretty much, letting everything look somewhat washed-out and dim.

Finally, very strangely it totally breaks my X800 XT PE, while running fine on a GF 5200 FX. :?:
User avatar
Aus-RED-5
DBB Friend
DBB Friend
Posts: 1604
Joined: Fri Apr 23, 2004 7:27 am
Location: Adelaide, South Australia
Contact:

Post by Aus-RED-5 »

Well I tryed it out.
Running D2x-w32 on a P4 3.2 Ghz w/HT 800FBS, 1G Memory and FX5950 Ultra 256MB card! Screen res 1280x1024 Full screen and ran smooth with no probs! But like Diedel said.... "everything look somewhat washed-out and dim." Yes that it does but I still like it. Keep up the good work guys! :)
Thanks
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

I have been able to fix the bug in my lightmapping code adaption. I have run into a few other problems though: Primarily dynamic lighting not working (flashing/exploding lights, flares).

I also found that for some strange reason the debug version of D2X-W32 (simply compiled w/o any code optimizations) on my workplace machine successfully acquires all necessary functions from the OpenGL library, while the release code does not. This is true for both MSVC 6 and MSVC .NET 2003. Weird.
User avatar
Nosferatu
DBB Ace
DBB Ace
Posts: 483
Joined: Mon May 23, 2005 5:15 pm

Re: Lightmapping

Post by Nosferatu »

Lehm wrote:We're Talking Geforce 5+ or Radeon 9+.
Just for information purposes, GF4 Ti's also have pixel shaders. I tried it out on my Mad Dog GF4 Ti4200 with 64M memory. Worked like a champ. I got very similar results as some of the posted pics.

I know for a fact GF4 MX's do not have pixel shaders. You need a Ti. So thats just another card you can add to the compatability list. :)
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6514
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Post by Jeff250 »

Was the light map toggle moved or removed from the render options menu?
User avatar
Riot
DBB Ace
DBB Ace
Posts: 42
Joined: Wed Jun 01, 2005 2:15 pm
Location: Portland, OR
Contact:

Post by Riot »

Jeff250 wrote:Was the light map toggle moved or removed from the render options menu?
I concur.
Hey is anyone up for game?

edit: where can I get Martyr Prime?
User avatar
Skyalmian
DBB Admiral
DBB Admiral
Posts: 1722
Joined: Wed Aug 18, 1999 2:01 am

Post by Skyalmian »

Not bad, but maybe light map calculations for each light face should be scaled per the area of the wall the light is on, since in its current form large sides with lights don't light up the whole face.
User avatar
Tyranny
DBB Defender
DBB Defender
Posts: 3399
Joined: Sun Nov 10, 2002 3:01 am
Location: Phoenix, Arizona

Post by Tyranny »

Riot wrote:
Jeff250 wrote:Was the light map toggle moved or removed from the render options menu?
I concur.
Hey is anyone up for game?

edit: where can I get Martyr Prime?
http://missions.dyndns.org/ - Descent Mission Designs

Houses all the MP levels I've built over the years.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

The lightmap render toggle was temporarily unavailable due to a bug which is fixed now.

Just made a clean install of Catalyst 5.5 on my home machine (remove old driver, reboot, install new driver, reboot). Did not cure my problem with the lightmapping code (low framerates, and that on a X800 XT PE). :(

Skya,

the current lightmapping method makes sense in how far it reaches: A light sources power does not depend on the size of the face it sits on, but simply on its brightness.

If you want it otherwise, convert your levels to D2X-W32 levels and add colored lights. As these work by lighting the vertices, big faces will get completely lit as well.

Edit: It's ofc a different story if the whole texture is a light ... I have changed lightmap range calculation to take the base side size into account. Try D2X-W32 v1.4.22 (and send me that level ;)).
Lehm
DBB Ace
DBB Ace
Posts: 121
Joined: Thu Nov 05, 1998 12:01 pm

Post by Lehm »

Diedel wrote: Edit: It's ofc a different story if the whole texture is a light ... I have changed lightmap range calculation to take the base side size into account. Try D2X-W32 v1.4.22 (and send me that level ;)).
Changing the lighting range based on surface size is part of my new code, you beat me too it :)
User avatar
Tyranny
DBB Defender
DBB Defender
Posts: 3399
Joined: Sun Nov 10, 2002 3:01 am
Location: Phoenix, Arizona

Post by Tyranny »

I'm just wondering why lightmapping on an old ass game like D2 takes my framerate from 60fps with AAx2, AFx2 down to 14-16fps in fairly small levels at 1024x768...

It's also causing one of the lava textures not to be rendered correctly and lightmapped correctly...

Hell's Gauntlet 2.0: No Lightmaps
Image

Hell's Gauntlet 2.0: Lightmapped
Image

Note: I'm aware the FPS display is higher on the lightmapped screenshot but it drops down to 20 or lower while flying around.
Lehm
DBB Ace
DBB Ace
Posts: 121
Joined: Thu Nov 05, 1998 12:01 pm

Re: Lightmapping

Post by Lehm »

To quote myself.
Lehm wrote:We're having a few performance issues. So if it runs slow on your system let us know.
What kind of system do you have? Not sure about that texture, any see things similar?
User avatar
Tyranny
DBB Defender
DBB Defender
Posts: 3399
Joined: Sun Nov 10, 2002 3:01 am
Location: Phoenix, Arizona

Post by Tyranny »

If you scroll up you'll notice I already posted my system specs in my first post. I'm also well aware of the performance hit, but I wasn't expecting something that drastic on something so old. That isn't your fault, I'll just have to wait until optimizations can be made.

Anyways...

If I remember correctly that particular lava texture doesn't generate natural light, so I might have backlit it with a light texture using the lava texture as an overlay.

In the first screenshot you'll notice everything is illuminated nicely. This was a commonly used trick for areas that needed light and didn't allow for expected texture alignments with the light as the overlay. Also it was used, in situations such as these, especially in D1, where certain textures didn't provide natural lighting on their own when they should have.
Lehm
DBB Ace
DBB Ace
Posts: 121
Joined: Thu Nov 05, 1998 12:01 pm

Post by Lehm »

Figured out the texture issue. It's using the alpha from the bottom layer. That's actually a pixel shader thing. The fix should be in the next release.
User avatar
Tyranny
DBB Defender
DBB Defender
Posts: 3399
Joined: Sun Nov 10, 2002 3:01 am
Location: Phoenix, Arizona

Post by Tyranny »

Glad to be of service :mrgreen:

I've also noticed that this design trick stands out when you use colored weapon lights. When the walls turn "X" color, the parts of the wall where a light was used behind the texture stay solid and don't change as the rest of the wall would.
User avatar
Tyranny
DBB Defender
DBB Defender
Posts: 3399
Joined: Sun Nov 10, 2002 3:01 am
Location: Phoenix, Arizona

Post by Tyranny »

Well, that issue is fixed...

Hell's Gauntlet v2.0: With Lightmap (1.4.24)
Image

However when you alt+enter to minimize, the pixel shader goes back to doing what it did in the previous versions on that lava texture. This same thing also reverts flares back to not generating any light. Its a minor problem because the pixel shader would do what it is suppost to do either completely minimized when the level starts or completely maximized when the level starts.

Still, it should be able to compensate for the in-game adjustment and render everything as it would in either modes.
User avatar
Aus-RED-5
DBB Friend
DBB Friend
Posts: 1604
Joined: Fri Apr 23, 2004 7:27 am
Location: Adelaide, South Australia
Contact:

Post by Aus-RED-5 »

Found a prob with lightmap.

Yellow lights are giving off a red color. :?

At the end of this hallway there are yellow lights
at the door.

Lightmap Disabled
Image

Lightmap Enabled
Image
Red, White, Blue and Green colors are displaying correct. :)
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

That's just a wrong color assignment to these lights and will be fixed, thx for the hint. Now if you had named the level, or shown the light texture up close ... this way, I can only guess which light this is.

@all:

Lehm is currently writing an improved and faster lightmapping version.
Lightmapping is still in beta stage and subject to experiments and change.
Post Reply