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 / Localised Ambient Light

Author
Message
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 10th May 2003 22:52
I've rendered a matrix landscape by setting the normals data:



Now the next task I have is to set the lighting for the scenic objects based upon the normal data for the matrix tile it is occupying, so that trees and bushes in the shadow of a hill are not drawn at full brightness. Effectively setting the ambient light for each matrix tile.

Of course I can't using a conventional light because the matrix itself wont be casting a shadow. So pressumeably I want to edit the normal data for the object itself.

The only problem I have, is the complete lack of 'a clue' on how to set the normal data for an object.

Does anyone here have a brain capable of explaining these things to a primate please?
Pneumatic Dryll
http://www.users.globalnet.co.uk/~thane/char01.jpg[/img]
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 10th May 2003 23:21 Edited at: 10th May 2003 23:22
Can't you just use the fade object command to darken each piece of scenery towards the actual ambient light level?

Setting the normal data for an object requires the use of memblocks, which aren't too bad once you've got your head around them, but I wouldn't have thought it would be the optimal solution.

What would you do with the normal data? Use it to point the normal away from the light source? If you're going to do something like that, it might actually be better to set vertex colours instead.

"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: 10th May 2003 23:22
well you could always turn off ambient lighting and set the object gamma based on the normal length
its less brain taxing that way

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!
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 11th May 2003 00:22
I've updated the picture above to show the fruits of your knowledge - cheers I still have a few niggles though.

I've set the ambient light to 50 and used fade object 0-200 to set my 'localised ambient light' on the objects.

As you can see though light 0 is still interfering with some of the trees in the shade, and if I disable light 0 the matrix shading turns off.

I could disable the object sensitivity to lights, but i'd like to keep it so that I can use lights for special effects later.

Is it possible to shade the matrix without the use of a light? Or is there anything I can do with light 0 that will prevent it from illuminating the object but still light up the matrix?

Pneumatic Dryll
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 11th May 2003 01:52 Edited at: 11th May 2003 01:56
I don't think so - you can't control the vertex colour of matrices, otherwise you could disable its sensitivity to light and then set the vertices colouring to different shades of grey.

Also, doesn't disabling an object's sensitivity to standard light also remove it's sensitivity to ambient light? I'm not sure if it holds for DBPro, because I haven't used it enough yet, but I'm pretty certain that's what happened in DBClassic. What happens if you just remove sensitivity to ambient light? Can you come up with something from that?

One thing you could do, which is what I'm doing for a lot of my ghosted objects, is to have several different very small greyscale images (my program internally generates 128 of them at the start) and then apply them as lightmaps or one of the other multitextures. That way, if you apply a greyscale colour of 128, your object will then come out 50% darker than it was originally (assuming you're using it as a lightmap). Likewise, greyscale values of 0 and 255 will make the object completely black or completely normal respectively.

So, if your tree is out in the open on a bright day, you'd set its lightmap to a really light grey or white. If it's just covered up slightly, a middle grey lightmap would darken it a bit and, if it's in some heavy shade, then a dark grey colour would make it appear practically black. Get where I'm coming from?

"I am a living, thinking entity who was created in the sea of information."
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 11th May 2003 01:57
ambient light and lights are independantly controlled in DBPro

Sounds like a feasable idea for the light mapping, i've never done multi-texturing before though it sounds like I need the object ghosted... Would that then be a different object ghosted over the top of the first to achieve the effect?

I suspect that would be too much of a speed hit on this particular game - if i'd designed it with that in mind.... well I think i'm going to turn of object sensitivity to light and then enable it again temporarily for any objects in the proximity of a special effect that uses lighting.

Pneumatic Dryll
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 11th May 2003 02:07 Edited at: 11th May 2003 02:10
No, no different objects - you just use the set light mapping on command. You can simulate light mapping by using dark ghosted plains and other shapes, but using multitextures is much faster and you probably won't even incur any performance hits.

It doesn't actually introduce more polygons, you see - it just runs over another texture pass, which is pretty quick with all the hardware acceleration and stuff.

I use the above method mainly for fading ghosted objects in and out: if I wanted it 50% faded, give it a 50% grey lightmap!

"I am a living, thinking entity who was created in the sea of information."
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 11th May 2003 14:55
*yawn* That was a late one, I tried in vein to get the light mapping technique to work, but I think the way i'm re-using my objects that DBPro's fancy new pipeline kept telling me to be more reasonable or get out more.

I ended up doing your first suggestion and turning off the sensitivity to lights. The light 0 interferance isn't actually that bad, so re-enabling it for the duration of any special effects shouldn't cause too much of a problem.

Thanks for all your help .

Pneumatic Dryll

Login to post a reply

Server time is: 2026-07-11 17:07:01
Your offset time is: 2026-07-11 17:07:01