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.

DarkBASIC Professional Discussion / Semi-Dynamic Lightmap + Cubic Lighting

Author
Message
aki
16
Years of Service
User Offline
Joined: 8th Nov 2008
Location:
Posted: 5th May 2009 04:30 Edited at: 5th May 2009 04:57
I've been working on a dumb shadowing idea inspired by videos of this game in development. Sure, without writing my own lightmapping routine it's pretty much a lost cause to match the speed of their lightmapping. But then I realized a possible use: using DarkLights thread lightmapping, one could create a lighting system that updates lightmaps at a speed useful enough for arguably the most common use of dynamic lighting/shadows - smooth day-night transitions. Furthermore, it can support some ridiculously complex transparency, meaning I can finally create some good looking grass. Combined with EVOLVED's cubic lighting shader for shadowing dynamic objects, I created the system.



The FPS is great, and using just about anything other than lightmaps with such an intensive layered transparency grass system would just murder the performance. After I eventually throw in some real vegetation, I expect it to look even better, but with a bit higher load time as the only real consequence.

My question I guess is that is there any way to have dynamic objects cast light onto the static world too (just the main grass layer, I know that the rest are a lost cause)? I'm completely at a loss as to how to modify the cubic lighting shader to incorporate the lightmap, and I'd imagine it'd destroy the framerate. All I know is that I would have to take out the normal mapping function and add the lightmap to the cubic light.

If you want to try out the system thus far, I've attached it - please do tell me how your performance is.
1 - Move the dynamic object up
2 - Move the dynamic object down
3 - Hide the extra grass layers, make the grass look lame, but gain 100 fps.
4 - Update the lightmap in realtime

Attachments

Login to view attachments
Duke E
16
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 5th May 2009 12:07 Edited at: 5th May 2009 12:11
Looks great, i like the swaying grass effect though fps expensive.
AMD64 3500+ with an AGP Nv7600 and i get ~45FPS looking at the objects.

Option 4 did not do anything though? (edit: Ah i see the light is not moved so the lightmap stays the same)

Regards
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 5th May 2009 19:45
Very nice, especially like the grass effect.

For some reason the source won't work for me, even though I have darklights and the most recent patch for DBPro. Just wanted a close up of the grass effect .


Health, Ammo, and bacon and eggs!
aki
16
Years of Service
User Offline
Joined: 8th Nov 2008
Location:
Posted: 6th May 2009 04:29
Thanks for the feeback.

Quote: "For some reason the source won't work for me, even though I have darklights and the most recent patch for DBPro. Just wanted a close up of the grass effect."

Odd. Do you have Darkshader? If not, you could take out all the cubemap stuff, but then the cube wouldn't recieve shadows.

I'm going to try and break up the grass plains into smaller pieces and make the bottom ground layer use a detail map and at least 1 other texture. However, I'm still at a loss as to how to preserve lightmap detail in a shader.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th May 2009 09:24
Disabling the DarkLights stuff did the trick, I have dark shader, but I'm sure I've seen this problem with DarkLights before when trying to lightmap an advanced terrain.

Anyhoo it's a very nice effect, if anyone makes a Viva Pinata game then that would be a good start.


Health, Ammo, and bacon and eggs!
Humanoid
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Finland
Posted: 6th May 2009 10:18 Edited at: 6th May 2009 10:19
Nice

FPS 470 and when press '3' then fps jump 680

------------------
System Information
------------------
Time of this report: 5/6/2009, 10:16:31
Machine name: ----------
Operating System: Windows XP Professional (5.1, Build 2600) Service Pack 3 (2600.xpsp_sp3_gdr.090206-1234)
Language: English (Regional Setting: Finnish)
System Manufacturer: System manufacturer
System Model: P5K
BIOS: BIOS Date: 05/24/07 17:48:01 Ver: 08.00.12
Processor: Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66GHz (2 CPUs)
Memory: 2048MB RAM
Page File: 573MB used, 3369MB available
Windows Dir: C:WINDOWS
DirectX Version: DirectX 9.0c (4.09.0000.0904)
DX Setup Parameters: Not found
DxDiag Version: 5.03.2600.5512 32bit Unicode

Gigabyte NVIDIA GeForce 9600 GT

Suomi Finland PERKELE!
aki
16
Years of Service
User Offline
Joined: 8th Nov 2008
Location:
Posted: 29th May 2009 03:59 Edited at: 5th Jul 2009 21:29
I FINALLY finished the shader, which blends three terrain textures (the grass layer uses vertex fur) based on a blend map. Once I use this shader in combination with my cliff terrain system, each height layer should be able to support three different tiles along with blurring. The Warcraft III-esque cliff-based terrain system will use this shader for each height layer.

Quote: "Disabling the DarkLights stuff did the trick, I have dark shader, but I'm sure I've seen this problem with DarkLights before when trying to lightmap an advanced terrain."

Odd. You shouldn't have to turn off Dark Lights...

Quote: "FPS 470 and when press '3' then fps jump 680 "

Wow.

EDIT: Now I've been working on the shader to combine the cubic lighting (or rather, I'm using a 2d projection shader instead) and the lightmap, in a way casting shadows from the lightmap onto dynamic 3d objects. I've hit a bit of a snag however, as the 2d shadow projection shader by EVOLVED that I edited ends up projecting a spherical image, in that the lightmap I project is fine at the center but the further you get from the center the more distorted the lightmap becomes. Running the spherize filter on it in photoshop is a temporary fix, but considering how the lightmap changes every hour or so, that seems to be an unlikely solution.

Any help with this shader would be appreciated so I can finally finish the thread's technique. I believe the problem lies with the Proj matrix multiplication, but any changes I make to it really mess it up. If necessary, I can attach the media and source.

EDIT: Fur Terrain Blend Shader

Login to post a reply

Server time is: 2025-05-22 04:36:04
Your offset time is: 2025-05-22 04:36:04