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 Discussion / DBC - Help needed lighting a tomb

Author
Message
Robert The Robot
18
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 12th Apr 2007 21:31
I've been working on a computerised version of Senet (a popular game from ancient Egypt).

I've put the board inside a Pharaoh’s tomb, which I'd like to have in almost total darkness with a spotlight over the Senet board. Unfortunately, I can't get my head round the Light 3D command set.

I've tried reducing the ambient light and adding a spot light pointing down over the board, but my various experiments have resulted in the spotlight being drowned out or illuminating the whole tomb except for the Senet board!!!

Is there a way of creating a kind of diffuse "Cone of light" from the tomb's ceiling?

Also, I've been altering the ambient light level to get the tomb looking nice and dramatic - but is there a way of leaving the board unaffected by any lights and appearing under an ambience of 50% (if that doesn't sound too stupid...)

On our way 'ome, on our way 'ome...
Lucifer
19
Years of Service
User Offline
Joined: 26th Dec 2005
Location:
Posted: 12th Apr 2007 22:18
Quote: "I've put the board inside a Pharaoh’s tomb"


dont you mean level?


i like pancakes..
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 13th Apr 2007 01:00 Edited at: 13th Apr 2007 01:20
Hi RTR,

As you've discovered, lighting can be very tricky in DBC. The effect depends heavily on a high poly count and the direction of normals because of the shading algorithms. If you use a plane as a wall, the shading style will be flat - i.e. one intensity - no significant gradation. The same thing for the walls of a cube or box. You really won't be able to see much of a lighting effect except for ambient.

As a test try making a matrix with lots of tiles and randomize it a bit. Cast different types of light on it and you can see their effect quite clearly. Reduce the number of tiles and try the same effects - you'll notice a degradation in the lighting effect. This test will give you some idea of how the light is effected by poly count. Try casting light on a shpere versus a cube and you'll also notice a dramatic difference.

This should help also - when you create your models in an external program, make sure that you are exporting normals and that they are pointing in the correct direction. If you are creating an interior, make sure the normals are pointing inward, that way when you use lighting effects, they can be seen from the inside. If the model surface is exterior, make sure the normals are pointing outward.

As far as setting how a model reacts to light, there are 2 flags that are directly applicable to lights that you make, and ambient light in the command:

SET OBJECT Object Number, Wireframe, Transparency, Cull, Filter, Light, Fog, Ambient

Also, try using fog and changing the distances and color.

Enjoy your day.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Apr 2007 09:23
Take a look at the attached example and see if it gives you any clues as to what Latch was explaining to you...

TDK_Man

Attachments

Login to view attachments
Robert The Robot
18
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 16th Apr 2007 15:14
Just downloaded the example, will have a look at it tonight. I think I may have sorted the problem anyway though - I tried loading the tomb texture separately and using the "Fade Bitmap" command. It gave quite a nice effect...

Just out of curiosity, does the "Set Gamma" command permanently affect the computers screen settings? I only ask because I had contemplated using it to sort out my light problem, and I may need to use it elsewhere in the game.

On our way 'ome, on our way 'ome...
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Apr 2007 20:09 Edited at: 16th Apr 2007 20:26
Think of Set Gamma as a direct brightness control of the RGB pixel guns of your monitor. If you set it to 0,0,0 then it turns your monitor's pixels off.

You have to set it back to 255,255,255 to get the picture back.

It's ideal for fading a screen out at the end of a level, rebuilding the next level hidden and fading the new level back in.

Another use is by turning off the G and B channels to produce the 'red mist' effect in a game where a character is badly injured, (everything turns to different shades of red).

Try using Set Gamma 255,0,0 in your program to see what I mean.

TDK_Man

Robert The Robot
18
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 17th Apr 2007 13:26
I do see what you mean!!! It gives some lovely effects!!

Can't wait to generate some fade-ins and fade-outs for my game!

(By the way, your demo was fantastic. It's given me a lot to think about, and I'm almost certainly going to have to redo my current lighting code.)

On our way 'ome, on our way 'ome...

Login to post a reply

Server time is: 2025-05-29 00:40:53
Your offset time is: 2025-05-29 00:40:53