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 / More than eight lights? Need advice.

Author
Message
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 24th Apr 2003 16:33
Hi, guys! As some of you may already know, I'm working on a strategy game similar to X-Com; one of the things I'd like to be able to preserve is the lighting of X-Com - where your visibility is hindered until you start lighting the level yourself with strategically thrown flares.

Anyway, doing this would require some special kind of lighting, since DirectX limits DB to only eight lights. I've got a couple of ideas on the matter, but I'd like to get some advice on which one is best; normally, I would find out myself, but implementing both of them would involve a few weeks of learning outside the DB command set...

The first idea is to use pixel and/or vertex shaders. I wouldn't need the lights to be extremely sophisticated - they wouldn't even need as much functionality as the standard lights, so a basic vertex shader might be what I'm looking for.

I've heard that DirectX 8.1 can actually use 255 point lights, or something. Would it be possible to write a plugin or a DLL that allows access to these lights?

The final idea is to use a volume fog method that I've discovered recently. It sounds pretty simple, but requires two or three renders of the Z-depth of a scene; I haven't yet used any backbuffer functions of DB, so I'm not entirely sure whether this would be a plausable method, unless it becomes another DLL-jobbie.

Thanks in advance!
"I am a living, thinking entity who was created in the sea of information."
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Apr 2003 16:55
sorry can't add the point lights using a DLL with DarkBasic's access the way it currently is - perhaps when we have actual access to the pipeline we can, but i've tried several times to access the current frame of reference through the pointer system and failed everytime.

i mean you can take data out easily enough, placing it back in just isn't possible right now as far as i can tell.
however you may want to make Dynamic LightMaps

in a similar way to making a projected Shadow, you can make a lightmap in grey which you can colour to the flare and then project across the level which would then increase the light in that area without actually increasing the light.
which can be done with projection matrix (3DMaths)

this can be slow with large and complex lightmaps, but a 32x32 or 64x64 should be more than enough.
only problem then would be the objects, setting thier ambient light level to match - i'm not sure howto do that unless perhaps you set thier Vertex Colour to a darker colour.
guess you'll just really have to play about with effects for a while.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Hubdule
23
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 24th Apr 2003 17:29 Edited at: 24th Apr 2003 17:29
Create an automatic light culling system. You can use up to 8 lights at once so you could save the light positions in an array for later use. Then simply show the lights within a certain range to the camera and hide the others if you scroll and move around reposition the lights.

Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 24th Apr 2003 19:00
I wish I could use a light culling system, but it would be completely impractical - the chances of only having eight lights in use at a time are very low.

I'm thinking more about using vertex shaders now, since, after learning how to use them, I'd expect them to give me good control. To someone who knows more about them than I do: would it be possible to set up a lighting system using vertex shaders by affecting the vertex colour? Also, how fast would that be, assuming I'm only using small point lights?

"I am a living, thinking entity who was created in the sea of information."
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Apr 2003 19:03
well using the VS it'd be bloody fast (even on Software Shaders, if DBPro ever supports that) ... and it wouldn't be far off doing what i've suggested in the first place.

the only problem right now is that DBPro doesn't support software shaders, and therefor you'll be stopping alot of people using the game bcause thier hardware isn't upto the task.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?

Login to post a reply

Server time is: 2026-07-10 21:40:41
Your offset time is: 2026-07-10 21:40:41